Compare commits
91 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7547f78889 | |||
| fdd72c9a2f | |||
| e82c6c39f4 | |||
| ef8e986bde | |||
| e3be8c8627 | |||
| fbc7e8845d | |||
| 08d418904a | |||
| d040e76442 | |||
| 56282a5bc7 | |||
| 4c5298f352 | |||
| 21c9b6bdc9 | |||
| 65eb64765c | |||
| 7de96f7fc1 | |||
| ab755ac81a | |||
| 6e0b6d52da | |||
| 188d488409 | |||
| f90e50f60b | |||
| 6adab7a1a8 | |||
| 023dd903cc | |||
| e5ebd22d99 | |||
| bcb8a868ce | |||
| 554052c600 | |||
| bc94dbb661 | |||
| 841810cef6 | |||
| 1bf44c7acb | |||
| 7dfe8e2bde | |||
| fbfe388d31 | |||
| e348fc7fe8 | |||
| 8f35eb024e | |||
| 60625313b0 | |||
| 1790bb36c5 | |||
| 896be7d93a | |||
| f012ae0759 | |||
| 3f5bc38037 | |||
| abd6d84a11 | |||
| 27338e6ed7 | |||
| d7a558a9fb | |||
| ced9813b12 | |||
| 75f2d540ac | |||
| 67f7c780f3 | |||
| 6109e50f87 | |||
| a478b3fa80 | |||
| b0a8ea046a | |||
| 370c9f498d | |||
| 716d6d2da7 | |||
| 34f7490311 | |||
| 6c96946475 | |||
| f7679ad19e | |||
| 227a1c482c | |||
| 2b8246e3e2 | |||
| 7e36962e6c | |||
| 7d9f3943ba | |||
| 85830a70c2 | |||
| 48ccef8059 | |||
| c3d53189fc | |||
| 81d1765ad8 | |||
| a9d79ae95d | |||
| db082408c6 | |||
| d409792838 | |||
| a2c16c084a | |||
| f6653871b2 | |||
| 07fa864d15 | |||
| 936c6d7e9e | |||
| 4ff7bc45c6 | |||
| a3a2b3bdc0 | |||
| 6d81449fc6 | |||
| 092d993cb7 | |||
| 98d2038fc2 | |||
| 3861f546e3 | |||
| a1f42c7c32 | |||
| a539c8a464 | |||
| db56bcbe42 | |||
| 57d6b25ec9 | |||
| e6ecd6630d | |||
| f9d18e472b | |||
| 5175b324b8 | |||
| f55a4cf80c | |||
| 0943f0bdc8 | |||
| 71be5c5c87 | |||
| fde3b1c715 | |||
| 50126644a5 | |||
| 12886632c6 | |||
| 4b11bad358 | |||
| ab5190a46c | |||
| d9883570f5 | |||
| e6a8bbbb62 | |||
| 2b6c874b13 | |||
| 8a1b87cb97 | |||
| 138eeeb1b0 | |||
| 6c5696381e | |||
| c86e51358b |
@@ -502,6 +502,11 @@ sqlite3$(TEXE): $(TOP)/src/shell.c libsqlite3.la sqlite3.h
|
||||
-o $@ $(TOP)/src/shell.c libsqlite3.la \
|
||||
$(LIBREADLINE) $(TLIBS) -rpath "$(libdir)"
|
||||
|
||||
mptester$(EXE): sqlite3.c $(TOP)/mptest/mptest.c
|
||||
$(LTLINK) -o $@ -I. $(TOP)/mptest/mptest.c sqlite3.c \
|
||||
$(TLIBS) -rpath "$(libdir)"
|
||||
|
||||
|
||||
# This target creates a directory named "tsrc" and fills it with
|
||||
# copies of all of the C source code and header files needed to
|
||||
# build on the target system. Some of the C source code and header
|
||||
@@ -946,8 +951,11 @@ clean:
|
||||
rm -f testfixture$(TEXE) test.db
|
||||
rm -f sqlite3.dll sqlite3.lib sqlite3.exp sqlite3.def
|
||||
rm -f sqlite3.c
|
||||
rm -f sqlite3rc.h
|
||||
rm -f shell.c sqlite3ext.h
|
||||
rm -f sqlite3_analyzer$(TEXE) sqlite3_analyzer.c
|
||||
rm -f sqlite-*-output.vsix
|
||||
rm -f mptester mptester.exe
|
||||
|
||||
distclean: clean
|
||||
rm -f config.log config.status libtool Makefile sqlite3.pc
|
||||
|
||||
@@ -813,6 +813,10 @@ sqlite3.exe: $(TOP)\src\shell.c libsqlite3.lib $(LIBRESOBJS) sqlite3.h
|
||||
$(TOP)\src\shell.c \
|
||||
/link $(LTLINKOPTS) $(LTLIBPATHS) libsqlite3.lib $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
|
||||
|
||||
mptester.exe: $(TOP)\mptest\mptest.c libsqlite3.lib $(LIBRESOBJS) sqlite3.h
|
||||
$(LTLINK) $(TOP)\mptest\mptest.c \
|
||||
/link $(LTLINKOPTS) $(LTLIBPATHS) libsqlite3.lib $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
|
||||
|
||||
# This target creates a directory named "tsrc" and fills it with
|
||||
# copies of all of the C source code and header files needed to
|
||||
# build on the target system. Some of the C source code and header
|
||||
@@ -1250,8 +1254,10 @@ clean:
|
||||
del /Q sqlite3.dll sqlite3.lib sqlite3.exp sqlite3.def
|
||||
del /Q sqlite3.c
|
||||
del /Q sqlite3rc.h
|
||||
del /Q shell.c sqlite3ext.h
|
||||
del /Q sqlite3_analyzer.exe sqlite3_analyzer.exp sqlite3_analyzer.c
|
||||
del /Q sqlite-*-output.vsix
|
||||
del /Q mptester.exe
|
||||
|
||||
# Dynamic link library section.
|
||||
#
|
||||
|
||||
@@ -662,4 +662,6 @@ clean:
|
||||
rm -rf tsrc target_source
|
||||
rm -f testloadext.dll libtestloadext.so
|
||||
rm -f sqlite3.c fts?amal.c tclsqlite3.c
|
||||
rm -f sqlite3rc.h
|
||||
rm -f shell.c sqlite3ext.h
|
||||
rm -f $(SHPREFIX)sqlite3.$(SO)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.62 for sqlite 3.7.16.
|
||||
# Generated by GNU Autoconf 2.62 for sqlite 3.7.17.
|
||||
#
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
|
||||
# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||
@@ -743,8 +743,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME='sqlite'
|
||||
PACKAGE_TARNAME='sqlite'
|
||||
PACKAGE_VERSION='3.7.16'
|
||||
PACKAGE_STRING='sqlite 3.7.16'
|
||||
PACKAGE_VERSION='3.7.17'
|
||||
PACKAGE_STRING='sqlite 3.7.17'
|
||||
PACKAGE_BUGREPORT=''
|
||||
|
||||
# Factoring default headers for most tests.
|
||||
@@ -1484,7 +1484,7 @@ if test "$ac_init_help" = "long"; then
|
||||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures sqlite 3.7.16 to adapt to many kinds of systems.
|
||||
\`configure' configures sqlite 3.7.17 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
@@ -1549,7 +1549,7 @@ fi
|
||||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of sqlite 3.7.16:";;
|
||||
short | recursive ) echo "Configuration of sqlite 3.7.17:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
@@ -1665,7 +1665,7 @@ fi
|
||||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
sqlite configure 3.7.16
|
||||
sqlite configure 3.7.17
|
||||
generated by GNU Autoconf 2.62
|
||||
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
|
||||
@@ -1679,7 +1679,7 @@ cat >config.log <<_ACEOF
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by sqlite $as_me 3.7.16, which was
|
||||
It was created by sqlite $as_me 3.7.17, which was
|
||||
generated by GNU Autoconf 2.62. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
@@ -14032,7 +14032,7 @@ exec 6>&1
|
||||
# report actual input values of CONFIG_FILES etc. instead of their
|
||||
# values after options handling.
|
||||
ac_log="
|
||||
This file was extended by sqlite $as_me 3.7.16, which was
|
||||
This file was extended by sqlite $as_me 3.7.17, which was
|
||||
generated by GNU Autoconf 2.62. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@@ -14085,7 +14085,7 @@ Report bugs to <bug-autoconf@gnu.org>."
|
||||
_ACEOF
|
||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_version="\\
|
||||
sqlite config.status 3.7.16
|
||||
sqlite config.status 3.7.17
|
||||
configured by $0, generated by GNU Autoconf 2.62,
|
||||
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ if {![info exists testdir]} {
|
||||
}
|
||||
source [file join [file dirname [info script]] rtree_util.tcl]
|
||||
source $testdir/tester.tcl
|
||||
set testprefix rtree1
|
||||
|
||||
# Test plan:
|
||||
#
|
||||
|
||||
@@ -61,7 +61,7 @@ do_test rtree5-1.9 {
|
||||
do_test rtree5-1.10 {
|
||||
execsql { SELECT (1<<31)-5, (1<<31)-1, -1*(1<<31), -1*(1<<31)+5 }
|
||||
} {2147483643 2147483647 -2147483648 -2147483643}
|
||||
do_test rtree5-1.10 {
|
||||
do_test rtree5-1.11 {
|
||||
execsql {
|
||||
INSERT INTO t1 VALUES(2, (1<<31)-5, (1<<31)-1, -1*(1<<31), -1*(1<<31)+5)
|
||||
}
|
||||
|
||||
@@ -365,6 +365,10 @@ sqlite3$(EXE): $(TOP)/src/shell.c libsqlite3.a sqlite3.h
|
||||
$(TOP)/src/shell.c \
|
||||
libsqlite3.a $(LIBREADLINE) $(TLIBS) $(THREADLIB)
|
||||
|
||||
mptester$(EXE): sqlite3.c $(TOP)/mptest/mptest.c
|
||||
$(TCCX) -o $@ -I. $(TOP)/mptest/mptest.c sqlite3.c \
|
||||
$(TLIBS) $(THREADLIB)
|
||||
|
||||
sqlite3.o: sqlite3.c
|
||||
$(TCCX) -c sqlite3.c
|
||||
|
||||
@@ -622,5 +626,8 @@ clean:
|
||||
rm -f testfixture testfixture.exe
|
||||
rm -f threadtest3 threadtest3.exe
|
||||
rm -f sqlite3.c fts?amal.c tclsqlite3.c
|
||||
rm -f sqlite3rc.h
|
||||
rm -f shell.c sqlite3ext.h
|
||||
rm -f sqlite3_analyzer sqlite3_analyzer.exe sqlite3_analyzer.c
|
||||
rm -f sqlite-*-output.vsix
|
||||
rm -f mptester mptester.exe
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
C Minor\schanges\sto\sunixMapfile()\sfunction.
|
||||
D 2013-04-01T14:20:23.253
|
||||
C Expand\sscope\sof\sthe\sSQLITE_DISABLE_MMAP\sdefine\sfor\sthe\sWin32\sVFS.
|
||||
D 2013-04-11T22:52:44.089
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in df3e48659d80e1b7765785d8d66c86b320f72cc7
|
||||
F Makefile.in 3dd3fcb87b70c78d99b2c8a03e44ec86d6ca9ce2
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
F Makefile.msc 0c1abc21c8deefc88e8a32ad6a07e5f96e158761
|
||||
F Makefile.vxworks b18ad88e9a8c6a001f5cf4a389116a4f1a7ab45f
|
||||
F Makefile.msc a244e5b5ba2493625db95b4d46b79201ea868bfe
|
||||
F Makefile.vxworks db21ed42a01d5740e656b16f92cb5d8d5e5dd315
|
||||
F README cd04a36fbc7ea56932a4052d7d0b7f09f27c33d6
|
||||
F VERSION 6d4f66eaebabc42ef8c2a4d2d0caf4ce7ee81137
|
||||
F VERSION 05c7bd63b96f31cfdef5c766ed91307ac121f5aa
|
||||
F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
|
||||
F addopcodes.awk 17dc593f791f874d2c23a0f9360850ded0286531
|
||||
F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2
|
||||
@@ -15,7 +15,7 @@ F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2
|
||||
F config.guess 226d9a188c6196f3033ffc651cbc9dcee1a42977
|
||||
F config.h.in 0921066a13130082764ab4ab6456f7b5bebe56de
|
||||
F config.sub 9ebe4c3b3dab6431ece34f16828b594fb420da55
|
||||
F configure 00d3a5fda47ee7dd3e68dc9dad7eeb439cd1ffea x
|
||||
F configure 8bb8bd13d3c918c4c1c73480930e81f955ac298a x
|
||||
F configure.ac 81c43d151d0b0e406be056394cc9ff4cb3fd0444
|
||||
F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad
|
||||
F doc/lemon.html 334dbf6621b8fb8790297ec1abf3cfa4621709d1
|
||||
@@ -85,11 +85,11 @@ F ext/icu/sqliteicu.h 728867a802baa5a96de7495e9689a8e01715ef37
|
||||
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
|
||||
F ext/rtree/rtree.c 757abea591d4ff67c0ff4e8f9776aeda86b18c14
|
||||
F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e
|
||||
F ext/rtree/rtree1.test e474a2b5eff231496dbd073fe67e5fbaf7f444c9
|
||||
F ext/rtree/rtree1.test cf679265ecafff494a768ac9c2f43a70915a6290
|
||||
F ext/rtree/rtree2.test acbb3a4ce0f4fbc2c304d2b4b784cfa161856bba
|
||||
F ext/rtree/rtree3.test a494da55c30ee0bc9b01a91c80c81b387b22d2dc
|
||||
F ext/rtree/rtree4.test c8fe384f60ebd49540a5fecc990041bf452eb6e0
|
||||
F ext/rtree/rtree5.test 9a229678a00f40e6aedb40cb3a07ec5444af892c
|
||||
F ext/rtree/rtree5.test 6a510494f12454bf57ef28f45bc7764ea279431e
|
||||
F ext/rtree/rtree6.test 3ff9113b4a872fa935309e3511cd9b7cdb4d2472
|
||||
F ext/rtree/rtree7.test 1fa710b9e6bf997a0c1a537b81be7bb6fded1971
|
||||
F ext/rtree/rtree8.test 9772e16da71e17e02bdebf0a5188590f289ab37d
|
||||
@@ -103,13 +103,19 @@ F ext/rtree/tkt3363.test 142ab96eded44a3615ec79fba98c7bde7d0f96de
|
||||
F ext/rtree/viewrtree.tcl eea6224b3553599ae665b239bd827e182b466024
|
||||
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
|
||||
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
|
||||
F main.mk c5437f64aad34844d18efe7b2d2adaa36efca49c
|
||||
F main.mk dcb05737414488383369b93e33cf1a1484c4b6e6
|
||||
F mkdll.sh 7d09b23c05d56532e9d44a50868eb4b12ff4f74a
|
||||
F mkextu.sh 416f9b7089d80e5590a29692c9d9280a10dbad9f
|
||||
F mkextw.sh 4123480947681d9b434a5e7b1ee08135abe409ac
|
||||
F mkopcodec.awk f6fccee29e68493bfd90a2e0466ede5fa94dd2fc
|
||||
F mkopcodeh.awk 29b84656502eee5f444c3147f331ee686956ab0e
|
||||
F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83
|
||||
F mptest/config01.test 3f4ddeb152a4f83872f0fa7fcb48d9fd609893da
|
||||
F mptest/config02.test 962913ed2b537d60de4126db7fe54716865cdd22
|
||||
F mptest/crash01.test a5f31998ed48de8267d6620e8af107ec148e5f12
|
||||
F mptest/crash02.subtest f4ef05adcd15d60e5d2bd654204f2c008b519df8
|
||||
F mptest/mptest.c 53066ffe4ae6f0c4de451cc77985b88d0fee2aec
|
||||
F mptest/multiwrite01.test 81fbc17657964889b60750bd7bbb1deffe8f4d42
|
||||
F spec.template 86a4a43b99ebb3e75e6b9a735d5fd293a24e90ca
|
||||
F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
|
||||
F sqlite3.1 6be1ad09113570e1fc8dcaff84c9b0b337db5ffc
|
||||
@@ -118,32 +124,32 @@ F src/alter.c f8db986c03eb0bfb221523fc9bbb9d0b70de3168
|
||||
F src/analyze.c d5f895810e8ff9737c9ec7b76abc3dcff5860335
|
||||
F src/attach.c 1816f5a9eea8d2010fc2b22b44f0f63eb3a62704
|
||||
F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34
|
||||
F src/backup.c b2cac9f7993f3f9588827b824b1501d0c820fa68
|
||||
F src/backup.c b266767351ae2d847716c56fcb2a1fea7c761c03
|
||||
F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb
|
||||
F src/btmutex.c 976f45a12e37293e32cae0281b15a21d48a8aaa7
|
||||
F src/btree.c 84c9a4a20b827a6f7dbcbcda59607dbee57af446
|
||||
F src/btree.c 5f2c4fe72f663bba837c5d01a732799c1d1c93f8
|
||||
F src/btree.h d9490cd37aaeb530a41b07f06e1262950b1be916
|
||||
F src/btreeInt.h eecc84f02375b2bb7a44abbcbbe3747dde73edb2
|
||||
F src/build.c 083da8466fd7e481cb8bd5264398f537507f6176
|
||||
F src/callback.c d7e46f40c3cf53c43550b7da7a1d0479910b62cc
|
||||
F src/complete.c dc1d136c0feee03c2f7550bafc0d29075e36deac
|
||||
F src/ctime.c 2a5f251fcd7393808df77ccfc817e7058df08c4c
|
||||
F src/ctime.c 61a53c7e0db5e7ba60cf23b73deaf6779aa715d3
|
||||
F src/date.c 067a81c9942c497aafd2c260e13add8a7d0c7dd4
|
||||
F src/delete.c aeabdabeeeaa0584127f291baa9617153d334778
|
||||
F src/expr.c 48048fca951eedbc74aa32262154410d56c83812
|
||||
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
|
||||
F src/fkey.c e16942bd5c8a868ac53287886464a5ed0e72b179
|
||||
F src/func.c 48987c025d69399f59a1c2a553cea5da41bf105d
|
||||
F src/global.c e59ecd2c553ad0d4bfbc84ca71231336f8993a7a
|
||||
F src/func.c d3fdcff9274bc161152e67ed3f626841c247f4b9
|
||||
F src/global.c d2494a1cea8f66a2cab8258449df07f8f0ae6330
|
||||
F src/hash.c ac3470bbf1ca4ae4e306a8ecb0fdf1731810ffe4
|
||||
F src/hash.h 8890a25af81fb85a9ad7790d32eedab4b994da22
|
||||
F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08
|
||||
F src/insert.c f7cb141e8ce257cb6b15c497f09e4e23d6055599
|
||||
F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d
|
||||
F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f
|
||||
F src/legacy.c 0df0b1550b9cc1f58229644735e317ac89131f12
|
||||
F src/lempar.c cdf0a000315332fc9b50b62f3b5e22e080a0952b
|
||||
F src/loadext.c 1422eba4aa2b1fb5f7b3aef574752272477d21e2
|
||||
F src/main.c 379160ec3680e3009aa4978eac47027c3ef27ac5
|
||||
F src/main.c 54a841854734b6731c4d026834788cac6a19f3d1
|
||||
F src/malloc.c fe085aa851b666b7c375c1ff957643dc20a04bf6
|
||||
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
|
||||
F src/mem1.c 437c7c4af964895d4650f29881df63535caaa1fa
|
||||
@@ -157,50 +163,50 @@ F src/mutex_noop.c 7682796b7d8d39bf1c138248858efcd10c9e1553
|
||||
F src/mutex_unix.c c3a4e00f96ba068a8dbef34084465979aaf369cc
|
||||
F src/mutex_w32.c 32a9b3841e2d757355f0012b860b1bc5e01eafa0
|
||||
F src/notify.c 976dd0f6171d4588e89e874fcc765e92914b6d30
|
||||
F src/os.c 809d0707cec693e1b9b376ab229271ad74c3d35d
|
||||
F src/os.c ca679b293a6233327e418fd1dde2cd5db3e90932
|
||||
F src/os.h ae08bcc5f6ec6b339f4a2adf3931bb88cc14c3e4
|
||||
F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
|
||||
F src/os_unix.c 2c54787f5c60b850bd8a9ed6c029100cde2429dc
|
||||
F src/os_win.c e4f17ddf79f2a9373e33ed70565e765d65324589
|
||||
F src/pager.c 30009ae5800f80e21da1f118fabfc72b34d8c722
|
||||
F src/os_unix.c 5707fcb125f043e2d3376ea862e8ec83633c5e0e
|
||||
F src/os_win.c 190be0e689be61b3dcb8c1d253bc967e09c1866e
|
||||
F src/pager.c 28f45e60d9a173368872d6e688e7a848c3926344
|
||||
F src/pager.h 5cb78b8e1adfd5451e600be7719f5a99d87ac3b1
|
||||
F src/parse.y 5d5e12772845805fdfeb889163516b84fbb9ae95
|
||||
F src/pcache.c f8043b433a57aba85384a531e3937a804432a346
|
||||
F src/pcache.h a5e4f5d9f5d592051d91212c5949517971ae6222
|
||||
F src/pcache1.c 9fd22671c270b35131ef480bbc00392b8b5f8ab9
|
||||
F src/pragma.c 8875d32d54530300e6aa31a9d5426b2088a69b12
|
||||
F src/prepare.c 310eaff1ee5f3c700b3545afb095cfe9346efc3a
|
||||
F src/pragma.c 216d6c24520f7b2e267a2356e5d3269d28690f49
|
||||
F src/prepare.c 743e484233c51109666d402f470523553b41797c
|
||||
F src/printf.c 4a9f882f1c1787a8b494a2987765acf9d97ac21f
|
||||
F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50
|
||||
F src/resolve.c 9079da7d59aed2bb14ec8315bc7f720dd85b5b65
|
||||
F src/rowset.c 64655f1a627c9c212d9ab497899e7424a34222e0
|
||||
F src/select.c 01540bcd3df3c8f1187158e77986028b1c667258
|
||||
F src/shell.c 7c41bfcd9e5bf9d96b9215f79b03a5b2b44a3bca
|
||||
F src/sqlite.h.in 921ba42ec3531fe8cf021492ffd781b161383f1b
|
||||
F src/shell.c 319b7791cee6c763b60fde1b590bfaf62613cf37
|
||||
F src/sqlite.h.in f606903594d314d1b63e677affb1a03e3c9a49c7
|
||||
F src/sqlite3.rc fea433eb0a59f4c9393c8e6d76a6e2596b1fe0c0
|
||||
F src/sqlite3ext.h 7183ab832e23db0f934494f16928da127a571d75
|
||||
F src/sqliteInt.h 0f8f05ee4db4ba9120b38f7a3992b325698f6e8a
|
||||
F src/sqliteLimit.h 83d0cd0ce3050a80930406d3c7aecb48c1ccdfc5
|
||||
F src/sqliteInt.h 1c517a89cfdba28084093607ec79af70359c7f9b
|
||||
F src/sqliteLimit.h 3ea5c07b370b8033c30f66515ccf4e875c252429
|
||||
F src/status.c bedc37ec1a6bb9399944024d63f4c769971955a9
|
||||
F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
|
||||
F src/tclsqlite.c 9a716c737590d2f129d71c8fc7065e5aba0e7222
|
||||
F src/test1.c 26e66b839f42c2eed6833f9023e0098f0d863f35
|
||||
F src/test2.c 4178056dd1e7d70f954ad8a1e3edb71a2a784daf
|
||||
F src/test3.c 3c3c2407fa6ec7a19e24ae23f7cb439d0275a60d
|
||||
F src/test4.c bf9fa9bece01de08e6f5e02314e4af5c13590dfa
|
||||
F src/test1.c 6784fdacb35c33ba564ef749b62c4718fe515484
|
||||
F src/test2.c 29e7154112f7448d64204e8d31179cf497ecf425
|
||||
F src/test3.c 96aed72a8e1d542fed127e3e8350ae357712fa82
|
||||
F src/test4.c cea2c55110241e4674e66d476d29c914627999f5
|
||||
F src/test5.c a6d1ac55ac054d0b2b8f37b5e655b6c92645a013
|
||||
F src/test6.c a437f76f9874d2563352a7e6cd0d43217663c220
|
||||
F src/test7.c 2e0781754905c8adc3268d8f0967e7633af58843
|
||||
F src/test7.c f4b894b7931f8cf9f5cbf37cfa0727703f526a40
|
||||
F src/test8.c 58ea1d9698f3947e4662107ef98f429e84ae20e0
|
||||
F src/test9.c bea1e8cf52aa93695487badedd6e1886c321ea60
|
||||
F src/test_async.c 0612a752896fad42d55c3999a5122af10dcf22ad
|
||||
F src/test_autoext.c 30e7bd98ab6d70a62bb9ba572e4c7df347fe645e
|
||||
F src/test_backup.c c129c91127e9b46e335715ae2e75756e25ba27de
|
||||
F src/test_btree.c 5b89601dcb42a33ba8b820a6b763cc9cb48bac16
|
||||
F src/test_config.c ab6605a41f2020912d5e44b8dd4b9fb21bd75ac0
|
||||
F src/test_config.c b6f5d680f0cf03d0ae9d6165bd2e447d9b356e4a
|
||||
F src/test_demovfs.c 20a4975127993f4959890016ae9ce5535a880094
|
||||
F src/test_devsym.c e7498904e72ba7491d142d5c83b476c4e76993bc
|
||||
F src/test_fs.c 1c51e203b2c20235d8c3739f8c1fb13a7502915b
|
||||
F src/test_fs.c 8f786bfd0ad48030cf2a06fb1f050e9c60a150d7
|
||||
F src/test_func.c 3a8dd37c08ab43b76d38eea2836e34a3897bf170
|
||||
F src/test_fuzzer.c 1d26aa965120420bc14807da29d4d4541bfa6148
|
||||
F src/test_hexio.c abfdecb6fa58c354623978efceb088ca18e379cd
|
||||
@@ -218,7 +224,7 @@ F src/test_osinst.c 90a845c8183013d80eccb1f29e8805608516edba
|
||||
F src/test_pcache.c a5cd24730cb43c5b18629043314548c9169abb00
|
||||
F src/test_quota.c 1ec82e02fd3643899e9a5de9684515e84641c91f
|
||||
F src/test_quota.h 8761e463b25e75ebc078bd67d70e39b9c817a0cb
|
||||
F src/test_regexp.c 5ff0eafd66c9a209417142fa319006f7028fbda8
|
||||
F src/test_regexp.c 06ae8138d41a793330f62351283dd6f6f21104f4
|
||||
F src/test_rtree.c aba603c949766c4193f1068b91c787f57274e0d9
|
||||
F src/test_schema.c 8c06ef9ddb240c7a0fcd31bc221a6a2aade58bf0
|
||||
F src/test_server.c 2f99eb2837dfa06a4aacf24af24c6affdf66a84f
|
||||
@@ -226,10 +232,10 @@ F src/test_spellfix.c 56dfa6d583ac34f61af0834d7b58d674e7e18e13
|
||||
F src/test_sqllog.c bc50e5afeb7fb50e77b4594e42302df9d05446aa
|
||||
F src/test_stat.c d1569c7a4839f13e80187e2c26b2ab4da2d03935
|
||||
F src/test_superlock.c 2b97936ca127d13962c3605dbc9a4ef269c424cd
|
||||
F src/test_syscall.c fe018f95049d4f24e036d1d649516b60689b4e57
|
||||
F src/test_syscall.c 7e8293e4e6971b0f44c7f7f37b1315a8cc9f6018
|
||||
F src/test_tclvar.c f4dc67d5f780707210d6bb0eb6016a431c04c7fa
|
||||
F src/test_thread.c e286f2173563f2a1747c24bcda6b9d030bf4f4e4
|
||||
F src/test_vfs.c fb16b2d9938cf0c1afc5a423b55b952fcc024275
|
||||
F src/test_vfs.c 8e6087a8b3dcc260282074b0efba14b76311120c
|
||||
F src/test_vfstrace.c 34b544e80ba7fb77be15395a609c669df2e660a2
|
||||
F src/test_wholenumber.c 3d2b9ed1505c40ad5c5ca2ad16ae7a289d6cc251
|
||||
F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
|
||||
@@ -237,22 +243,22 @@ F src/tokenize.c 1e86210d3976717a19238ea7b047fac481fe8c12
|
||||
F src/trigger.c cd95ac64efa60e39faf9b5597443192ff27a22fa
|
||||
F src/update.c a2a5631d618cbe240fc83725fa9e95c56ae0084c
|
||||
F src/utf.c 8d819e2e5104a430fc2005f018db14347c95a38f
|
||||
F src/util.c 550f2b6a5c0085153a4d00462719fb17ee242792
|
||||
F src/util.c f566b5138099a2df8533b190d0dcc74b7dfbe0c9
|
||||
F src/vacuum.c 2727bdd08847fcb6b2d2da6d14f018910e8645d3
|
||||
F src/vdbe.c 1d56617d816098a41bdbe73536a67dcdefad52bd
|
||||
F src/vdbe.c 5f0047130f80c7fd0bc41bc51a653b5542c4fbd5
|
||||
F src/vdbe.h b52887278cb173e66188da84dfab216bea61119d
|
||||
F src/vdbeInt.h 3bb8531d6768379f086e1576b31d52331f6eb982
|
||||
F src/vdbeapi.c 56f9ad6329d093f54b5dd321a2b4a643f89a6cb6
|
||||
F src/vdbeInt.h c1e830268b75f04a2901dd895b51a637a26c7045
|
||||
F src/vdbeapi.c 085cf9bf169b859a6c8fa43791702bac805cb7aa
|
||||
F src/vdbeaux.c ecb43014bcd3019e5aa2b5561e5c3a447f007a08
|
||||
F src/vdbeblob.c 32f2a4899d67f69634ea4dd93e3f651936d732cb
|
||||
F src/vdbeblob.c 5dc79627775bd9a9b494dd956e26297946417d69
|
||||
F src/vdbemem.c 833005f1cbbf447289f1973dba2a0c2228c7b8ab
|
||||
F src/vdbesort.c 4fad64071ae120c25f39dcac572d716b9cadeb7f
|
||||
F src/vdbetrace.c 8bd5da325fc90f28464335e4cc4ad1407fe30835
|
||||
F src/vdbetrace.c a22263ab47f6ba4fcd176515cec1e732866b25f0
|
||||
F src/vtab.c b05e5f1f4902461ba9f5fc49bb7eb7c3a0741a83
|
||||
F src/wal.c 04029f2691e937d7f5dd638580679a560fec93bf
|
||||
F src/wal.c 436bfceb141b9423c45119e68e444358ee0ed35d
|
||||
F src/wal.h a4d3da523d55a226a0b28e9058ef88d0a8051887
|
||||
F src/walker.c 3d75ba73de15e0f8cd0737643badbeb0e002f07b
|
||||
F src/where.c 9a16c0b84bbeb054d11fda96e9e037ae310bd54e
|
||||
F src/where.c 4ad2329c439a30ddb915a780f6f80bdffafe3a64
|
||||
F test/8_3_names.test 631ea964a3edb091cf73c3b540f6bcfdb36ce823
|
||||
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
||||
F test/aggnested.test 45c0201e28045ad38a530b5a144b73cd4aa2cfd6
|
||||
@@ -286,13 +292,13 @@ F test/auth2.test a2a371aa6df15f8b0c8109b33d3d7f0f73e4c9aa
|
||||
F test/auth3.test a4755e6a2a2fea547ffe63c874eb569e60a28eb5
|
||||
F test/autoinc.test bd30d372d00045252f6c2e41b5f41455e1975acf
|
||||
F test/autoindex1.test f88146c4c889ea0afbb620e49d83b5fbf5ee4d06
|
||||
F test/autovacuum.test ad9f74649caf108dbb9208aa0bcbdd22eed51ad0
|
||||
F test/autovacuum.test 9f22a7733f39c56ef6a5665d10145ac25d8cb574
|
||||
F test/autovacuum_ioerr2.test 8a367b224183ad801e0e24dcb7d1501f45f244b4
|
||||
F test/avtrans.test 0252654f4295ddda3b2cce0e894812259e655a85
|
||||
F test/backcompat.test ecd841f3a3bfb81518721879cc56a760670e3198
|
||||
F test/backup.test 66a716403ec014d763910d1de20c8dab5f17527e
|
||||
F test/backup.test c9cdd23a495864b9edf75a9fa66f5cb7e10fcf62
|
||||
F test/backup2.test 34986ef926ea522911a51dfdb2f8e99b7b75ebcf
|
||||
F test/backup4.test 20a100140fea819d383920de02efe64b981d2414
|
||||
F test/backup4.test 4d90389daeb781fe718816a4fc836ad1b06791d8
|
||||
F test/backup_ioerr.test 4c3c7147cee85b024ecf6e150e090c32fdbb5135
|
||||
F test/backup_malloc.test 7162d604ec2b4683c4b3799a48657fb8b5e2d450
|
||||
F test/badutf.test d5360fc31f643d37a973ab0d8b4fb85799c3169f
|
||||
@@ -314,6 +320,7 @@ F test/boundary3.tcl 8901d6a503d0bf64251dd81cc74e5ad3add4b119
|
||||
F test/boundary3.test 56ef82096b4329aca2be74fa1e2b0f762ea0eb45
|
||||
F test/boundary4.tcl 0bb4b1a94f4fc5ae59b79b9a2b7a140c405e2983
|
||||
F test/boundary4.test 89e02fa66397b8a325d5eb102b5806f961f8ec4b
|
||||
F test/btreefault.test 06899a377f31a8c1a3048ec69831522d4e5c6045
|
||||
F test/busy.test 76b4887f8b9160ba903c1ac22e8ff406ad6ae2f0
|
||||
F test/cache.test 13bc046b26210471ca6f2889aceb1ea52dc717de
|
||||
F test/capi2.test e8b18cc61090b6e5e388f54d6b125d711d1b265a
|
||||
@@ -339,23 +346,23 @@ F test/colmeta.test 087c42997754b8c648819832241daf724f813322
|
||||
F test/colname.test 08948a4809d22817e0e5de89c7c0a8bd90cb551b
|
||||
F test/conflict.test 0b3922d2304a14a47e3ccd61bbd6824327af659b
|
||||
F test/corrupt.test 4aabd06cff3fe759e3e658bcc17b71789710665e
|
||||
F test/corrupt2.test 7db8c262e76115745c7c1607374c4de34f92f4d3
|
||||
F test/corrupt3.test 77c3da3229f32843fdc5d89599b49e49ce901850
|
||||
F test/corrupt2.test 9c0ab4becd50e9050bc1ebb8675456a4e5587bf0
|
||||
F test/corrupt3.test 889d7cdb811800303aa722d7813fe8a4299cf726
|
||||
F test/corrupt4.test b963f9e01e0f92d15c76fb0747876fd4b96dc30a
|
||||
F test/corrupt5.test c23da7bfb20917cc7fdbb13ee25c7cc4e9fffeff
|
||||
F test/corrupt6.test 4d509a36a237f4826a79ddb22ac966b7d0d05cc7
|
||||
F test/corrupt7.test ff767cdf4ceb019d113c654ab21e41a4bd51f1de
|
||||
F test/corrupt6.test 4e4161aef1f30b9f34582bb4142334b7f47eacae
|
||||
F test/corrupt7.test a90caf89c7d7cb7893ea4d92529bd0c129317ee4
|
||||
F test/corrupt8.test 48eb37ffb9a03bceada62219e2bd4c92f4b0cb75
|
||||
F test/corrupt9.test 959179e68dc0b7b99f424cf3e0381c86dcdd0112
|
||||
F test/corruptA.test fafa652aa585753be4f6b62ff0bb250266eaf7ce
|
||||
F test/corruptB.test 20d4a20cbed23958888c3e8995b424a47223d647
|
||||
F test/corruptC.test b2d0e0163827591207cb6dd0123dca250d016dda
|
||||
F test/corruptC.test 62a767fe64acb1975f58cc6171192839c783edbb
|
||||
F test/corruptD.test 3b09903a2e2fe07ecafe775fea94177f8a4bb34f
|
||||
F test/corruptE.test d3a3d7e864a95978195741744dda4abfd8286018
|
||||
F test/corruptF.test e8c366f5784105e57284d99c88b2e8dcfd87a01f
|
||||
F test/corruptF.test 984b1706c9c0e4248141b056c21124612628d12e
|
||||
F test/count.test 454e1ce985c94d13efeac405ce54439f49336163
|
||||
F test/coveridxscan.test cdb47d01acc4a634a34fd25abe85189e0d0f1e62
|
||||
F test/crash.test a47f6d26ae443e577596b25357e38b34b982a3c5
|
||||
F test/crash.test fb9dc4a02dcba30d4aa5c2c226f98b220b2b959f
|
||||
F test/crash2.test 5b14d4eb58b880e231361d3b609b216acda86651
|
||||
F test/crash3.test 8f5de9d32ab9ab95475a9efe7f47a940aa889418
|
||||
F test/crash4.test fe2821baf37168dc59dd733dcf7dba2a401487bc
|
||||
@@ -364,12 +371,12 @@ F test/crash6.test 4c56f1e40d0291e1110790a99807aa875b1647ba
|
||||
F test/crash7.test 1a194c4900a255258cf94b7fcbfd29536db572df
|
||||
F test/crash8.test 38767cb504bbe491de6be4a7006b154973a2309f
|
||||
F test/crashtest1.c 09c1c7d728ccf4feb9e481671e29dda5669bbcc2
|
||||
F test/createtab.test 45e9710fac5140be87f64f0c3eff960f37bfe212
|
||||
F test/createtab.test b5de160630b209c4b8925bdcbbaf48cc90b67fe8
|
||||
F test/cse.test 277350a26264495e86b1785f34d2d0c8600e021c
|
||||
F test/ctime.test 7bd009071e242aac4f18521581536b652b789a47
|
||||
F test/date.test f3228180c87bbe5d39c9397bf001c0095c3821b9
|
||||
F test/dbstatus.test 207e5b63fcb7b9c3bb8e1fdf38ebd4654ad0e54b
|
||||
F test/dbstatus2.test f46fdca3ffa01eb7d662f6dafb45d8bd2709dc0d
|
||||
F test/dbstatus2.test f329941d5f4a8bc0ba6ec5735897ef0cf34e2f5f
|
||||
F test/default.test 6faf23ccb300114924353007795aa9a8ec0aa9dc
|
||||
F test/delete.test a065b05d2ebf60fd16639c579a4adfb7c381c701
|
||||
F test/delete2.test 3a03f2cca1f9a67ec469915cb8babd6485db43fa
|
||||
@@ -394,7 +401,7 @@ F test/e_select.test d5af998a402740d8f0488158d22075df2b6f88fa
|
||||
F test/e_select2.test 5c3d3da19c7b3e90ae444579db2b70098599ab92
|
||||
F test/e_update.test 161d5dc6a3ed9dd08f5264d13e20735d7a89f00c
|
||||
F test/e_uri.test 8f2f56b29456a3f846276fa4e0993d4ef8a15b79
|
||||
F test/e_vacuum.test 617227d2cad5bf829197a00968d9788ffc1bcbd2
|
||||
F test/e_vacuum.test 331da289ae186656cf5f2eb27f577a89c0c221af
|
||||
F test/enc.test e54531cd6bf941ee6760be041dff19a104c7acea
|
||||
F test/enc2.test 83437a79ba1545a55fb549309175c683fb334473
|
||||
F test/enc3.test 90683ad0e6ea587b9d5542ca93568af9a9858c40
|
||||
@@ -409,14 +416,14 @@ F test/exists.test 8f7b27b61c2fbe5822f0a1f899c715d14e416e30
|
||||
F test/expr.test 67c9fd6f8f829e239dc8b0f4a08a73c08b09196d
|
||||
F test/fallocate.test b5d34437bd7ab01d41b1464b8117aefd4d32160e
|
||||
F test/filectrl.test 14fa712e42c4cb791e09dfd58a6a03efb47ef13a
|
||||
F test/filefmt.test dcd6eae426b64cc398d95c786ad7e8763b8c2982
|
||||
F test/filefmt.test dbee33e57818249cdffbbb7b13464635217beff1
|
||||
F test/fkey1.test 01c7de578e11747e720c2d9aeef27f239853c4da
|
||||
F test/fkey2.test 06e0b4cc9e1b3271ae2ae6feeb19755468432111
|
||||
F test/fkey3.test 5ec899d12b13bcf1e9ef40eff7fb692fdb91392e
|
||||
F test/fkey4.test 86446017011273aad8f9a99c1a65019e7bd9ca9d
|
||||
F test/fkey5.test 0bf64f2d19ad80433ca0b24edbf604a18b353d5f
|
||||
F test/fkey_malloc.test bb74c9cb8f8fceed03b58f8a7ef2df98520bbd51
|
||||
F test/format4.test c7600a7c96388b8e19af5c7fe18399953cb748c3
|
||||
F test/format4.test 1f0cac8ff3895e9359ed87e41aaabee982a812eb
|
||||
F test/fts-9fd058691.test 78b887e30ae6816df0e1fed6259de4b5a64ad33c
|
||||
F test/fts1a.test 46090311f85da51bb33bd5ce84f7948359c6d8d7
|
||||
F test/fts1b.test 5d8a01aefbecc8b7442b36c94c05eb7a845462d5
|
||||
@@ -526,13 +533,13 @@ F test/in2.test 5d4c61d17493c832f7d2d32bef785119e87bde75
|
||||
F test/in3.test 3cbf58c87f4052cee3a58b37b6389777505aa0c0
|
||||
F test/in4.test 64f3cc1acde1b9161ccdd8e5bde3daefdb5b2617
|
||||
F test/in5.test 99f9a40af01711b06d2d614ecfe96129f334fba3
|
||||
F test/incrblob.test 983a3c15f674892e502627662289f9d969209600
|
||||
F test/incrblob.test 2100cb8964e4a106e5ca9bf80e2c5c3e8be33f77
|
||||
F test/incrblob2.test edc3a96e557bd61fb39acc8d2edd43371fbbaa19
|
||||
F test/incrblob3.test aedbb35ea1b6450c33b98f2b6ed98e5020be8dc7
|
||||
F test/incrblob4.test 09be37d3dd996a31ea6993bba7837ece549414a8
|
||||
F test/incrblob_err.test d2562d2771ebffd4b3af89ef64c140dd44371597
|
||||
F test/incrblobfault.test 917c0292224c64a56ef7215fd633a3a82f805be0
|
||||
F test/incrvacuum.test cfd733917fdcc06b8d4218145112167e89cc60ad
|
||||
F test/incrvacuum.test d2a6ddf5e429720b5fe502766af747915ccf6c32
|
||||
F test/incrvacuum2.test 379eeb8740b0ef60c372c439ad4cbea20b34bb9b
|
||||
F test/incrvacuum3.test 2ffa9e4a23f072bd7902b9ae6471f8822a6522a7
|
||||
F test/incrvacuum_ioerr.test 6ae2f783424e47a0033304808fe27789cf93e635
|
||||
@@ -553,7 +560,7 @@ F test/instr.test a34e1d46a9eefb098a7167ef0e730a4a3d82fba0
|
||||
F test/intarray.test 066b7d7ac38d25bf96f87f1b017bfc687551cdd4
|
||||
F test/interrupt.test dfe9a67a94b0b2d8f70545ba1a6cca10780d71cc
|
||||
F test/intpkey.test 7af30f6ae852d8d1c2b70e4bf1551946742e92d8
|
||||
F test/io.test 1d3862c25017cf01ef6d0db682bc7ca87ab43387
|
||||
F test/io.test a4be25a446a99a0604ceecc039ee7363c56e4185
|
||||
F test/ioerr.test 40bb2cfcab63fb6aa7424cd97812a84bc16b5fb8
|
||||
F test/ioerr2.test 9d71166f8466eda510f1af6137bdabaa82b5408d
|
||||
F test/ioerr3.test d3cec5e1a11ad6d27527d0d38573fbff14c71bdd
|
||||
@@ -569,7 +576,7 @@ F test/join6.test cfe6503791ceb0cbb509966740286ec423cbf10b
|
||||
F test/journal1.test 69abc726c51b4a0409189f9a85191205297c0577
|
||||
F test/journal2.test ae06f566c28552c313ded3fee79a6c69e6d049b1
|
||||
F test/journal3.test ff8af941f9e06161d3db1b46bb9f965ff0e7f307
|
||||
F test/jrnlmode.test 06a8d5771bb6ed9b8754e171519e7fc9f025db55
|
||||
F test/jrnlmode.test 9ee3a78f53d52cca737db69293d15dc41c0cbd36
|
||||
F test/jrnlmode2.test 81610545a4e6ed239ea8fa661891893385e23a1d
|
||||
F test/jrnlmode3.test 556b447a05be0e0963f4311e95ab1632b11c9eaa
|
||||
F test/keyword1.test a2400977a2e4fde43bf33754c2929fda34dbca05
|
||||
@@ -583,7 +590,7 @@ F test/loadext2.test 0bcaeb4d81cd5b6e883fdfea3c1bdbe1f173cbca
|
||||
F test/lock.test 87af515b0c4cf928576d0f89946d67d7c265dfb4
|
||||
F test/lock2.test 5242d8ac4e2d59c403aebff606af449b455aceff
|
||||
F test/lock3.test f271375930711ae044080f4fe6d6eda930870d00
|
||||
F test/lock4.test 8c191b10540128fb28cfd4194aeb9e61e1db007f
|
||||
F test/lock4.test e175ae13865bc87680607563bafba21f31a26f12
|
||||
F test/lock5.test 5ad6a1f536036ff1be915cfdd41481aeafda3273
|
||||
F test/lock6.test ad5b387a3a8096afd3c68a55b9535056431b0cf5
|
||||
F test/lock7.test 64006c84c1c616657e237c7ad6532b765611cf64
|
||||
@@ -607,7 +614,7 @@ F test/mallocD.test f78c295e8e18ea3029e65ca08278690e00c22100
|
||||
F test/mallocE.test db1ed69d7eded1b080952e2a7c37f364ad241b08
|
||||
F test/mallocF.test 2d5c590ebc2fc7f0dcebdf5aa8498b9aed69107e
|
||||
F test/mallocG.test 0ff91b65c50bdaba680fb75d87fe4ad35bb7934f
|
||||
F test/mallocH.test c43a1899a56833ad42cf7a159f7d2eeb364833e6
|
||||
F test/mallocH.test 79b65aed612c9b3ed2dcdaa727c85895fd1bfbdb
|
||||
F test/mallocI.test a88c2b9627c8506bf4703d8397420043a786cdb6
|
||||
F test/mallocJ.test b5d1839da331d96223e5f458856f8ffe1366f62e
|
||||
F test/mallocK.test d79968641d1b70d88f6c01bdb9a7eb4a55582cc9
|
||||
@@ -630,7 +637,8 @@ F test/misc5.test 528468b26d03303b1f047146e5eefc941b9069f5
|
||||
F test/misc6.test 953cc693924d88e6117aeba16f46f0bf5abede91
|
||||
F test/misc7.test dd82ec9250b89178b96cd28b2aca70639d21e5b3
|
||||
F test/misuse.test ba4fb5d1a6101d1c171ea38b3c613d0661c83054
|
||||
F test/mmap1.test 9fb71daaca72f66fcc7a3b3a37fc3db99988b57a
|
||||
F test/mmap1.test f064a9025136cd688c982ccdae81c7b4fac95724
|
||||
F test/mmap2.test a5ba639f90b5fc487400a49e158e14e465943e98
|
||||
F test/multiplex.test e08cc7177bd6d85990ee1d71100bb6c684c02256
|
||||
F test/multiplex2.test 580ca5817c7edbe4cc68fa150609c9473393003a
|
||||
F test/multiplex3.test d228f59eac91839a977eac19f21d053f03e4d101
|
||||
@@ -647,26 +655,27 @@ F test/openv2.test 0d3040974bf402e19b7df4b783e447289d7ab394
|
||||
F test/orderby1.test f33968647da5c546528fe4d2bf86c6a6a2e5a7ae
|
||||
F test/orderby2.test bc11009f7cd99d96b1b11e57b199b00633eb5b04
|
||||
F test/orderby3.test 8619d06a3debdcd80a27c0fdea5c40b468854b99
|
||||
F test/orderby4.test 4d39bfbaaa3ae64d026ca2ff166353d2edca4ba4
|
||||
F test/oserror.test 50417780d0e0d7cd23cf12a8277bb44024765df3
|
||||
F test/pager1.test aa819efb5c58cef7afd0504849f3ab27eaa926a3
|
||||
F test/pager2.test 745b911dde3d1f24ae0870bd433dfa83d7c658c1
|
||||
F test/pager1.test 134144862f6a98f862dc2edda1b10ff499141bfa
|
||||
F test/pager2.test 67b8f40ae98112bcdba1f2b2d03ea83266418c71
|
||||
F test/pager3.test 3856d9c80839be0668efee1b74811b1b7f7fc95f
|
||||
F test/pagerfault.test 0c12520f6c8883ec401b8b7b5406ca24657566a1
|
||||
F test/pagerfault.test bba948be0564254b823ec6ca1fd95fbbfb0839a3
|
||||
F test/pagerfault2.test 1f79ea40d1133b2683a2f811b00f2399f7ec2401
|
||||
F test/pagerfault3.test f16e2efcb5fc9996d1356f7cbc44c998318ae1d7
|
||||
F test/pageropt.test 32cb5a6ed7ccddf8e8c842cb44240bd9340223ce
|
||||
F test/pagesize.test a8890ca1b19a5a25b1f0d8f6982bbdeb2ae045b5
|
||||
F test/pageropt.test d6b695e6c12290c406150fc51eec32878d48df4c
|
||||
F test/pagesize.test 1dd51367e752e742f58e861e65ed7390603827a0
|
||||
F test/pcache.test 065aa286e722ab24f2e51792c1f093bf60656b16
|
||||
F test/pcache2.test a83efe2dec0d392f814bfc998def1d1833942025
|
||||
F test/permutations.test 22f3b488d057a8410687dabe13456587c358d770
|
||||
F test/pragma.test ffcad56b3058c8661a4cf54205ce44894f7263e2
|
||||
F test/pragma2.test dcb2dafab8b16268017879c84b5bf99034d40284
|
||||
F test/permutations.test b6cb45ce4d3193b831231025c9d30c77317dd240
|
||||
F test/pragma.test 60d29cd3d8098a2c20bf4c072810f99e3bf2757a
|
||||
F test/pragma2.test 3a55f82b954242c642f8342b17dffc8b47472947
|
||||
F test/printf.test ec9870c4dce8686a37818e0bf1aba6e6a1863552
|
||||
F test/progress.test 5b075c3c790c7b2a61419bc199db87aaf48b8301
|
||||
F test/ptrchng.test ef1aa72d6cf35a2bbd0869a649b744e9d84977fc
|
||||
F test/quick.test 1681febc928d686362d50057c642f77a02c62e57
|
||||
F test/quota-glob.test 32901e9eed6705d68ca3faee2a06b73b57cb3c26
|
||||
F test/quota.test cff65b46e98c65f10e853f2610748470ba3f50ff
|
||||
F test/quota.test b5b3eec55a059e0fe493c66c6e27bd2c07676cfd
|
||||
F test/quota2.test 6d2bd57e8a4da28817f46db9da18551211cd325f
|
||||
F test/quote.test 215897dbe8de1a6f701265836d6601cc6ed103e6
|
||||
F test/randexpr1.tcl 40dec52119ed3a2b8b2a773bce24b63a3a746459
|
||||
@@ -731,14 +740,14 @@ F test/softheap1.test c16709a16ad79fa43b32929b2e623d1d117ccf53
|
||||
F test/sort.test 0e4456e729e5a92a625907c63dcdedfbe72c5dc5
|
||||
F test/speed1.test f2974a91d79f58507ada01864c0e323093065452
|
||||
F test/speed1p.explain d841e650a04728b39e6740296b852dccdca9b2cb
|
||||
F test/speed1p.test c4a469f29f135f4d76c55b1f2a52f36e209466cc
|
||||
F test/speed1p.test b180e98609c7677382cf618c0ec9b69f789033a8
|
||||
F test/speed2.test 53177056baf6556dcbdcf032bbdfc41c1aa74ded
|
||||
F test/speed3.test d32043614c08c53eafdc80f33191d5bd9b920523
|
||||
F test/speed4.test abc0ad3399dcf9703abed2fff8705e4f8e416715
|
||||
F test/speed4p.explain 6b5f104ebeb34a038b2f714150f51d01143e59aa
|
||||
F test/speed4p.test 0e51908951677de5a969b723e03a27a1c45db38b
|
||||
F test/spellfix.test 52ae2680b1247c52b9e2b2116de3fd26a78e6bd2
|
||||
F test/sqllimits1.test 861cbb85ecd4fc3b2bdf26e84fbd1ebd13aa28aa
|
||||
F test/sqllimits1.test b1aae27cc98eceb845e7f7adf918561256e31298
|
||||
F test/stat.test be8d477306006ec696bc86757cfb34bec79447ce
|
||||
F test/stmt.test 25d64e3dbf9a3ce89558667d7f39d966fe2a71b9
|
||||
F test/subquery.test 869562de9e8c5d8147e0451a2ce5b58cf55ce389
|
||||
@@ -755,7 +764,7 @@ F test/tclsqlite.test 37a61c2da7e3bfe3b8c1a2867199f6b860df5d43
|
||||
F test/tempdb.test 19d0f66e2e3eeffd68661a11c83ba5e6ace9128c
|
||||
F test/temptable.test d2c9b87a54147161bcd1822e30c1d1cd891e5b30
|
||||
F test/temptrigger.test 26670ed7a39cf2296a7f0a9e0a1d7bdb7abe936d
|
||||
F test/tester.tcl b40aa7ab9616ad148bf2c97758700c2edc7dfa2b
|
||||
F test/tester.tcl 0d95028653ad6782e17400b7a32a046b87c67a48
|
||||
F test/thread001.test 9f22fd3525a307ff42a326b6bc7b0465be1745a5
|
||||
F test/thread002.test e630504f8a06c00bf8bbe68528774dd96aeb2e58
|
||||
F test/thread003.test ee4c9efc3b86a6a2767516a37bd64251272560a7
|
||||
@@ -785,6 +794,7 @@ F test/tkt-54844eea3f.test a12b851128f46a695e4e378cca67409b9b8f5894
|
||||
F test/tkt-5d863f876e.test c9f36ca503fa154a3655f92a69d2c30da1747bfa
|
||||
F test/tkt-5e10420e8d.test 904d1687b3c06d43e5b3555bbcf6802e7c0ffd84
|
||||
F test/tkt-5ee23731f.test 9db6e1d7209dc0794948b260d6f82b2b1de83a9f
|
||||
F test/tkt-6bfb98dfc0.test 24780633627b5cfc0635a5500c2389ebfb563336
|
||||
F test/tkt-752e1646fc.test ea78d88d14fe9866bdd991c634483334639e13bf
|
||||
F test/tkt-78e04e52ea.test 703e0bfb23d543edf0426a97e3bbd0ca346508ec
|
||||
F test/tkt-7a31705a7e6.test 5a7889fdb095ffbe1622413e0145de1637d421bd
|
||||
@@ -819,7 +829,7 @@ F test/tkt1444.test a9d72f9e942708bd82dde6c707da61c489e213e9
|
||||
F test/tkt1449.test 93584a449752d52b07d2cfc280a69842b6e16ed5
|
||||
F test/tkt1473.test 9d000af3e11a4450d4c596f5e58b4b0d24eb0f8b
|
||||
F test/tkt1501.test 2064f98e00871848af4b2f517e46c1a7fb2e32db
|
||||
F test/tkt1512.test f791cd2a32b739e866e74613b20e9d096a7f3312
|
||||
F test/tkt1512.test a1df1f66caf0b9122d6220c15dcee230298c2c2f
|
||||
F test/tkt1514.test ddef38e34fea72eb1ab935ded9f17a3fb71dd9df
|
||||
F test/tkt1536.test 83ff7a7b6e248016f8d682d4f7a4ae114070d466
|
||||
F test/tkt1537.test e3a14332de9770be8ff14bd15c19a49cbec10808
|
||||
@@ -847,7 +857,7 @@ F test/tkt2820.test 39940276b3436d125deb7d8ebeee053e4cf13213
|
||||
F test/tkt2822.test f391776423a7c0d0949edfce375708bfb0f3141e
|
||||
F test/tkt2832.test a9b0b74a02dca166a04d9e37739c414b10929caa
|
||||
F test/tkt2854.test e432965db29e27e16f539b2ba7f502eb2ccc49af
|
||||
F test/tkt2920.test ff4e3d02cca0786188bf717068815ebbbfa0e056
|
||||
F test/tkt2920.test a8737380e4ae6424e00c0273dc12775704efbebf
|
||||
F test/tkt2927.test 4752868b9eeeb07a217f7f19f4cbaac98d6d086d
|
||||
F test/tkt2942.test c5c87d179799ca6d1fbe83c815510b87cd5ec7ce
|
||||
F test/tkt3080.test 1bca7579260920a66b4dd7e196e807c0f25ff804
|
||||
@@ -928,7 +938,7 @@ F test/uri.test 63e03df051620a18f794b4f4adcdefb3c23b6751
|
||||
F test/utf16align.test 54cd35a27c005a9b6e7815d887718780b6a462ae
|
||||
F test/vacuum.test ce91c39f7f91a4273bf620efad21086b5aa6ef1d
|
||||
F test/vacuum2.test af432e6e3bfc0ea20a80cb86a03c7d9876d38324
|
||||
F test/vacuum3.test 099997a910ffa862731bb74a2ae1d90fbb5f374d
|
||||
F test/vacuum3.test 77ecdd54592b45a0bcb133339f99f1ae0ae94d0d
|
||||
F test/vacuum4.test d3f8ecff345f166911568f397d2432c16d2867d9
|
||||
F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102
|
||||
F test/veryquick.test 7701bb609fe8bf6535514e8b849a309e8f00573b
|
||||
@@ -951,25 +961,25 @@ F test/vtabF.test fd5ad376f5a34fe0891df1f3cddb4fe7c3eb077e
|
||||
F test/vtab_alter.test 9e374885248f69e251bdaacf480b04a197f125e5
|
||||
F test/vtab_err.test 0d4d8eb4def1d053ac7c5050df3024fd47a3fbd8
|
||||
F test/vtab_shared.test 82f463886e18d7f8395a4b6167c91815efe54839
|
||||
F test/wal.test 0fe084a9fce3ec8e5196b3bfe3a5c2be337e7cac
|
||||
F test/wal.test 20fb8d0f8e65e50eb675994cc3a4f0e692fd4faf
|
||||
F test/wal2.test d4b470f13c87f6d8268b004380afa04c3c67cb90
|
||||
F test/wal3.test b22eb662bcbc148c5f6d956eaf94b047f7afe9c0
|
||||
F test/wal4.test 4744e155cd6299c6bd99d3eab1c82f77db9cdb3c
|
||||
F test/wal5.test 62fcd89a2007ca0cf91a874a2aa78546b0ce588e
|
||||
F test/wal5.test 13c980d4d8d2d6b558361f19bed4ab31d41a2c7c
|
||||
F test/wal6.test 2e3bc767d9c2ce35c47106148d43fcbd072a93b3
|
||||
F test/wal7.test 2ae8f427d240099cc4b2dfef63cff44e2a68a1bd
|
||||
F test/wal8.test b3ee739fe8f7586aaebdc2367f477ebcf3e3b034
|
||||
F test/wal9.test 400b87e93ab39cbc606f5cbf96f575f08c4ed92b
|
||||
F test/wal9.test 378e76a9ad09cd9bee06c172ad3547b0129a6750
|
||||
F test/wal_common.tcl a98f17fba96206122eff624db0ab13ec377be4fe
|
||||
F test/walbak.test a0f59461081e396f521159671ad3ebd6b6a10ade
|
||||
F test/walbak.test b9f68e39646375c2b877be906babcc15d38b4877
|
||||
F test/walbig.test f437473a16cfb314867c6b5d1dbcd519e73e3434
|
||||
F test/walcksum.test 40563d1d9dd3a946833ea122db4db5a6f37e0e1d
|
||||
F test/walcksum.test f5447800a157c9e2234fbb8e80243f0813941bde
|
||||
F test/walcrash.test 4457436593be8c136f9148487c7dccd5e9013af2
|
||||
F test/walcrash2.test 019d60b89d96c1937adb2b30b850ac7e86e5a142
|
||||
F test/walcrash3.test 595e44c6197f0d0aa509fc135be2fd0209d11a2c
|
||||
F test/walfault.test 97394d8de82a99f7abf1c12ed229640607fd0ad2
|
||||
F test/walhook.test ac9f04264f9e1807dec17dd74901bc9d331f9aff
|
||||
F test/walmode.test 781becf1162c9fd161a8a49417e2a911a94dbb41
|
||||
F test/walfault.test 54ad6e849c727f4da463964b9eb8c8e8e155cf82
|
||||
F test/walhook.test ed00a40ba7255da22d6b66433ab61fab16a63483
|
||||
F test/walmode.test 4022fe03ae6e830583672caa101f046438a0473c
|
||||
F test/walnoshm.test 84ca10c544632a756467336b7c3b864d493ee496
|
||||
F test/walpersist.test 8c6b7e3ec1ba91b5e4dc4e0921d6d3f87cd356a6
|
||||
F test/walro.test a31deb621033442a76c3a61e44929250d06f81b1
|
||||
@@ -993,7 +1003,7 @@ F test/whereD.test 3f3ee93825c94804f1fc91eef2de0d365981759a
|
||||
F test/whereE.test 7bd34945797efef15819368479bacc34215e4e1d
|
||||
F test/whereF.test a0e296643cabe5278379bc1a0aa158cf3c54a1c9
|
||||
F test/wherelimit.test 5e9fd41e79bb2b2d588ed999d641d9c965619b31
|
||||
F test/win32lock.test b2a539e85ae6b2d78475e016a9636b4451dc7fb9
|
||||
F test/win32lock.test 21810396eee150680cc398970839e6abdcb807b9
|
||||
F test/zeroblob.test caaecfb4f908f7bc086ed238668049f96774d688
|
||||
F test/zerodamage.test e7f77fded01dfcdf92ac2c5400f1e35d7a21463c
|
||||
F tool/build-all-msvc.bat 74fb6e5cca66ebdb6c9bbafb2f8b802f08146d38 x
|
||||
@@ -1040,7 +1050,10 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
|
||||
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
|
||||
P 23ffa4f9fbad2e39cbe4776c7fdb61f757b6fc78
|
||||
R 6cd4d6bb1af95ad5b626cb22e4b9f0a4
|
||||
U dan
|
||||
Z 2b8cf21f2c6587ad7587cd5c8a9f710d
|
||||
P f1b524b9d9ea3db96d54ac55c39f15e6879085bd
|
||||
R 81fda886c4b87168bc8522f21db6569f
|
||||
T *branch * winDisableMmap
|
||||
T *sym-winDisableMmap *
|
||||
T -sym-trunk *
|
||||
U mistachkin
|
||||
Z d00cd2eed7d26c94b83b76365b3988fe
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
80c63443c438ec21cc02880801d4fb4ca5f4e23f
|
||||
daa168f3dad995c4b7dd60e7717db90639e167c2
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
** Configure five tasks in different ways, then run tests.
|
||||
*/
|
||||
--if vfsname() GLOB 'unix'
|
||||
PRAGMA page_size=8192;
|
||||
--task 1
|
||||
PRAGMA journal_mode=PERSIST;
|
||||
PRAGMA mmap_limit=0;
|
||||
--end
|
||||
--task 2
|
||||
PRAGMA journal_mode=TRUNCATE;
|
||||
PRAGMA mmap_limit=28672;
|
||||
--end
|
||||
--task 3
|
||||
PRAGMA journal_mode=MEMORY;
|
||||
--end
|
||||
--task 4
|
||||
PRAGMA journal_mode=OFF;
|
||||
--end
|
||||
--source multiwrite01.test
|
||||
--wait all
|
||||
PRAGMA page_size=16384;
|
||||
VACUUM;
|
||||
CREATE TABLE pgsz(taskid, sz INTEGER);
|
||||
--task 1
|
||||
INSERT INTO pgsz VALUES(1, eval('PRAGMA page_size'));
|
||||
--end
|
||||
--task 2
|
||||
INSERT INTO pgsz VALUES(2, eval('PRAGMA page_size'));
|
||||
--end
|
||||
--task 3
|
||||
INSERT INTO pgsz VALUES(3, eval('PRAGMA page_size'));
|
||||
--end
|
||||
--task 4
|
||||
INSERT INTO pgsz VALUES(4, eval('PRAGMA page_size'));
|
||||
--end
|
||||
--task 5
|
||||
INSERT INTO pgsz VALUES(5, eval('PRAGMA page_size'));
|
||||
--end
|
||||
--source multiwrite01.test
|
||||
--wait all
|
||||
SELECT sz FROM pgsz;
|
||||
--match 16384 16384 16384 16384 16384
|
||||
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
** Configure five tasks in different ways, then run tests.
|
||||
*/
|
||||
PRAGMA page_size=512;
|
||||
--task 1
|
||||
PRAGMA mmap_limit=0;
|
||||
--end
|
||||
--task 2
|
||||
PRAGMA mmap_limit=28672;
|
||||
--end
|
||||
--task 3
|
||||
PRAGMA mmap_limit=8192;
|
||||
--end
|
||||
--task 4
|
||||
PRAGMA mmap_limit=65536;
|
||||
--end
|
||||
--source multiwrite01.test
|
||||
--source crash02.subtest
|
||||
PRAGMA page_size=1024;
|
||||
VACUUM;
|
||||
CREATE TABLE pgsz(taskid, sz INTEGER);
|
||||
--task 1
|
||||
INSERT INTO pgsz VALUES(1, eval('PRAGMA page_size'));
|
||||
--end
|
||||
--task 2
|
||||
INSERT INTO pgsz VALUES(2, eval('PRAGMA page_size'));
|
||||
--end
|
||||
--task 3
|
||||
INSERT INTO pgsz VALUES(3, eval('PRAGMA page_size'));
|
||||
--end
|
||||
--task 4
|
||||
INSERT INTO pgsz VALUES(4, eval('PRAGMA page_size'));
|
||||
--end
|
||||
--task 5
|
||||
INSERT INTO pgsz VALUES(5, eval('PRAGMA page_size'));
|
||||
--end
|
||||
--source multiwrite01.test
|
||||
--source crash02.subtest
|
||||
--wait all
|
||||
SELECT sz FROM pgsz;
|
||||
--match 1024 1024 1024 1024 1024
|
||||
PRAGMA page_size=2048;
|
||||
VACUUM;
|
||||
DELETE FROM pgsz;
|
||||
--task 1
|
||||
INSERT INTO pgsz VALUES(1, eval('PRAGMA page_size'));
|
||||
--end
|
||||
--task 2
|
||||
INSERT INTO pgsz VALUES(2, eval('PRAGMA page_size'));
|
||||
--end
|
||||
--task 3
|
||||
INSERT INTO pgsz VALUES(3, eval('PRAGMA page_size'));
|
||||
--end
|
||||
--task 4
|
||||
INSERT INTO pgsz VALUES(4, eval('PRAGMA page_size'));
|
||||
--end
|
||||
--task 5
|
||||
INSERT INTO pgsz VALUES(5, eval('PRAGMA page_size'));
|
||||
--end
|
||||
--source multiwrite01.test
|
||||
--source crash02.subtest
|
||||
--wait all
|
||||
SELECT sz FROM pgsz;
|
||||
--match 2048 2048 2048 2048 2048
|
||||
PRAGMA page_size=8192;
|
||||
VACUUM;
|
||||
DELETE FROM pgsz;
|
||||
--task 1
|
||||
INSERT INTO pgsz VALUES(1, eval('PRAGMA page_size'));
|
||||
--end
|
||||
--task 2
|
||||
INSERT INTO pgsz VALUES(2, eval('PRAGMA page_size'));
|
||||
--end
|
||||
--task 3
|
||||
INSERT INTO pgsz VALUES(3, eval('PRAGMA page_size'));
|
||||
--end
|
||||
--task 4
|
||||
INSERT INTO pgsz VALUES(4, eval('PRAGMA page_size'));
|
||||
--end
|
||||
--task 5
|
||||
INSERT INTO pgsz VALUES(5, eval('PRAGMA page_size'));
|
||||
--end
|
||||
--source multiwrite01.test
|
||||
--source crash02.subtest
|
||||
--wait all
|
||||
SELECT sz FROM pgsz;
|
||||
--match 8192 8192 8192 8192 8192
|
||||
PRAGMA page_size=16384;
|
||||
VACUUM;
|
||||
DELETE FROM pgsz;
|
||||
--task 1
|
||||
INSERT INTO pgsz VALUES(1, eval('PRAGMA page_size'));
|
||||
--end
|
||||
--task 2
|
||||
INSERT INTO pgsz VALUES(2, eval('PRAGMA page_size'));
|
||||
--end
|
||||
--task 3
|
||||
INSERT INTO pgsz VALUES(3, eval('PRAGMA page_size'));
|
||||
--end
|
||||
--task 4
|
||||
INSERT INTO pgsz VALUES(4, eval('PRAGMA page_size'));
|
||||
--end
|
||||
--task 5
|
||||
INSERT INTO pgsz VALUES(5, eval('PRAGMA page_size'));
|
||||
--end
|
||||
--source multiwrite01.test
|
||||
--source crash02.subtest
|
||||
--wait all
|
||||
SELECT sz FROM pgsz;
|
||||
--match 16384 16384 16384 16384 16384
|
||||
PRAGMA auto_vacuum=FULL;
|
||||
VACUUM;
|
||||
--source multiwrite01.test
|
||||
--source crash02.subtest
|
||||
--wait all
|
||||
PRAGMA auto_vacuum=FULL;
|
||||
PRAGMA page_size=512;
|
||||
VACUUM;
|
||||
--source multiwrite01.test
|
||||
--source crash02.subtest
|
||||
@@ -0,0 +1,102 @@
|
||||
/* Test cases involving incomplete transactions that must be rolled back.
|
||||
*/
|
||||
--task 1
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
|
||||
--sleep 1
|
||||
INSERT INTO t1 VALUES(1, randomblob(2000));
|
||||
INSERT INTO t1 VALUES(2, randomblob(1000));
|
||||
--sleep 1
|
||||
INSERT INTO t1 SELECT a+2, randomblob(1500) FROM t1;
|
||||
INSERT INTO t1 SELECT a+4, randomblob(1500) FROM t1;
|
||||
INSERT INTO t1 SELECT a+8, randomblob(1500) FROM t1;
|
||||
--sleep 1
|
||||
INSERT INTO t1 SELECT a+16, randomblob(1500) FROM t1;
|
||||
--sleep 1
|
||||
INSERT INTO t1 SELECT a+32, randomblob(1500) FROM t1;
|
||||
SELECT count(*) FROM t1;
|
||||
--match 64
|
||||
SELECT avg(length(b)) FROM t1;
|
||||
--match 1500.0
|
||||
--sleep 2
|
||||
UPDATE t1 SET b='x'||a||'y';
|
||||
SELECT total(length(b)) FROM t1;
|
||||
--match 247
|
||||
SELECT a FROM t1 WHERE b='x17y';
|
||||
--match 17
|
||||
CREATE INDEX t1b ON t1(b);
|
||||
SELECT a FROM t1 WHERE b='x17y';
|
||||
--match 17
|
||||
SELECT a FROM t1 WHERE b GLOB 'x2?y' ORDER BY b DESC LIMIT 5;
|
||||
--match 29 28 27 26 25
|
||||
--end
|
||||
--wait 1
|
||||
--task 2
|
||||
CREATE TABLE t2(a INTEGER PRIMARY KEY, b);
|
||||
INSERT INTO t2 SELECT a, b FROM t1;
|
||||
UPDATE t1 SET b='x'||a||'y';
|
||||
SELECT total(length(b)) FROM t2;
|
||||
--match 247
|
||||
SELECT a FROM t2 WHERE b='x17y';
|
||||
--match 17
|
||||
CREATE INDEX t2b ON t2(b);
|
||||
SELECT a FROM t2 WHERE b='x17y';
|
||||
--match 17
|
||||
SELECT a FROM t2 WHERE b GLOB 'x2?y' ORDER BY b DESC LIMIT 5;
|
||||
--match 29 28 27 26 25
|
||||
--end
|
||||
--task 3
|
||||
CREATE TABLE t3(a INTEGER PRIMARY KEY, b);
|
||||
INSERT INTO t3 SELECT a, b FROM t1;
|
||||
UPDATE t1 SET b='x'||a||'y';
|
||||
SELECT total(length(b)) FROM t3;
|
||||
--match 247
|
||||
SELECT a FROM t3 WHERE b='x17y';
|
||||
--match 17
|
||||
CREATE INDEX t3b ON t3(b);
|
||||
SELECT a FROM t3 WHERE b='x17y';
|
||||
--match 17
|
||||
SELECT a FROM t3 WHERE b GLOB 'x2?y' ORDER BY b DESC LIMIT 5;
|
||||
--match 29 28 27 26 25
|
||||
--end
|
||||
--task 4
|
||||
CREATE TABLE t4(a INTEGER PRIMARY KEY, b);
|
||||
INSERT INTO t4 SELECT a, b FROM t1;
|
||||
UPDATE t1 SET b='x'||a||'y';
|
||||
SELECT total(length(b)) FROM t4;
|
||||
--match 247
|
||||
SELECT a FROM t4 WHERE b='x17y';
|
||||
--match 17
|
||||
CREATE INDEX t4b ON t4(b);
|
||||
SELECT a FROM t4 WHERE b='x17y';
|
||||
--match 17
|
||||
SELECT a FROM t4 WHERE b GLOB 'x2?y' ORDER BY b DESC LIMIT 5;
|
||||
--match 29 28 27 26 25
|
||||
--end
|
||||
--task 5
|
||||
CREATE TABLE t5(a INTEGER PRIMARY KEY, b);
|
||||
INSERT INTO t5 SELECT a, b FROM t1;
|
||||
UPDATE t1 SET b='x'||a||'y';
|
||||
SELECT total(length(b)) FROM t5;
|
||||
--match 247
|
||||
SELECT a FROM t5 WHERE b='x17y';
|
||||
--match 17
|
||||
CREATE INDEX t5b ON t5(b);
|
||||
SELECT a FROM t5 WHERE b='x17y';
|
||||
--match 17
|
||||
SELECT a FROM t5 WHERE b GLOB 'x2?y' ORDER BY b DESC LIMIT 5;
|
||||
--match 29 28 27 26 25
|
||||
--end
|
||||
|
||||
--wait all
|
||||
/* After the database file has been set up, run the crash2 subscript
|
||||
** multiple times. */
|
||||
--source crash02.subtest
|
||||
--source crash02.subtest
|
||||
--source crash02.subtest
|
||||
--source crash02.subtest
|
||||
--source crash02.subtest
|
||||
--source crash02.subtest
|
||||
--source crash02.subtest
|
||||
--source crash02.subtest
|
||||
--source crash02.subtest
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
** This script is called from crash01.test and config02.test and perhaps other
|
||||
** script. After the database file has been set up, make a big rollback
|
||||
** journal in client 1, then crash client 1.
|
||||
** Then in the other clients, do an integrity check.
|
||||
*/
|
||||
--task 1 leave-hot-journal
|
||||
--sleep 5
|
||||
--finish
|
||||
PRAGMA cache_size=10;
|
||||
BEGIN;
|
||||
UPDATE t1 SET b=randomblob(20000);
|
||||
UPDATE t2 SET b=randomblob(20000);
|
||||
UPDATE t3 SET b=randomblob(20000);
|
||||
UPDATE t4 SET b=randomblob(20000);
|
||||
UPDATE t5 SET b=randomblob(20000);
|
||||
UPDATE t1 SET b=NULL;
|
||||
UPDATE t2 SET b=NULL;
|
||||
UPDATE t3 SET b=NULL;
|
||||
UPDATE t4 SET b=NULL;
|
||||
UPDATE t5 SET b=NULL;
|
||||
--print Task one crashing an incomplete transaction
|
||||
--exit 1
|
||||
--end
|
||||
--task 2 integrity_check-2
|
||||
SELECT count(*) FROM t1;
|
||||
--match 64
|
||||
--sleep 100
|
||||
PRAGMA integrity_check(10);
|
||||
--match ok
|
||||
--end
|
||||
--task 3 integrity_check-3
|
||||
SELECT count(*) FROM t1;
|
||||
--match 64
|
||||
--sleep 100
|
||||
PRAGMA integrity_check(10);
|
||||
--match ok
|
||||
--end
|
||||
--task 4 integrity_check-4
|
||||
SELECT count(*) FROM t1;
|
||||
--match 64
|
||||
--sleep 100
|
||||
PRAGMA integrity_check(10);
|
||||
--match ok
|
||||
--end
|
||||
--task 5 integrity_check-5
|
||||
SELECT count(*) FROM t1;
|
||||
--match 64
|
||||
--sleep 100
|
||||
PRAGMA integrity_check(10);
|
||||
--match ok
|
||||
--end
|
||||
--wait all
|
||||
+1315
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,405 @@
|
||||
/*
|
||||
** This script sets up five different tasks all writing and updating
|
||||
** the database at the same time, but each in its own table.
|
||||
*/
|
||||
--task 1 build-t1
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
|
||||
--sleep 1
|
||||
INSERT INTO t1 VALUES(1, randomblob(2000));
|
||||
INSERT INTO t1 VALUES(2, randomblob(1000));
|
||||
--sleep 1
|
||||
INSERT INTO t1 SELECT a+2, randomblob(1500) FROM t1;
|
||||
INSERT INTO t1 SELECT a+4, randomblob(1500) FROM t1;
|
||||
INSERT INTO t1 SELECT a+8, randomblob(1500) FROM t1;
|
||||
--sleep 1
|
||||
INSERT INTO t1 SELECT a+16, randomblob(1500) FROM t1;
|
||||
--sleep 1
|
||||
INSERT INTO t1 SELECT a+32, randomblob(1500) FROM t1;
|
||||
SELECT count(*) FROM t1;
|
||||
--match 64
|
||||
SELECT avg(length(b)) FROM t1;
|
||||
--match 1500.0
|
||||
--sleep 2
|
||||
UPDATE t1 SET b='x'||a||'y';
|
||||
SELECT total(length(b)) FROM t1;
|
||||
--match 247
|
||||
SELECT a FROM t1 WHERE b='x17y';
|
||||
--match 17
|
||||
CREATE INDEX t1b ON t1(b);
|
||||
SELECT a FROM t1 WHERE b='x17y';
|
||||
--match 17
|
||||
SELECT a FROM t1 WHERE b GLOB 'x2?y' ORDER BY b DESC LIMIT 5;
|
||||
--match 29 28 27 26 25
|
||||
--end
|
||||
|
||||
|
||||
--task 2 build-t2
|
||||
DROP TABLE IF EXISTS t2;
|
||||
CREATE TABLE t2(a INTEGER PRIMARY KEY, b);
|
||||
--sleep 1
|
||||
INSERT INTO t2 VALUES(1, randomblob(2000));
|
||||
INSERT INTO t2 VALUES(2, randomblob(1000));
|
||||
--sleep 1
|
||||
INSERT INTO t2 SELECT a+2, randomblob(1500) FROM t2;
|
||||
INSERT INTO t2 SELECT a+4, randomblob(1500) FROM t2;
|
||||
INSERT INTO t2 SELECT a+8, randomblob(1500) FROM t2;
|
||||
--sleep 1
|
||||
INSERT INTO t2 SELECT a+16, randomblob(1500) FROM t2;
|
||||
--sleep 1
|
||||
INSERT INTO t2 SELECT a+32, randomblob(1500) FROM t2;
|
||||
SELECT count(*) FROM t2;
|
||||
--match 64
|
||||
SELECT avg(length(b)) FROM t2;
|
||||
--match 1500.0
|
||||
--sleep 2
|
||||
UPDATE t2 SET b='x'||a||'y';
|
||||
SELECT total(length(b)) FROM t2;
|
||||
--match 247
|
||||
SELECT a FROM t2 WHERE b='x17y';
|
||||
--match 17
|
||||
CREATE INDEX t2b ON t2(b);
|
||||
SELECT a FROM t2 WHERE b='x17y';
|
||||
--match 17
|
||||
SELECT a FROM t2 WHERE b GLOB 'x2?y' ORDER BY b DESC LIMIT 5;
|
||||
--match 29 28 27 26 25
|
||||
--end
|
||||
|
||||
--task 3 build-t3
|
||||
DROP TABLE IF EXISTS t3;
|
||||
CREATE TABLE t3(a INTEGER PRIMARY KEY, b);
|
||||
--sleep 1
|
||||
INSERT INTO t3 VALUES(1, randomblob(2000));
|
||||
INSERT INTO t3 VALUES(2, randomblob(1000));
|
||||
--sleep 1
|
||||
INSERT INTO t3 SELECT a+2, randomblob(1500) FROM t3;
|
||||
INSERT INTO t3 SELECT a+4, randomblob(1500) FROM t3;
|
||||
INSERT INTO t3 SELECT a+8, randomblob(1500) FROM t3;
|
||||
--sleep 1
|
||||
INSERT INTO t3 SELECT a+16, randomblob(1500) FROM t3;
|
||||
--sleep 1
|
||||
INSERT INTO t3 SELECT a+32, randomblob(1500) FROM t3;
|
||||
SELECT count(*) FROM t3;
|
||||
--match 64
|
||||
SELECT avg(length(b)) FROM t3;
|
||||
--match 1500.0
|
||||
--sleep 2
|
||||
UPDATE t3 SET b='x'||a||'y';
|
||||
SELECT total(length(b)) FROM t3;
|
||||
--match 247
|
||||
SELECT a FROM t3 WHERE b='x17y';
|
||||
--match 17
|
||||
CREATE INDEX t3b ON t3(b);
|
||||
SELECT a FROM t3 WHERE b='x17y';
|
||||
--match 17
|
||||
SELECT a FROM t3 WHERE b GLOB 'x2?y' ORDER BY b DESC LIMIT 5;
|
||||
--match 29 28 27 26 25
|
||||
--end
|
||||
|
||||
--task 4 build-t4
|
||||
DROP TABLE IF EXISTS t4;
|
||||
CREATE TABLE t4(a INTEGER PRIMARY KEY, b);
|
||||
--sleep 1
|
||||
INSERT INTO t4 VALUES(1, randomblob(2000));
|
||||
INSERT INTO t4 VALUES(2, randomblob(1000));
|
||||
--sleep 1
|
||||
INSERT INTO t4 SELECT a+2, randomblob(1500) FROM t4;
|
||||
INSERT INTO t4 SELECT a+4, randomblob(1500) FROM t4;
|
||||
INSERT INTO t4 SELECT a+8, randomblob(1500) FROM t4;
|
||||
--sleep 1
|
||||
INSERT INTO t4 SELECT a+16, randomblob(1500) FROM t4;
|
||||
--sleep 1
|
||||
INSERT INTO t4 SELECT a+32, randomblob(1500) FROM t4;
|
||||
SELECT count(*) FROM t4;
|
||||
--match 64
|
||||
SELECT avg(length(b)) FROM t4;
|
||||
--match 1500.0
|
||||
--sleep 2
|
||||
UPDATE t4 SET b='x'||a||'y';
|
||||
SELECT total(length(b)) FROM t4;
|
||||
--match 247
|
||||
SELECT a FROM t4 WHERE b='x17y';
|
||||
--match 17
|
||||
CREATE INDEX t4b ON t4(b);
|
||||
SELECT a FROM t4 WHERE b='x17y';
|
||||
--match 17
|
||||
SELECT a FROM t4 WHERE b GLOB 'x2?y' ORDER BY b DESC LIMIT 5;
|
||||
--match 29 28 27 26 25
|
||||
--end
|
||||
|
||||
--task 5 build-t5
|
||||
DROP TABLE IF EXISTS t5;
|
||||
CREATE TABLE t5(a INTEGER PRIMARY KEY, b);
|
||||
--sleep 1
|
||||
INSERT INTO t5 VALUES(1, randomblob(2000));
|
||||
INSERT INTO t5 VALUES(2, randomblob(1000));
|
||||
--sleep 1
|
||||
INSERT INTO t5 SELECT a+2, randomblob(1500) FROM t5;
|
||||
INSERT INTO t5 SELECT a+4, randomblob(1500) FROM t5;
|
||||
INSERT INTO t5 SELECT a+8, randomblob(1500) FROM t5;
|
||||
--sleep 1
|
||||
INSERT INTO t5 SELECT a+16, randomblob(1500) FROM t5;
|
||||
--sleep 1
|
||||
INSERT INTO t5 SELECT a+32, randomblob(1500) FROM t5;
|
||||
SELECT count(*) FROM t5;
|
||||
--match 64
|
||||
SELECT avg(length(b)) FROM t5;
|
||||
--match 1500.0
|
||||
--sleep 2
|
||||
UPDATE t5 SET b='x'||a||'y';
|
||||
SELECT total(length(b)) FROM t5;
|
||||
--match 247
|
||||
SELECT a FROM t5 WHERE b='x17y';
|
||||
--match 17
|
||||
CREATE INDEX t5b ON t5(b);
|
||||
SELECT a FROM t5 WHERE b='x17y';
|
||||
--match 17
|
||||
SELECT a FROM t5 WHERE b GLOB 'x2?y' ORDER BY b DESC LIMIT 5;
|
||||
--match 29 28 27 26 25
|
||||
--end
|
||||
|
||||
--wait all
|
||||
SELECT count(*), total(length(b)) FROM t1;
|
||||
--match 64 247
|
||||
SELECT count(*), total(length(b)) FROM t2;
|
||||
--match 64 247
|
||||
SELECT count(*), total(length(b)) FROM t3;
|
||||
--match 64 247
|
||||
SELECT count(*), total(length(b)) FROM t4;
|
||||
--match 64 247
|
||||
SELECT count(*), total(length(b)) FROM t5;
|
||||
--match 64 247
|
||||
|
||||
--task 1
|
||||
SELECT t1.a FROM t1, t2
|
||||
WHERE t2.b GLOB 'x3?y' AND t1.b=('x'||(t2.a+3)||'y')
|
||||
ORDER BY t1.a LIMIT 4
|
||||
--match 33 34 35 36
|
||||
SELECT t3.a FROM t3, t4
|
||||
WHERE t4.b GLOB 'x4?y' AND t3.b=('x'||(t4.a+5)||'y')
|
||||
ORDER BY t3.a LIMIT 7
|
||||
--match 45 46 47 48 49 50 51
|
||||
--end
|
||||
--task 5
|
||||
SELECT t1.a FROM t1, t2
|
||||
WHERE t2.b GLOB 'x3?y' AND t1.b=('x'||(t2.a+3)||'y')
|
||||
ORDER BY t1.a LIMIT 4
|
||||
--match 33 34 35 36
|
||||
SELECT t3.a FROM t3, t4
|
||||
WHERE t4.b GLOB 'x4?y' AND t3.b=('x'||(t4.a+5)||'y')
|
||||
ORDER BY t3.a LIMIT 7
|
||||
--match 45 46 47 48 49 50 51
|
||||
--end
|
||||
--task 3
|
||||
SELECT t1.a FROM t1, t2
|
||||
WHERE t2.b GLOB 'x3?y' AND t1.b=('x'||(t2.a+3)||'y')
|
||||
ORDER BY t1.a LIMIT 4
|
||||
--match 33 34 35 36
|
||||
SELECT t3.a FROM t3, t4
|
||||
WHERE t4.b GLOB 'x4?y' AND t3.b=('x'||(t4.a+5)||'y')
|
||||
ORDER BY t3.a LIMIT 7
|
||||
--match 45 46 47 48 49 50 51
|
||||
--end
|
||||
--task 2
|
||||
SELECT t1.a FROM t1, t2
|
||||
WHERE t2.b GLOB 'x3?y' AND t1.b=('x'||(t2.a+3)||'y')
|
||||
ORDER BY t1.a LIMIT 4
|
||||
--match 33 34 35 36
|
||||
SELECT t3.a FROM t3, t4
|
||||
WHERE t4.b GLOB 'x4?y' AND t3.b=('x'||(t4.a+5)||'y')
|
||||
ORDER BY t3.a LIMIT 7
|
||||
--match 45 46 47 48 49 50 51
|
||||
--end
|
||||
--task 4
|
||||
SELECT t1.a FROM t1, t2
|
||||
WHERE t2.b GLOB 'x3?y' AND t1.b=('x'||(t2.a+3)||'y')
|
||||
ORDER BY t1.a LIMIT 4
|
||||
--match 33 34 35 36
|
||||
SELECT t3.a FROM t3, t4
|
||||
WHERE t4.b GLOB 'x4?y' AND t3.b=('x'||(t4.a+5)||'y')
|
||||
ORDER BY t3.a LIMIT 7
|
||||
--match 45 46 47 48 49 50 51
|
||||
--end
|
||||
--wait all
|
||||
|
||||
--task 5
|
||||
DROP INDEX t5b;
|
||||
--sleep 5
|
||||
PRAGMA integrity_check(10);
|
||||
--match ok
|
||||
CREATE INDEX t5b ON t5(b DESC);
|
||||
--end
|
||||
--task 3
|
||||
DROP INDEX t3b;
|
||||
--sleep 5
|
||||
PRAGMA integrity_check(10);
|
||||
--match ok
|
||||
CREATE INDEX t3b ON t3(b DESC);
|
||||
--end
|
||||
--task 1
|
||||
DROP INDEX t1b;
|
||||
--sleep 5
|
||||
PRAGMA integrity_check(10);
|
||||
--match ok
|
||||
CREATE INDEX t1b ON t1(b DESC);
|
||||
--end
|
||||
--task 2
|
||||
DROP INDEX t2b;
|
||||
--sleep 5
|
||||
PRAGMA integrity_check(10);
|
||||
--match ok
|
||||
CREATE INDEX t2b ON t2(b DESC);
|
||||
--end
|
||||
--task 4
|
||||
DROP INDEX t4b;
|
||||
--sleep 5
|
||||
PRAGMA integrity_check(10);
|
||||
--match ok
|
||||
CREATE INDEX t4b ON t4(b DESC);
|
||||
--end
|
||||
--wait all
|
||||
|
||||
--task 1
|
||||
SELECT t1.a FROM t1, t2
|
||||
WHERE t2.b GLOB 'x3?y' AND t1.b=('x'||(t2.a+3)||'y')
|
||||
ORDER BY t1.a LIMIT 4
|
||||
--match 33 34 35 36
|
||||
SELECT t3.a FROM t3, t4
|
||||
WHERE t4.b GLOB 'x4?y' AND t3.b=('x'||(t4.a+5)||'y')
|
||||
ORDER BY t3.a LIMIT 7
|
||||
--match 45 46 47 48 49 50 51
|
||||
--end
|
||||
--task 5
|
||||
SELECT t1.a FROM t1, t2
|
||||
WHERE t2.b GLOB 'x3?y' AND t1.b=('x'||(t2.a+3)||'y')
|
||||
ORDER BY t1.a LIMIT 4
|
||||
--match 33 34 35 36
|
||||
SELECT t3.a FROM t3, t4
|
||||
WHERE t4.b GLOB 'x4?y' AND t3.b=('x'||(t4.a+5)||'y')
|
||||
ORDER BY t3.a LIMIT 7
|
||||
--match 45 46 47 48 49 50 51
|
||||
--end
|
||||
--task 3
|
||||
SELECT t1.a FROM t1, t2
|
||||
WHERE t2.b GLOB 'x3?y' AND t1.b=('x'||(t2.a+3)||'y')
|
||||
ORDER BY t1.a LIMIT 4
|
||||
--match 33 34 35 36
|
||||
SELECT t3.a FROM t3, t4
|
||||
WHERE t4.b GLOB 'x4?y' AND t3.b=('x'||(t4.a+5)||'y')
|
||||
ORDER BY t3.a LIMIT 7
|
||||
--match 45 46 47 48 49 50 51
|
||||
--end
|
||||
--task 2
|
||||
SELECT t1.a FROM t1, t2
|
||||
WHERE t2.b GLOB 'x3?y' AND t1.b=('x'||(t2.a+3)||'y')
|
||||
ORDER BY t1.a LIMIT 4
|
||||
--match 33 34 35 36
|
||||
SELECT t3.a FROM t3, t4
|
||||
WHERE t4.b GLOB 'x4?y' AND t3.b=('x'||(t4.a+5)||'y')
|
||||
ORDER BY t3.a LIMIT 7
|
||||
--match 45 46 47 48 49 50 51
|
||||
--end
|
||||
--task 4
|
||||
SELECT t1.a FROM t1, t2
|
||||
WHERE t2.b GLOB 'x3?y' AND t1.b=('x'||(t2.a+3)||'y')
|
||||
ORDER BY t1.a LIMIT 4
|
||||
--match 33 34 35 36
|
||||
SELECT t3.a FROM t3, t4
|
||||
WHERE t4.b GLOB 'x4?y' AND t3.b=('x'||(t4.a+5)||'y')
|
||||
ORDER BY t3.a LIMIT 7
|
||||
--match 45 46 47 48 49 50 51
|
||||
--end
|
||||
--wait all
|
||||
|
||||
VACUUM;
|
||||
PRAGMA integrity_check(10);
|
||||
--match ok
|
||||
|
||||
--task 1
|
||||
UPDATE t1 SET b=randomblob(20000);
|
||||
--sleep 5
|
||||
UPDATE t1 SET b='x'||a||'y';
|
||||
SELECT a FROM t1 WHERE b='x63y';
|
||||
--match 63
|
||||
--end
|
||||
--task 2
|
||||
UPDATE t2 SET b=randomblob(20000);
|
||||
--sleep 5
|
||||
UPDATE t2 SET b='x'||a||'y';
|
||||
SELECT a FROM t2 WHERE b='x63y';
|
||||
--match 63
|
||||
--end
|
||||
--task 3
|
||||
UPDATE t3 SET b=randomblob(20000);
|
||||
--sleep 5
|
||||
UPDATE t3 SET b='x'||a||'y';
|
||||
SELECT a FROM t3 WHERE b='x63y';
|
||||
--match 63
|
||||
--end
|
||||
--task 4
|
||||
UPDATE t4 SET b=randomblob(20000);
|
||||
--sleep 5
|
||||
UPDATE t4 SET b='x'||a||'y';
|
||||
SELECT a FROM t4 WHERE b='x63y';
|
||||
--match 63
|
||||
--end
|
||||
--task 5
|
||||
UPDATE t5 SET b=randomblob(20000);
|
||||
--sleep 5
|
||||
UPDATE t5 SET b='x'||a||'y';
|
||||
SELECT a FROM t5 WHERE b='x63y';
|
||||
--match 63
|
||||
--end
|
||||
--wait all
|
||||
|
||||
--task 1
|
||||
SELECT t1.a FROM t1, t2
|
||||
WHERE t2.b GLOB 'x3?y' AND t1.b=('x'||(t2.a+3)||'y')
|
||||
ORDER BY t1.a LIMIT 4
|
||||
--match 33 34 35 36
|
||||
SELECT t3.a FROM t3, t4
|
||||
WHERE t4.b GLOB 'x4?y' AND t3.b=('x'||(t4.a+5)||'y')
|
||||
ORDER BY t3.a LIMIT 7
|
||||
--match 45 46 47 48 49 50 51
|
||||
--end
|
||||
--task 5
|
||||
SELECT t1.a FROM t1, t2
|
||||
WHERE t2.b GLOB 'x3?y' AND t1.b=('x'||(t2.a+3)||'y')
|
||||
ORDER BY t1.a LIMIT 4
|
||||
--match 33 34 35 36
|
||||
SELECT t3.a FROM t3, t4
|
||||
WHERE t4.b GLOB 'x4?y' AND t3.b=('x'||(t4.a+5)||'y')
|
||||
ORDER BY t3.a LIMIT 7
|
||||
--match 45 46 47 48 49 50 51
|
||||
--end
|
||||
--task 3
|
||||
SELECT t1.a FROM t1, t2
|
||||
WHERE t2.b GLOB 'x3?y' AND t1.b=('x'||(t2.a+3)||'y')
|
||||
ORDER BY t1.a LIMIT 4
|
||||
--match 33 34 35 36
|
||||
SELECT t3.a FROM t3, t4
|
||||
WHERE t4.b GLOB 'x4?y' AND t3.b=('x'||(t4.a+5)||'y')
|
||||
ORDER BY t3.a LIMIT 7
|
||||
--match 45 46 47 48 49 50 51
|
||||
--end
|
||||
--task 2
|
||||
SELECT t1.a FROM t1, t2
|
||||
WHERE t2.b GLOB 'x3?y' AND t1.b=('x'||(t2.a+3)||'y')
|
||||
ORDER BY t1.a LIMIT 4
|
||||
--match 33 34 35 36
|
||||
SELECT t3.a FROM t3, t4
|
||||
WHERE t4.b GLOB 'x4?y' AND t3.b=('x'||(t4.a+5)||'y')
|
||||
ORDER BY t3.a LIMIT 7
|
||||
--match 45 46 47 48 49 50 51
|
||||
--end
|
||||
--task 4
|
||||
SELECT t1.a FROM t1, t2
|
||||
WHERE t2.b GLOB 'x3?y' AND t1.b=('x'||(t2.a+3)||'y')
|
||||
ORDER BY t1.a LIMIT 4
|
||||
--match 33 34 35 36
|
||||
SELECT t3.a FROM t3, t4
|
||||
WHERE t4.b GLOB 'x4?y' AND t3.b=('x'||(t4.a+5)||'y')
|
||||
ORDER BY t3.a LIMIT 7
|
||||
--match 45 46 47 48 49 50 51
|
||||
--end
|
||||
--wait all
|
||||
+2
-1
@@ -397,7 +397,8 @@ int sqlite3_backup_step(sqlite3_backup *p, int nPage){
|
||||
const Pgno iSrcPg = p->iNext; /* Source page number */
|
||||
if( iSrcPg!=PENDING_BYTE_PAGE(p->pSrc->pBt) ){
|
||||
DbPage *pSrcPg; /* Source page object */
|
||||
rc = sqlite3PagerGet(pSrcPager, iSrcPg, &pSrcPg);
|
||||
rc = sqlite3PagerAcquire(pSrcPager, iSrcPg, &pSrcPg,
|
||||
PAGER_ACQUIRE_READONLY);
|
||||
if( rc==SQLITE_OK ){
|
||||
rc = backupOnePage(p, iSrcPg, sqlite3PagerGetData(pSrcPg), 0);
|
||||
sqlite3PagerUnref(pSrcPg);
|
||||
|
||||
+43
-43
@@ -575,6 +575,19 @@ static void btreeClearHasContent(BtShared *pBt){
|
||||
pBt->pHasContent = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** Release all of the apPage[] pages for a cursor.
|
||||
*/
|
||||
static void btreeReleaseAllCursorPages(BtCursor *pCur){
|
||||
int i;
|
||||
for(i=0; i<=pCur->iPage; i++){
|
||||
releasePage(pCur->apPage[i]);
|
||||
pCur->apPage[i] = 0;
|
||||
}
|
||||
pCur->iPage = -1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Save the current cursor position in the variables BtCursor.nKey
|
||||
** and BtCursor.pKey. The cursor's state is set to CURSOR_REQUIRESEEK.
|
||||
@@ -614,12 +627,7 @@ static int saveCursorPosition(BtCursor *pCur){
|
||||
assert( !pCur->apPage[0]->intKey || !pCur->pKey );
|
||||
|
||||
if( rc==SQLITE_OK ){
|
||||
int i;
|
||||
for(i=0; i<=pCur->iPage; i++){
|
||||
releasePage(pCur->apPage[i]);
|
||||
pCur->apPage[i] = 0;
|
||||
}
|
||||
pCur->iPage = -1;
|
||||
btreeReleaseAllCursorPages(pCur);
|
||||
pCur->eState = CURSOR_REQUIRESEEK;
|
||||
}
|
||||
|
||||
@@ -637,11 +645,15 @@ static int saveAllCursors(BtShared *pBt, Pgno iRoot, BtCursor *pExcept){
|
||||
assert( sqlite3_mutex_held(pBt->mutex) );
|
||||
assert( pExcept==0 || pExcept->pBt==pBt );
|
||||
for(p=pBt->pCursor; p; p=p->pNext){
|
||||
if( p!=pExcept && (0==iRoot || p->pgnoRoot==iRoot) &&
|
||||
p->eState==CURSOR_VALID ){
|
||||
int rc = saveCursorPosition(p);
|
||||
if( SQLITE_OK!=rc ){
|
||||
return rc;
|
||||
if( p!=pExcept && (0==iRoot || p->pgnoRoot==iRoot) ){
|
||||
if( p->eState==CURSOR_VALID ){
|
||||
int rc = saveCursorPosition(p);
|
||||
if( SQLITE_OK!=rc ){
|
||||
return rc;
|
||||
}
|
||||
}else{
|
||||
testcase( p->iPage>0 );
|
||||
btreeReleaseAllCursorPages(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1864,6 +1876,7 @@ int sqlite3BtreeOpen(
|
||||
rc = sqlite3PagerOpen(pVfs, &pBt->pPager, zFilename,
|
||||
EXTRA_SIZE, flags, vfsFlags, pageReinit);
|
||||
if( rc==SQLITE_OK ){
|
||||
sqlite3PagerSetMmapLimit(pBt->pPager, db->mxMmap);
|
||||
rc = sqlite3PagerReadFileheader(pBt->pPager,sizeof(zDbHeader),zDbHeader);
|
||||
}
|
||||
if( rc!=SQLITE_OK ){
|
||||
@@ -2582,34 +2595,6 @@ int sqlite3BtreeNewDb(Btree *p){
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
** Ensure that any root page references held by open cursors are not
|
||||
** mmap pages.
|
||||
*/
|
||||
static int btreeSwapOutMmap(BtShared *pBt){
|
||||
int rc = SQLITE_OK; /* Return code */
|
||||
BtCursor *pCsr; /* Used to iterate through all open cursors */
|
||||
|
||||
for(pCsr=pBt->pCursor; pCsr && rc==SQLITE_OK; pCsr=pCsr->pNext){
|
||||
if( pCsr->iPage>=0 ){
|
||||
MemPage *pPg = pCsr->apPage[0];
|
||||
if( pPg && pPg->pDbPage->flags & PGHDR_MMAP ){
|
||||
MemPage *pNew = 0;
|
||||
rc = getAndInitPage(pBt, pPg->pgno, &pNew, 0);
|
||||
if( rc==SQLITE_OK ){
|
||||
if( pCsr->iPage==0 ){
|
||||
pCsr->info.pCell = pNew->aData + (pCsr->info.pCell - pPg->aData);
|
||||
}
|
||||
pCsr->apPage[0] = pNew;
|
||||
releasePage(pPg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
** Attempt to start a new transaction. A write-transaction
|
||||
** is started if the second argument is nonzero, otherwise a read-
|
||||
@@ -2716,9 +2701,6 @@ int sqlite3BtreeBeginTrans(Btree *p, int wrflag){
|
||||
rc = SQLITE_READONLY;
|
||||
}else{
|
||||
rc = sqlite3PagerBegin(pBt->pPager,wrflag>1,sqlite3TempInMemory(p->db));
|
||||
if( rc==SQLITE_OK ){
|
||||
rc = btreeSwapOutMmap(pBt);
|
||||
}
|
||||
if( rc==SQLITE_OK ){
|
||||
rc = newDatabase(pBt);
|
||||
}
|
||||
@@ -4418,7 +4400,7 @@ static int moveToRoot(BtCursor *pCur){
|
||||
pCur->eState = CURSOR_INVALID;
|
||||
return SQLITE_OK;
|
||||
}else{
|
||||
rc = getAndInitPage(pBt, pCur->pgnoRoot, &pCur->apPage[0], 0);
|
||||
rc = getAndInitPage(pBt, pCur->pgnoRoot, &pCur->apPage[0], pCur->wrFlag==0);
|
||||
if( rc!=SQLITE_OK ){
|
||||
pCur->eState = CURSOR_INVALID;
|
||||
return rc;
|
||||
@@ -7268,7 +7250,14 @@ static int btreeCreateTable(Btree *p, int *piTable, int createTabFlags){
|
||||
u8 eType = 0;
|
||||
Pgno iPtrPage = 0;
|
||||
|
||||
/* Save the positions of any open cursors. This is required in
|
||||
** case they are holding a reference to an xFetch reference
|
||||
** corresponding to page pgnoRoot. */
|
||||
rc = saveAllCursors(pBt, 0, 0);
|
||||
releasePage(pPageMove);
|
||||
if( rc!=SQLITE_OK ){
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* Move the page currently at pgnoRoot to pgnoMove. */
|
||||
rc = btreeGetPage(pBt, pgnoRoot, &pRoot, 0, 0);
|
||||
@@ -8399,6 +8388,17 @@ int sqlite3BtreePutData(BtCursor *pCsr, u32 offset, u32 amt, void *z){
|
||||
return SQLITE_ABORT;
|
||||
}
|
||||
|
||||
/* Save the positions of all other cursors open on this table. This is
|
||||
** required in case any of them are holding references to an xFetch
|
||||
** version of the b-tree page modified by the accessPayload call below.
|
||||
**
|
||||
** Note that pCsr must be open on a BTREE_INTKEY table and saveCursorPosition()
|
||||
** and hence saveAllCursors() cannot fail on a BTREE_INTKEY table, hence
|
||||
** saveAllCursors can only return SQLITE_OK.
|
||||
*/
|
||||
VVA_ONLY(rc =) saveAllCursors(pCsr->pBt, pCsr->pgnoRoot, pCsr);
|
||||
assert( rc==SQLITE_OK );
|
||||
|
||||
/* Check some assumptions:
|
||||
** (a) the cursor is open for writing,
|
||||
** (b) there is a read/write transaction open,
|
||||
|
||||
@@ -57,12 +57,18 @@ static const char * const azCompileOpt[] = {
|
||||
#ifdef SQLITE_DEFAULT_LOCKING_MODE
|
||||
"DEFAULT_LOCKING_MODE=" CTIMEOPT_VAL(SQLITE_DEFAULT_LOCKING_MODE),
|
||||
#endif
|
||||
#ifdef SQLITE_DEFAULT_MMAP_LIMIT
|
||||
"DEFAULT_MMAP_LIMIT=" CTIMEOPT_VAL(SQLITE_DEFAULT_MMAP_LIMIT),
|
||||
#endif
|
||||
#ifdef SQLITE_DISABLE_DIRSYNC
|
||||
"DISABLE_DIRSYNC",
|
||||
#endif
|
||||
#ifdef SQLITE_DISABLE_LFS
|
||||
"DISABLE_LFS",
|
||||
#endif
|
||||
#ifdef SQLITE_DISABLE_MMAP
|
||||
"DISABLE_MMAP",
|
||||
#endif
|
||||
#ifdef SQLITE_ENABLE_ATOMIC_WRITE
|
||||
"ENABLE_ATOMIC_WRITE",
|
||||
#endif
|
||||
|
||||
@@ -693,6 +693,13 @@ static int patternCompare(
|
||||
return *zString==0;
|
||||
}
|
||||
|
||||
/*
|
||||
** The sqlite3_strglob() interface.
|
||||
*/
|
||||
int sqlite3_strglob(const char *zGlobPattern, const char *zString){
|
||||
return patternCompare((u8*)zGlobPattern, (u8*)zString, &globInfo, 0)==0;
|
||||
}
|
||||
|
||||
/*
|
||||
** Count the number of times that the LIKE operator (or GLOB which is
|
||||
** just a variation of LIKE) gets called. This is used for testing
|
||||
|
||||
@@ -156,6 +156,7 @@ SQLITE_WSD struct Sqlite3Config sqlite3Config = {
|
||||
(void*)0, /* pHeap */
|
||||
0, /* nHeap */
|
||||
0, 0, /* mnHeap, mxHeap */
|
||||
SQLITE_DEFAULT_MMAP_LIMIT, /* mxMmap */
|
||||
(void*)0, /* pScratch */
|
||||
0, /* szScratch */
|
||||
0, /* nScratch */
|
||||
|
||||
+4
-8
@@ -38,7 +38,6 @@ int sqlite3_exec(
|
||||
const char *zLeftover; /* Tail of unprocessed SQL */
|
||||
sqlite3_stmt *pStmt = 0; /* The current SQL statement */
|
||||
char **azCols = 0; /* Names of result columns */
|
||||
int nRetry = 0; /* Number of retry attempts */
|
||||
int callbackIsInit; /* True if callback data is initialized */
|
||||
|
||||
if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
|
||||
@@ -46,12 +45,12 @@ int sqlite3_exec(
|
||||
|
||||
sqlite3_mutex_enter(db->mutex);
|
||||
sqlite3Error(db, SQLITE_OK, 0);
|
||||
while( (rc==SQLITE_OK || (rc==SQLITE_SCHEMA && (++nRetry)<2)) && zSql[0] ){
|
||||
while( rc==SQLITE_OK && zSql[0] ){
|
||||
int nCol;
|
||||
char **azVals = 0;
|
||||
|
||||
pStmt = 0;
|
||||
rc = sqlite3_prepare(db, zSql, -1, &pStmt, &zLeftover);
|
||||
rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, &zLeftover);
|
||||
assert( rc==SQLITE_OK || pStmt==0 );
|
||||
if( rc!=SQLITE_OK ){
|
||||
continue;
|
||||
@@ -108,11 +107,8 @@ int sqlite3_exec(
|
||||
if( rc!=SQLITE_ROW ){
|
||||
rc = sqlite3VdbeFinalize((Vdbe *)pStmt);
|
||||
pStmt = 0;
|
||||
if( rc!=SQLITE_SCHEMA ){
|
||||
nRetry = 0;
|
||||
zSql = zLeftover;
|
||||
while( sqlite3Isspace(zSql[0]) ) zSql++;
|
||||
}
|
||||
zSql = zLeftover;
|
||||
while( sqlite3Isspace(zSql[0]) ) zSql++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -496,6 +496,13 @@ int sqlite3_config(int op, ...){
|
||||
}
|
||||
#endif
|
||||
|
||||
case SQLITE_CONFIG_MMAP_LIMIT: {
|
||||
sqlite3_int64 mxMmap = va_arg(ap, sqlite3_int64);
|
||||
if( mxMmap<0 ) mxMmap = SQLITE_DEFAULT_MMAP_LIMIT;
|
||||
sqlite3GlobalConfig.mxMmap = mxMmap;
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
rc = SQLITE_ERROR;
|
||||
break;
|
||||
@@ -2316,6 +2323,7 @@ static int openDatabase(
|
||||
memcpy(db->aLimit, aHardLimit, sizeof(db->aLimit));
|
||||
db->autoCommit = 1;
|
||||
db->nextAutovac = -1;
|
||||
db->mxMmap = sqlite3GlobalConfig.mxMmap;
|
||||
db->nextPagesize = 0;
|
||||
db->flags |= SQLITE_ShortColNames | SQLITE_AutoIndex | SQLITE_EnableTrigger
|
||||
#if SQLITE_DEFAULT_FILE_FORMAT<4
|
||||
|
||||
@@ -141,6 +141,8 @@ int sqlite3OsShmMap(
|
||||
return id->pMethods->xShmMap(id, iPage, pgsz, bExtend, pp);
|
||||
}
|
||||
|
||||
#if !defined(SQLITE_DISABLE_MMAP)
|
||||
/* The real implementation of xFetch and xUnfetch */
|
||||
int sqlite3OsFetch(sqlite3_file *id, i64 iOff, int iAmt, void **pp){
|
||||
DO_OS_MALLOC_TEST(id);
|
||||
return id->pMethods->xFetch(id, iOff, iAmt, pp);
|
||||
@@ -148,6 +150,16 @@ int sqlite3OsFetch(sqlite3_file *id, i64 iOff, int iAmt, void **pp){
|
||||
int sqlite3OsUnfetch(sqlite3_file *id, i64 iOff, void *p){
|
||||
return id->pMethods->xUnfetch(id, iOff, p);
|
||||
}
|
||||
#else
|
||||
/* No-op stubs to use when memory-mapped I/O is disabled */
|
||||
int sqlite3OsFetch(sqlite3_file *id, i64 iOff, int iAmt, void **pp){
|
||||
*pp = 0;
|
||||
return SQLITE_OK;
|
||||
}
|
||||
int sqlite3OsUnfetch(sqlite3_file *id, i64 iOff, void *p){
|
||||
return SQLITE_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
** The next group of routines are convenience wrappers around the
|
||||
|
||||
+210
-166
@@ -207,14 +207,6 @@ struct UnixUnusedFd {
|
||||
UnixUnusedFd *pNext; /* Next unused file descriptor on same file */
|
||||
};
|
||||
|
||||
typedef struct unixMapping unixMapping;
|
||||
struct unixMapping {
|
||||
sqlite3_int64 mmapSize;
|
||||
sqlite3_int64 mmapOrigsize;
|
||||
void *pMapRegion;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
** The unixFile structure is subclass of sqlite3_file specific to the unix
|
||||
** VFS implementations.
|
||||
@@ -234,10 +226,10 @@ struct unixFile {
|
||||
unixShm *pShm; /* Shared memory segment information */
|
||||
int szChunk; /* Configured by FCNTL_CHUNK_SIZE */
|
||||
int nFetchOut; /* Number of outstanding xFetch refs */
|
||||
sqlite3_int64 mmapSize; /* Usable size of mapping at pMapRegion */
|
||||
sqlite3_int64 mmapOrigsize; /* Actual size of mapping at pMapRegion */
|
||||
sqlite3_int64 mmapLimit; /* Configured FCNTL_MMAP_LIMIT value */
|
||||
int szSyspage; /* System page size */
|
||||
unixMapping aMmap[2]; /* Up to two memory mapped regions */
|
||||
|
||||
void *pMapRegion; /* Memory mapped region */
|
||||
#ifdef __QNXNTO__
|
||||
int sectorSize; /* Device sector size */
|
||||
int deviceCharacteristics; /* Precomputed device characteristics */
|
||||
@@ -288,6 +280,7 @@ struct unixFile {
|
||||
#define UNIXFILE_DELETE 0x20 /* Delete on close */
|
||||
#define UNIXFILE_URI 0x40 /* Filename might have query parameters */
|
||||
#define UNIXFILE_NOLOCK 0x80 /* Do no file locking */
|
||||
#define UNIXFILE_WARNED 0x0100 /* verifyDbFile() warnings have been issued */
|
||||
|
||||
/*
|
||||
** Include code that is common to all os_*.c files
|
||||
@@ -321,12 +314,15 @@ struct unixFile {
|
||||
#define threadid 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
** HAVE_MREMAP defaults to true on Linux and false everywhere else.
|
||||
*/
|
||||
#if !defined(HAVE_MREMAP)
|
||||
#if defined(__linux__) && defined(_GNU_SOURCE)
|
||||
# define HAVE_MREMAP 1
|
||||
#else
|
||||
# define HAVE_MREMAP 0
|
||||
#endif
|
||||
# if defined(__linux__) && defined(_GNU_SOURCE)
|
||||
# define HAVE_MREMAP 1
|
||||
# else
|
||||
# define HAVE_MREMAP 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -804,7 +800,6 @@ static int sqliteErrorFromPosixError(int posixError, int sqliteIOErr) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
****************** Begin Unique File ID Utility Used By VxWorks ***************
|
||||
**
|
||||
@@ -1140,7 +1135,6 @@ static int unixLogErrorAtLine(
|
||||
zErr = strerror(iErrno);
|
||||
#endif
|
||||
|
||||
assert( errcode!=SQLITE_OK );
|
||||
if( zPath==0 ) zPath = "";
|
||||
sqlite3_log(errcode,
|
||||
"os_unix.c:%d: (%d) %s(%s) - %s",
|
||||
@@ -1306,6 +1300,50 @@ static int findInodeInfo(
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Check a unixFile that is a database. Verify the following:
|
||||
**
|
||||
** (1) There is exactly one hard link on the file
|
||||
** (2) The file is not a symbolic link
|
||||
** (3) The file has not been renamed or unlinked
|
||||
**
|
||||
** Issue sqlite3_log(SQLITE_WARNING,...) messages if anything is not right.
|
||||
*/
|
||||
static void verifyDbFile(unixFile *pFile){
|
||||
struct stat buf;
|
||||
int rc;
|
||||
if( pFile->ctrlFlags & UNIXFILE_WARNED ){
|
||||
/* One or more of the following warnings have already been issued. Do not
|
||||
** repeat them so as not to clutter the error log */
|
||||
return;
|
||||
}
|
||||
rc = osFstat(pFile->h, &buf);
|
||||
if( rc!=0 ){
|
||||
sqlite3_log(SQLITE_WARNING, "cannot fstat db file %s", pFile->zPath);
|
||||
pFile->ctrlFlags |= UNIXFILE_WARNED;
|
||||
return;
|
||||
}
|
||||
if( buf.st_nlink==0 && (pFile->ctrlFlags & UNIXFILE_DELETE)==0 ){
|
||||
sqlite3_log(SQLITE_WARNING, "file unlinked while open: %s", pFile->zPath);
|
||||
pFile->ctrlFlags |= UNIXFILE_WARNED;
|
||||
return;
|
||||
}
|
||||
if( buf.st_nlink>1 ){
|
||||
sqlite3_log(SQLITE_WARNING, "multiple links to file: %s", pFile->zPath);
|
||||
pFile->ctrlFlags |= UNIXFILE_WARNED;
|
||||
return;
|
||||
}
|
||||
if( pFile->pInode!=0
|
||||
&& ((rc = osStat(pFile->zPath, &buf))!=0
|
||||
|| buf.st_ino!=pFile->pInode->fileId.ino)
|
||||
){
|
||||
sqlite3_log(SQLITE_WARNING, "file renamed while open: %s", pFile->zPath);
|
||||
pFile->ctrlFlags |= UNIXFILE_WARNED;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** This routine checks if there is a RESERVED lock held on the specified
|
||||
** file by this or any other process. If such a lock is held, set *pResOut
|
||||
@@ -1882,7 +1920,7 @@ static int closeUnixFile(sqlite3_file *id){
|
||||
static int unixClose(sqlite3_file *id){
|
||||
int rc = SQLITE_OK;
|
||||
unixFile *pFile = (unixFile *)id;
|
||||
unixUnmapfile(pFile);
|
||||
verifyDbFile(pFile);
|
||||
unixUnlock(id, NO_LOCK);
|
||||
unixEnterMutex();
|
||||
|
||||
@@ -3114,8 +3152,6 @@ static int unixRead(
|
||||
unixFile *pFile = (unixFile *)id;
|
||||
int got;
|
||||
assert( id );
|
||||
sqlite3_int64 iMap = 0; /* File offset of start of mapping i */
|
||||
int i; /* Used to iterate through mappings */
|
||||
|
||||
/* If this is a database file (not a journal, master-journal or temp
|
||||
** file), the bytes in the locking range should never be read or written. */
|
||||
@@ -3126,25 +3162,22 @@ static int unixRead(
|
||||
);
|
||||
#endif
|
||||
|
||||
#if !defined(SQLITE_DISABLE_MMAP)
|
||||
/* Deal with as much of this read request as possible by transfering
|
||||
** data from the memory mapping using memcpy(). */
|
||||
for(i=0; i<2; i++){
|
||||
unixMapping *pMap = &pFile->aMmap[i];
|
||||
sqlite3_int64 iEnd = iMap + pMap->mmapSize;
|
||||
if( offset<iEnd ){
|
||||
if( offset+amt <= iEnd ){
|
||||
memcpy(pBuf, &((u8 *)(pMap->pMapRegion))[offset-iMap], amt);
|
||||
return SQLITE_OK;
|
||||
}else{
|
||||
int nCopy = iEnd - offset;
|
||||
memcpy(pBuf, &((u8 *)(pMap->pMapRegion))[offset-iMap], nCopy);
|
||||
pBuf = &((u8 *)pBuf)[nCopy];
|
||||
amt -= nCopy;
|
||||
offset += nCopy;
|
||||
}
|
||||
if( offset<pFile->mmapSize ){
|
||||
if( offset+amt <= pFile->mmapSize ){
|
||||
memcpy(pBuf, &((u8 *)(pFile->pMapRegion))[offset], amt);
|
||||
return SQLITE_OK;
|
||||
}else{
|
||||
int nCopy = pFile->mmapSize - offset;
|
||||
memcpy(pBuf, &((u8 *)(pFile->pMapRegion))[offset], nCopy);
|
||||
pBuf = &((u8 *)pBuf)[nCopy];
|
||||
amt -= nCopy;
|
||||
offset += nCopy;
|
||||
}
|
||||
iMap = pMap->mmapSize;
|
||||
}
|
||||
#endif
|
||||
|
||||
got = seekAndRead(pFile, offset, pBuf, amt);
|
||||
if( got==amt ){
|
||||
@@ -3218,8 +3251,6 @@ static int unixWrite(
|
||||
int wrote = 0;
|
||||
assert( id );
|
||||
assert( amt>0 );
|
||||
int i;
|
||||
sqlite3_int64 iMap = 0;
|
||||
|
||||
/* If this is a database file (not a journal, master-journal or temp
|
||||
** file), the bytes in the locking range should never be read or written. */
|
||||
@@ -3252,23 +3283,22 @@ static int unixWrite(
|
||||
}
|
||||
#endif
|
||||
|
||||
for(i=0; i<2; i++){
|
||||
unixMapping *pMap = &pFile->aMmap[i];
|
||||
sqlite3_int64 iEnd = iMap + pMap->mmapSize;
|
||||
if( offset<iEnd ){
|
||||
if( offset+amt <= iEnd ){
|
||||
memcpy(&((u8 *)(pMap->pMapRegion))[offset-iMap], pBuf, amt);
|
||||
return SQLITE_OK;
|
||||
}else{
|
||||
int nCopy = iEnd - offset;
|
||||
memcpy(&((u8 *)(pMap->pMapRegion))[offset-iMap], pBuf, nCopy);
|
||||
pBuf = &((u8 *)pBuf)[nCopy];
|
||||
amt -= nCopy;
|
||||
offset += nCopy;
|
||||
}
|
||||
#if !defined(SQLITE_DISABLE_MMAP)
|
||||
/* Deal with as much of this write request as possible by transfering
|
||||
** data from the memory mapping using memcpy(). */
|
||||
if( offset<pFile->mmapSize ){
|
||||
if( offset+amt <= pFile->mmapSize ){
|
||||
memcpy(&((u8 *)(pFile->pMapRegion))[offset], pBuf, amt);
|
||||
return SQLITE_OK;
|
||||
}else{
|
||||
int nCopy = pFile->mmapSize - offset;
|
||||
memcpy(&((u8 *)(pFile->pMapRegion))[offset], pBuf, nCopy);
|
||||
pBuf = &((u8 *)pBuf)[nCopy];
|
||||
amt -= nCopy;
|
||||
offset += nCopy;
|
||||
}
|
||||
iMap = pMap->mmapSize;
|
||||
}
|
||||
#endif
|
||||
|
||||
while( amt>0 && (wrote = seekAndWrite(pFile, offset, pBuf, amt))>0 ){
|
||||
amt -= wrote;
|
||||
@@ -3539,8 +3569,6 @@ static int unixTruncate(sqlite3_file *id, i64 nByte){
|
||||
pFile->lastErrno = errno;
|
||||
return unixLogError(SQLITE_IOERR_TRUNCATE, "ftruncate", pFile->zPath);
|
||||
}else{
|
||||
int i;
|
||||
|
||||
#ifdef SQLITE_DEBUG
|
||||
/* If we are doing a normal write to a database file (as opposed to
|
||||
** doing a hot-journal rollback or a write to some file other than a
|
||||
@@ -3558,13 +3586,8 @@ static int unixTruncate(sqlite3_file *id, i64 nByte){
|
||||
** mapped region, reduce the effective mapping size as well. SQLite will
|
||||
** use read() and write() to access data beyond this point from now on.
|
||||
*/
|
||||
for(i=1; i>=0; i--){
|
||||
unixMapping *pMap = &pFile->aMmap[i];
|
||||
sqlite3_int64 iEnd = pMap->mmapSize + (i==1 ? pMap[-1].mmapSize : 0);
|
||||
if( nByte<iEnd ){
|
||||
pMap->mmapSize -= (iEnd - nByte);
|
||||
if( pMap->mmapSize<0 ) pMap->mmapSize = 0;
|
||||
}
|
||||
if( nByte<pFile->mmapSize ){
|
||||
pFile->mmapSize = nByte;
|
||||
}
|
||||
|
||||
return SQLITE_OK;
|
||||
@@ -3655,18 +3678,16 @@ static int fcntlSizeHint(unixFile *pFile, i64 nByte){
|
||||
}
|
||||
}
|
||||
|
||||
if( pFile->mmapLimit>0 ){
|
||||
if( pFile->mmapLimit>0 && nByte>pFile->mmapSize ){
|
||||
int rc;
|
||||
sqlite3_int64 nSz = nByte;
|
||||
if( pFile->szChunk<=0 ){
|
||||
nSz = ((nSz+pFile->szSyspage-1) / pFile->szSyspage) * pFile->szSyspage;
|
||||
if( robust_ftruncate(pFile->h, nSz) ){
|
||||
if( robust_ftruncate(pFile->h, nByte) ){
|
||||
pFile->lastErrno = errno;
|
||||
return unixLogError(SQLITE_IOERR_TRUNCATE, "ftruncate", pFile->zPath);
|
||||
}
|
||||
}
|
||||
|
||||
rc = unixMapfile(pFile, nSz);
|
||||
rc = unixMapfile(pFile, nByte);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -3738,7 +3759,12 @@ static int unixFileControl(sqlite3_file *id, int op, void *pArg){
|
||||
return SQLITE_OK;
|
||||
}
|
||||
case SQLITE_FCNTL_MMAP_LIMIT: {
|
||||
pFile->mmapLimit = *(i64*)pArg;
|
||||
i64 newLimit = *(i64*)pArg;
|
||||
*(i64*)pArg = pFile->mmapLimit;
|
||||
if( newLimit>=0 ){
|
||||
pFile->mmapLimit = newLimit;
|
||||
if( newLimit<pFile->mmapSize ) pFile->mmapSize = newLimit;
|
||||
}
|
||||
return SQLITE_OK;
|
||||
}
|
||||
#ifdef SQLITE_DEBUG
|
||||
@@ -4547,31 +4573,118 @@ static int unixShmUnmap(
|
||||
** If it is currently memory mapped, unmap file pFd.
|
||||
*/
|
||||
static void unixUnmapfile(unixFile *pFd){
|
||||
int i;
|
||||
assert( pFd->nFetchOut==0 );
|
||||
for(i=0; i<2; i++){
|
||||
unixMapping *pMap = &pFd->aMmap[i];
|
||||
if( pMap->pMapRegion ){
|
||||
osMunmap(pMap->pMapRegion, pMap->mmapOrigsize);
|
||||
pMap->pMapRegion = 0;
|
||||
pMap->mmapSize = 0;
|
||||
pMap->mmapOrigsize = 0;
|
||||
}
|
||||
#ifndef SQLITE_DISABLE_MMAP
|
||||
if( pFd->pMapRegion ){
|
||||
osMunmap(pFd->pMapRegion, pFd->mmapOrigsize);
|
||||
pFd->pMapRegion = 0;
|
||||
pFd->mmapSize = 0;
|
||||
pFd->mmapOrigsize = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef SQLITE_DISABLE_MMAP
|
||||
/*
|
||||
** Return the system page size somehow.
|
||||
** Return the system page size.
|
||||
*/
|
||||
static int unixGetPagesize(void){
|
||||
#if HAVE_REMAP
|
||||
#if HAVE_MREMAP
|
||||
return 512;
|
||||
#elif _BSD_SOURCE
|
||||
#elif defined(_BSD_SOURCE)
|
||||
return getpagesize();
|
||||
#else
|
||||
return (int)sysconf(_SC_PAGESIZE);
|
||||
#endif
|
||||
}
|
||||
#endif /* SQLITE_DISABLE_MMAP */
|
||||
|
||||
#ifndef SQLITE_DISABLE_MMAP
|
||||
/*
|
||||
** Attempt to set the size of the memory mapping maintained by file
|
||||
** descriptor pFd to nNew bytes. Any existing mapping is discarded.
|
||||
**
|
||||
** If successful, this function sets the following variables:
|
||||
**
|
||||
** unixFile.pMapRegion
|
||||
** unixFile.mmapSize
|
||||
** unixFile.mmapOrigsize
|
||||
**
|
||||
** If unsuccessful, an error message is logged via sqlite3_log() and
|
||||
** the three variables above are zeroed. In this case SQLite should
|
||||
** continue accessing the database using the xRead() and xWrite()
|
||||
** methods.
|
||||
*/
|
||||
static void unixRemapfile(
|
||||
unixFile *pFd, /* File descriptor object */
|
||||
i64 nNew /* Required mapping size */
|
||||
){
|
||||
const char *zErr = "mmap";
|
||||
int h = pFd->h; /* File descriptor open on db file */
|
||||
u8 *pOrig = (u8 *)pFd->pMapRegion; /* Pointer to current file mapping */
|
||||
i64 nOrig = pFd->mmapOrigsize; /* Size of pOrig region in bytes */
|
||||
u8 *pNew = 0; /* Location of new mapping */
|
||||
int flags = PROT_READ; /* Flags to pass to mmap() */
|
||||
|
||||
assert( pFd->nFetchOut==0 );
|
||||
assert( nNew>pFd->mmapSize );
|
||||
assert( nNew<=pFd->mmapLimit );
|
||||
assert( nNew>0 );
|
||||
assert( pFd->mmapOrigsize>=pFd->mmapSize );
|
||||
assert( MAP_FAILED!=0 );
|
||||
|
||||
if( (pFd->ctrlFlags & UNIXFILE_RDONLY)==0 ) flags |= PROT_WRITE;
|
||||
|
||||
if( pOrig ){
|
||||
const int szSyspage = unixGetPagesize();
|
||||
i64 nReuse = (pFd->mmapSize & ~(szSyspage-1));
|
||||
u8 *pReq = &pOrig[nReuse];
|
||||
|
||||
/* Unmap any pages of the existing mapping that cannot be reused. */
|
||||
if( nReuse!=nOrig ){
|
||||
osMunmap(pReq, nOrig-nReuse);
|
||||
}
|
||||
|
||||
#if HAVE_MREMAP
|
||||
pNew = osMremap(pOrig, nReuse, nNew, MREMAP_MAYMOVE);
|
||||
zErr = "mremap";
|
||||
#else
|
||||
pNew = osMmap(pReq, nNew-nReuse, flags, MAP_SHARED, h, nReuse);
|
||||
if( pNew!=MAP_FAILED ){
|
||||
if( pNew!=pReq ){
|
||||
osMunmap(pNew, nNew - nReuse);
|
||||
pNew = 0;
|
||||
}else{
|
||||
pNew = pOrig;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* The attempt to extend the existing mapping failed. Free it. */
|
||||
if( pNew==MAP_FAILED || pNew==0 ){
|
||||
osMunmap(pOrig, nReuse);
|
||||
}
|
||||
}
|
||||
|
||||
/* If pNew is still NULL, try to create an entirely new mapping. */
|
||||
if( pNew==0 ){
|
||||
pNew = osMmap(0, nNew, flags, MAP_SHARED, h, 0);
|
||||
}
|
||||
|
||||
if( pNew==MAP_FAILED ){
|
||||
pNew = 0;
|
||||
nNew = 0;
|
||||
unixLogError(SQLITE_OK, zErr, pFd->zPath);
|
||||
|
||||
/* If the mmap() above failed, assume that all subsequent mmap() calls
|
||||
** will probably fail too. Fall back to using xRead/xWrite exclusively
|
||||
** in this case. */
|
||||
pFd->mmapLimit = 0;
|
||||
}
|
||||
pFd->pMapRegion = (void *)pNew;
|
||||
pFd->mmapSize = pFd->mmapOrigsize = nNew;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Memory map or remap the file opened by file-descriptor pFd (if the file
|
||||
@@ -4590,17 +4703,13 @@ static int unixGetPagesize(void){
|
||||
** code otherwise.
|
||||
*/
|
||||
static int unixMapfile(unixFile *pFd, i64 nByte){
|
||||
i64 nMap; /* Number of bytes of file to map */
|
||||
#ifndef SQLITE_DISABLE_MMAP
|
||||
i64 nMap = nByte;
|
||||
int rc;
|
||||
|
||||
assert( nMap>=0 || pFd->nFetchOut==0 );
|
||||
if( pFd->nFetchOut>0 ) return SQLITE_OK;
|
||||
|
||||
/* Set variable nMap to the number of bytes of the file to map. This is
|
||||
** the smaller of argument nByte and the limit configured by
|
||||
** SQLITE_FCNTL_MMAP_LIMIT. Or, if nByte is less than zero, the smaller
|
||||
** of the file size or the SQLITE_FCNTL_MMAP_LIMIT value. */
|
||||
nMap = nByte;
|
||||
if( nMap<0 ){
|
||||
struct stat statbuf; /* Low-level file information */
|
||||
rc = osFstat(pFd->h, &statbuf);
|
||||
@@ -4613,72 +4722,14 @@ static int unixMapfile(unixFile *pFd, i64 nByte){
|
||||
nMap = pFd->mmapLimit;
|
||||
}
|
||||
|
||||
if( nMap!=(pFd->aMmap[0].mmapSize + pFd->aMmap[1].mmapSize) ){
|
||||
|
||||
/* If the request is for a mapping zero bytes in size, or there are
|
||||
** currently already two mapping regions, or there is already a mapping
|
||||
** region that is not a multiple of the page-size in size, unmap
|
||||
** everything. */
|
||||
if( nMap==0
|
||||
#if !HAVE_MREMAP
|
||||
|| (pFd->aMmap[0].pMapRegion && pFd->aMmap[1].pMapRegion)
|
||||
|| (pFd->aMmap[0].mmapSize % pFd->szSyspage)
|
||||
#endif
|
||||
){
|
||||
if( nMap!=pFd->mmapSize ){
|
||||
if( nMap>0 ){
|
||||
unixRemapfile(pFd, nMap);
|
||||
}else{
|
||||
unixUnmapfile(pFd);
|
||||
}
|
||||
assert( pFd->aMmap[1].pMapRegion==0 );
|
||||
|
||||
if( nMap>0 ){
|
||||
unixMapping *pMap = &pFd->aMmap[0]; /* First mapping object */
|
||||
void *pNew = 0;
|
||||
int iNew = 0;
|
||||
int flags = PROT_READ;
|
||||
if( (pFd->ctrlFlags & UNIXFILE_RDONLY)==0 ) flags |= PROT_WRITE;
|
||||
|
||||
/* If there are currently no mappings, create a new one */
|
||||
if( pMap->pMapRegion==0 ){
|
||||
pNew = osMmap(0, nMap, flags, MAP_SHARED, pFd->h, 0);
|
||||
}
|
||||
#if HAVE_MREMAP
|
||||
/* If we have an mremap() call, resize the existing mapping. */
|
||||
else{
|
||||
pNew = osMremap(
|
||||
pMap->pMapRegion, pMap->mmapOrigsize, nMap, MREMAP_MAYMOVE
|
||||
);
|
||||
}
|
||||
#else
|
||||
/* Otherwise, create a second mapping. If the existing mapping is
|
||||
** a multiple of the page-size in size, then request that the new
|
||||
** mapping immediately follow the old in virtual memory. */
|
||||
else{
|
||||
i64 nNew; /* Bytes to map with this call */
|
||||
void *pAddr = 0; /* Virtual address to request mapping at */
|
||||
|
||||
nNew = nMap - pMap->mmapSize;
|
||||
if( pMap->mmapSize==pMap->mmapOrigsize ){
|
||||
pAddr = (void *)&((u8 *)pMap->pMapRegion)[pMap->mmapSize];
|
||||
}
|
||||
|
||||
pNew = osMmap(pAddr, nNew, flags, MAP_SHARED, pFd->h, pMap->mmapSize);
|
||||
|
||||
if( pAddr && pNew==pAddr ){
|
||||
pNew = pMap->pMapRegion;
|
||||
}else{
|
||||
iNew = 1;
|
||||
nMap = nNew;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if( pNew==MAP_FAILED ){
|
||||
return SQLITE_IOERR_MMAP;
|
||||
}
|
||||
pFd->aMmap[iNew].pMapRegion = pNew;
|
||||
pFd->aMmap[iNew].mmapSize = nMap;
|
||||
pFd->aMmap[iNew].mmapOrigsize = nMap;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return SQLITE_OK;
|
||||
}
|
||||
@@ -4696,28 +4747,23 @@ static int unixMapfile(unixFile *pFd, i64 nByte){
|
||||
** release the reference by calling unixUnfetch().
|
||||
*/
|
||||
static int unixFetch(sqlite3_file *fd, i64 iOff, int nAmt, void **pp){
|
||||
#ifndef SQLITE_DISABLE_MMAP
|
||||
unixFile *pFd = (unixFile *)fd; /* The underlying database file */
|
||||
#endif
|
||||
*pp = 0;
|
||||
|
||||
#ifndef SQLITE_DISABLE_MMAP
|
||||
if( pFd->mmapLimit>0 ){
|
||||
int i;
|
||||
sqlite3_int64 iMap = 0;
|
||||
|
||||
if( pFd->aMmap[0].pMapRegion==0 ){
|
||||
if( pFd->pMapRegion==0 ){
|
||||
int rc = unixMapfile(pFd, -1);
|
||||
if( rc!=SQLITE_OK ) return rc;
|
||||
}
|
||||
|
||||
for(i=0; i<2; i++){
|
||||
unixMapping *pMap = &pFd->aMmap[i];
|
||||
if( iOff>=iMap && iOff+nAmt<=(iMap + pMap->mmapSize) ){
|
||||
*pp = &((u8 *)pMap->pMapRegion)[iOff-iMap];
|
||||
pFd->nFetchOut++;
|
||||
break;
|
||||
}
|
||||
iMap = pMap->mmapSize;
|
||||
if( pFd->mmapSize >= iOff+nAmt ){
|
||||
*pp = &((u8 *)pFd->pMapRegion)[iOff];
|
||||
pFd->nFetchOut++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
@@ -4740,9 +4786,7 @@ static int unixUnfetch(sqlite3_file *fd, i64 iOff, void *p){
|
||||
assert( (p==0)==(pFd->nFetchOut==0) );
|
||||
|
||||
/* If p!=0, it must match the iOff value. */
|
||||
#if 0
|
||||
assert( p==0 || p==&((u8 *)pFd->pMapRegion)[iOff] );
|
||||
#endif
|
||||
|
||||
if( p ){
|
||||
pFd->nFetchOut--;
|
||||
@@ -5082,7 +5126,7 @@ static int fillInUnixFile(
|
||||
pNew->pVfs = pVfs;
|
||||
pNew->zPath = zFilename;
|
||||
pNew->ctrlFlags = (u8)ctrlFlags;
|
||||
pNew->mmapLimit = SQLITE_DEFAULT_MMAP_LIMIT;
|
||||
pNew->mmapLimit = sqlite3GlobalConfig.mxMmap;
|
||||
if( sqlite3_uri_boolean(((ctrlFlags & UNIXFILE_URI) ? zFilename : 0),
|
||||
"psow", SQLITE_POWERSAFE_OVERWRITE) ){
|
||||
pNew->ctrlFlags |= UNIXFILE_PSOW;
|
||||
@@ -5227,6 +5271,7 @@ static int fillInUnixFile(
|
||||
}else{
|
||||
pNew->pMethod = pLockingStyle;
|
||||
OpenCounter(+1);
|
||||
verifyDbFile(pNew);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
@@ -5704,7 +5749,6 @@ static int unixOpen(
|
||||
}
|
||||
#endif
|
||||
|
||||
p->szSyspage = unixGetPagesize();
|
||||
rc = fillInUnixFile(pVfs, fd, pFile, zPath, ctrlFlags);
|
||||
|
||||
open_finished:
|
||||
|
||||
+209
-120
@@ -150,9 +150,14 @@ struct winFile {
|
||||
winceLock local; /* Locks obtained by this instance of winFile */
|
||||
winceLock *shared; /* Global shared lock memory for the file */
|
||||
#endif
|
||||
HANDLE hMap; /* Handle for accessing memory mapping */
|
||||
void *pMapRegion; /* Area memory mapped */
|
||||
sqlite3_int64 mmapSize; /* Size of xMremap() */
|
||||
#if !defined(SQLITE_DISABLE_MMAP)
|
||||
int nFetchOut; /* Number of outstanding xFetch references */
|
||||
HANDLE hMap; /* Handle for accessing memory mapping */
|
||||
void *pMapRegion; /* Area memory mapped */
|
||||
sqlite3_int64 mmapSize; /* Usable size of mapped region */
|
||||
sqlite3_int64 mmapOrigsize; /* Actual size of mapped region */
|
||||
sqlite3_int64 mmapLimit; /* Configured FCNTL_MMAP_LIMIT value */
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -2066,7 +2071,7 @@ static int seekWinFile(winFile *pFile, sqlite3_int64 iOffset){
|
||||
}
|
||||
|
||||
/* Forward references to VFS methods */
|
||||
static int winUnmap(sqlite3_file *);
|
||||
static int winUnmapfile(winFile*);
|
||||
|
||||
/*
|
||||
** Close a file.
|
||||
@@ -2090,8 +2095,10 @@ static int winClose(sqlite3_file *id){
|
||||
OSTRACE(("CLOSE %d\n", pFile->h));
|
||||
assert( pFile->h!=NULL && pFile->h!=INVALID_HANDLE_VALUE );
|
||||
|
||||
rc = winUnmap(id);
|
||||
#if !defined(SQLITE_DISABLE_MMAP)
|
||||
rc = winUnmapfile(pFile);
|
||||
if( rc!=SQLITE_OK ) return rc;
|
||||
#endif
|
||||
|
||||
do{
|
||||
rc = osCloseHandle(pFile->h);
|
||||
@@ -2142,10 +2149,26 @@ static int winRead(
|
||||
|
||||
assert( id!=0 );
|
||||
assert( amt>0 );
|
||||
assert( offset>=pFile->mmapSize ); /* Never read from the mmapped region */
|
||||
SimulateIOError(return SQLITE_IOERR_READ);
|
||||
OSTRACE(("READ %d lock=%d\n", pFile->h, pFile->locktype));
|
||||
|
||||
#if !defined(SQLITE_DISABLE_MMAP)
|
||||
/* Deal with as much of this read request as possible by transfering
|
||||
** data from the memory mapping using memcpy(). */
|
||||
if( offset<pFile->mmapSize ){
|
||||
if( offset+amt <= pFile->mmapSize ){
|
||||
memcpy(pBuf, &((u8 *)(pFile->pMapRegion))[offset], amt);
|
||||
return SQLITE_OK;
|
||||
}else{
|
||||
int nCopy = (int)(pFile->mmapSize - offset);
|
||||
memcpy(pBuf, &((u8 *)(pFile->pMapRegion))[offset], nCopy);
|
||||
pBuf = &((u8 *)pBuf)[nCopy];
|
||||
amt -= nCopy;
|
||||
offset += nCopy;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if SQLITE_OS_WINCE
|
||||
if( seekWinFile(pFile, offset) ){
|
||||
return SQLITE_FULL;
|
||||
@@ -2189,13 +2212,29 @@ static int winWrite(
|
||||
int nRetry = 0; /* Number of retries */
|
||||
|
||||
assert( amt>0 );
|
||||
assert( offset>=pFile->mmapSize ); /* Never write into the mmapped region */
|
||||
assert( pFile );
|
||||
SimulateIOError(return SQLITE_IOERR_WRITE);
|
||||
SimulateDiskfullError(return SQLITE_FULL);
|
||||
|
||||
OSTRACE(("WRITE %d lock=%d\n", pFile->h, pFile->locktype));
|
||||
|
||||
#if !defined(SQLITE_DISABLE_MMAP)
|
||||
/* Deal with as much of this write request as possible by transfering
|
||||
** data from the memory mapping using memcpy(). */
|
||||
if( offset<pFile->mmapSize ){
|
||||
if( offset+amt <= pFile->mmapSize ){
|
||||
memcpy(&((u8 *)(pFile->pMapRegion))[offset], pBuf, amt);
|
||||
return SQLITE_OK;
|
||||
}else{
|
||||
int nCopy = (int)(pFile->mmapSize - offset);
|
||||
memcpy(&((u8 *)(pFile->pMapRegion))[offset], pBuf, nCopy);
|
||||
pBuf = &((u8 *)pBuf)[nCopy];
|
||||
amt -= nCopy;
|
||||
offset += nCopy;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if SQLITE_OS_WINCE
|
||||
rc = seekWinFile(pFile, offset);
|
||||
if( rc==0 ){
|
||||
@@ -2288,16 +2327,18 @@ static int winTruncate(sqlite3_file *id, sqlite3_int64 nByte){
|
||||
pFile->lastErrno = lastErrno;
|
||||
rc = winLogError(SQLITE_IOERR_TRUNCATE, pFile->lastErrno,
|
||||
"winTruncate2", pFile->zPath);
|
||||
}else{
|
||||
/* If the file was just truncated to a size smaller than the currently
|
||||
** mapped region, reduce the effective mapping size as well. SQLite will
|
||||
** use read() and write() to access data beyond this point from now on.
|
||||
*/
|
||||
if( pFile->pMapRegion && nByte<pFile->mmapSize ){
|
||||
pFile->mmapSize = nByte;
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(SQLITE_DISABLE_MMAP)
|
||||
/* If the file was truncated to a size smaller than the currently
|
||||
** mapped region, reduce the effective mapping size as well. SQLite will
|
||||
** use read() and write() to access data beyond this point from now on.
|
||||
*/
|
||||
if( pFile->pMapRegion && nByte<pFile->mmapSize ){
|
||||
pFile->mmapSize = nByte;
|
||||
}
|
||||
#endif
|
||||
|
||||
OSTRACE(("TRUNCATE %d %lld %s\n", pFile->h, nByte, rc ? "failed" : "ok"));
|
||||
return rc;
|
||||
}
|
||||
@@ -2665,7 +2706,7 @@ static int winCheckReservedLock(sqlite3_file *id, int *pResOut){
|
||||
rc = 1;
|
||||
OSTRACE(("TEST WR-LOCK %d %d (local)\n", pFile->h, rc));
|
||||
}else{
|
||||
rc = winLockFile(&pFile->h, SQLITE_LOCKFILE_FLAGS, RESERVED_BYTE, 0, 1, 0);
|
||||
rc = winLockFile(&pFile->h, SQLITE_LOCKFILEEX_FLAGS,RESERVED_BYTE, 0, 1, 0);
|
||||
if( rc ){
|
||||
winUnlockFile(&pFile->h, RESERVED_BYTE, 0, 1, 0);
|
||||
}
|
||||
@@ -2805,6 +2846,14 @@ static int winFileControl(sqlite3_file *id, int op, void *pArg){
|
||||
}
|
||||
return SQLITE_OK;
|
||||
}
|
||||
#if !defined(SQLITE_DISABLE_MMAP)
|
||||
case SQLITE_FCNTL_MMAP_LIMIT: {
|
||||
i64 newLimit = *(i64*)pArg;
|
||||
*(i64*)pArg = pFile->mmapLimit;
|
||||
if( newLimit>=0 ) pFile->mmapLimit = newLimit;
|
||||
return SQLITE_OK;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return SQLITE_NOTFOUND;
|
||||
}
|
||||
@@ -3475,37 +3524,26 @@ shmpage_out:
|
||||
# define winShmUnmap 0
|
||||
#endif /* #ifndef SQLITE_OMIT_WAL */
|
||||
|
||||
/*
|
||||
** Arguments x and y are both integers. Argument y must be a power of 2.
|
||||
** Round x up to the nearest integer multiple of y. For example:
|
||||
**
|
||||
** ROUNDUP(0, 8) -> 0
|
||||
** ROUNDUP(13, 8) -> 16
|
||||
** ROUNDUP(32, 8) -> 32
|
||||
*/
|
||||
#define ROUNDUP(x,y) (((x)+y-1)&~(y-1))
|
||||
|
||||
/*
|
||||
** Cleans up the mapped region of the specified file, if any.
|
||||
*/
|
||||
static int winUnmap(
|
||||
sqlite3_file *id
|
||||
){
|
||||
winFile *pFile = (winFile*)id;
|
||||
#if !defined(SQLITE_DISABLE_MMAP)
|
||||
static int winUnmapfile(winFile *pFile){
|
||||
assert( pFile!=0 );
|
||||
if( pFile->pMapRegion ){
|
||||
if( !osUnmapViewOfFile(pFile->pMapRegion) ){
|
||||
pFile->lastErrno = osGetLastError();
|
||||
return winLogError(SQLITE_IOERR_MREMAP, pFile->lastErrno,
|
||||
return winLogError(SQLITE_IOERR_MMAP, pFile->lastErrno,
|
||||
"winUnmap1", pFile->zPath);
|
||||
}
|
||||
pFile->pMapRegion = 0;
|
||||
pFile->mmapSize = 0;
|
||||
pFile->mmapOrigsize = 0;
|
||||
}
|
||||
if( pFile->hMap!=NULL ){
|
||||
if( !osCloseHandle(pFile->hMap) ){
|
||||
pFile->lastErrno = osGetLastError();
|
||||
return winLogError(SQLITE_IOERR_MREMAP, pFile->lastErrno,
|
||||
return winLogError(SQLITE_IOERR_MMAP, pFile->lastErrno,
|
||||
"winUnmap2", pFile->zPath);
|
||||
}
|
||||
pFile->hMap = NULL;
|
||||
@@ -3514,116 +3552,162 @@ static int winUnmap(
|
||||
}
|
||||
|
||||
/*
|
||||
** Map, remap or unmap part of the database file.
|
||||
** Memory map or remap the file opened by file-descriptor pFd (if the file
|
||||
** is already mapped, the existing mapping is replaced by the new). Or, if
|
||||
** there already exists a mapping for this file, and there are still
|
||||
** outstanding xFetch() references to it, this function is a no-op.
|
||||
**
|
||||
** If parameter nByte is non-negative, then it is the requested size of
|
||||
** the mapping to create. Otherwise, if nByte is less than zero, then the
|
||||
** requested size is the size of the file on disk. The actual size of the
|
||||
** created mapping is either the requested size or the value configured
|
||||
** using SQLITE_FCNTL_MMAP_LIMIT, whichever is smaller.
|
||||
**
|
||||
** SQLITE_OK is returned if no error occurs (even if the mapping is not
|
||||
** recreated as a result of outstanding references) or an SQLite error
|
||||
** code otherwise.
|
||||
*/
|
||||
static int winMremap(
|
||||
sqlite3_file *id, /* Main database file */
|
||||
int flags, /* Mask of SQLITE_MREMAP_XXX flags */
|
||||
sqlite3_int64 iOff, /* Offset to start mapping at */
|
||||
sqlite3_int64 nOld, /* Size of old mapping, or zero */
|
||||
sqlite3_int64 nNew, /* Size of new mapping, or zero */
|
||||
void **ppMap /* IN/OUT: Old/new mappings */
|
||||
){
|
||||
winFile *pFile = (winFile*)id; /* The underlying database file */
|
||||
int rc = SQLITE_OK; /* Return code */
|
||||
HANDLE hMap = NULL; /* New mapping handle */
|
||||
void *pNew = 0; /* New mapping */
|
||||
i64 nNewRnd; /* nNew rounded up */
|
||||
i64 nOldRnd; /* nOld rounded up */
|
||||
static int winMapfile(winFile *pFd, sqlite3_int64 nByte){
|
||||
sqlite3_int64 nMap = nByte;
|
||||
int rc;
|
||||
|
||||
assert( pFile!=0 );
|
||||
assert( iOff==0 );
|
||||
assert( nOld>=0 );
|
||||
assert( nOld==0 || pFile->pMapRegion==(*ppMap) );
|
||||
assert( nNew>=0 );
|
||||
assert( ppMap );
|
||||
assert( pFile->hMap==NULL || pFile->pMapRegion==(*ppMap) );
|
||||
assert( pFile->pMapRegion==0 || pFile->pMapRegion==(*ppMap) );
|
||||
/* assert( pFile->mmapSize==nOld ); */
|
||||
assert( nMap>=0 || pFd->nFetchOut==0 );
|
||||
if( pFd->nFetchOut>0 ) return SQLITE_OK;
|
||||
|
||||
assert( winSysInfo.dwPageSize>0 );
|
||||
nNewRnd = ROUNDUP(nNew, winSysInfo.dwPageSize*1);
|
||||
assert( nNewRnd>=0 );
|
||||
nOldRnd = ROUNDUP(nOld, winSysInfo.dwPageSize*1);
|
||||
assert( nOldRnd>=0 );
|
||||
|
||||
if( nNewRnd==nOldRnd ){
|
||||
pFile->mmapSize = nNew;
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
/* If the SQLITE_MREMAP_EXTEND flag is set, then the size of the requested
|
||||
** mapping (nNew bytes) may be greater than the size of the database file.
|
||||
** If this is the case, extend the file on disk using ftruncate(). */
|
||||
assert( nNewRnd>0 || (flags & SQLITE_MREMAP_EXTEND)==0 );
|
||||
if( flags & SQLITE_MREMAP_EXTEND ){
|
||||
sqlite3_int64 oldSz;
|
||||
rc = winFileSize(id, &oldSz);
|
||||
if( rc==SQLITE_OK && nNewRnd>oldSz ){
|
||||
rc = winUnmap(id); /* Cannot truncate the file with an open mapping. */
|
||||
if( rc==SQLITE_OK ){
|
||||
rc = winTruncate(id, nNewRnd);
|
||||
}
|
||||
if( nMap<0 ){
|
||||
rc = winFileSize((sqlite3_file*)pFd, &nMap);
|
||||
if( rc ){
|
||||
return SQLITE_IOERR_FSTAT;
|
||||
}
|
||||
if( rc!=SQLITE_OK ) return rc;
|
||||
}
|
||||
|
||||
/* If we get this far, unmap any old mapping. */
|
||||
rc = winUnmap(id);
|
||||
if( rc!=SQLITE_OK ) return rc;
|
||||
|
||||
/* And, if required, create a new mapping. */
|
||||
if( nNewRnd>0 ){
|
||||
i64 offset = ((iOff / winSysInfo.dwAllocationGranularity) *
|
||||
(winSysInfo.dwAllocationGranularity));
|
||||
if( nMap>pFd->mmapLimit ){
|
||||
nMap = pFd->mmapLimit;
|
||||
}
|
||||
nMap &= ~(sqlite3_int64)(winSysInfo.dwPageSize - 1);
|
||||
|
||||
if( nMap==0 && pFd->mmapSize>0 ){
|
||||
winUnmapfile(pFd);
|
||||
}
|
||||
if( nMap!=pFd->mmapSize ){
|
||||
void *pNew = 0;
|
||||
DWORD protect = PAGE_READONLY;
|
||||
DWORD flags = FILE_MAP_READ;
|
||||
if( (pFile->ctrlFlags & WINFILE_RDONLY)==0 ){
|
||||
|
||||
winUnmapfile(pFd);
|
||||
if( (pFd->ctrlFlags & WINFILE_RDONLY)==0 ){
|
||||
protect = PAGE_READWRITE;
|
||||
flags |= FILE_MAP_WRITE;
|
||||
}
|
||||
#if SQLITE_OS_WINRT
|
||||
hMap = osCreateFileMappingFromApp(pFile->h, NULL, protect, nNewRnd, NULL);
|
||||
pFd->hMap = osCreateFileMappingFromApp(pFd->h, NULL, protect, nMap, NULL);
|
||||
#elif defined(SQLITE_WIN32_HAS_WIDE)
|
||||
hMap = osCreateFileMappingW(pFile->h, NULL, protect,
|
||||
(DWORD)((nNewRnd>>32) & 0xffffffff),
|
||||
(DWORD)(nNewRnd & 0xffffffff), NULL);
|
||||
pFd->hMap = osCreateFileMappingW(pFd->h, NULL, protect,
|
||||
(DWORD)((nMap>>32) & 0xffffffff),
|
||||
(DWORD)(nMap & 0xffffffff), NULL);
|
||||
#elif defined(SQLITE_WIN32_HAS_ANSI)
|
||||
hMap = osCreateFileMappingA(pFile->h, NULL, protect,
|
||||
(DWORD)((nNewRnd>>32) & 0xffffffff),
|
||||
(DWORD)(nNewRnd & 0xffffffff), NULL);
|
||||
pFd->hMap = osCreateFileMappingA(pFd->h, NULL, protect,
|
||||
(DWORD)((nMap>>32) & 0xffffffff),
|
||||
(DWORD)(nMap & 0xffffffff), NULL);
|
||||
#endif
|
||||
if( hMap==NULL ){
|
||||
pFile->lastErrno = osGetLastError();
|
||||
rc = winLogError(SQLITE_IOERR_MREMAP, pFile->lastErrno,
|
||||
"winMremap1", pFile->zPath);
|
||||
return rc;
|
||||
if( pFd->hMap==NULL ){
|
||||
pFd->lastErrno = osGetLastError();
|
||||
rc = winLogError(SQLITE_IOERR_MMAP, pFd->lastErrno,
|
||||
"winMapfile", pFd->zPath);
|
||||
/* Log the error, but continue normal operation using xRead/xWrite */
|
||||
return SQLITE_OK;
|
||||
}
|
||||
assert( (nNewRnd % winSysInfo.dwPageSize)==0 );
|
||||
assert( (nMap % winSysInfo.dwPageSize)==0 );
|
||||
#if SQLITE_OS_WINRT
|
||||
pNew = osMapViewOfFileFromApp(hMap, flags, offset, nNewRnd);
|
||||
pNew = osMapViewOfFileFromApp(pFd->hMap, flags, 0, nMap);
|
||||
#else
|
||||
assert( sizeof(SIZE_T)==sizeof(sqlite3_int64) || nNewRnd<=0xffffffff );
|
||||
pNew = osMapViewOfFile(hMap, flags,
|
||||
(DWORD)((offset>>32) & 0xffffffff),
|
||||
(DWORD)(offset & 0xffffffff),
|
||||
(SIZE_T)nNewRnd);
|
||||
assert( sizeof(SIZE_T)==sizeof(sqlite3_int64) || nMap<=0xffffffff );
|
||||
pNew = osMapViewOfFile(pFd->hMap, flags, 0, 0, (SIZE_T)nMap);
|
||||
#endif
|
||||
if( pNew==NULL ){
|
||||
osCloseHandle(hMap);
|
||||
hMap = NULL;
|
||||
pFile->lastErrno = osGetLastError();
|
||||
rc = winLogError(SQLITE_IOERR_MREMAP, pFile->lastErrno,
|
||||
"winMremap2", pFile->zPath);
|
||||
osCloseHandle(pFd->hMap);
|
||||
pFd->hMap = NULL;
|
||||
pFd->lastErrno = osGetLastError();
|
||||
winLogError(SQLITE_IOERR_MMAP, pFd->lastErrno,
|
||||
"winMapfile", pFd->zPath);
|
||||
return SQLITE_OK;
|
||||
}
|
||||
pFd->pMapRegion = pNew;
|
||||
pFd->mmapSize = nMap;
|
||||
pFd->mmapOrigsize = nMap;
|
||||
}
|
||||
|
||||
pFile->hMap = hMap;
|
||||
pFile->pMapRegion = pNew;
|
||||
pFile->mmapSize = nNew;
|
||||
return SQLITE_OK;
|
||||
}
|
||||
#endif /* !defined(SQLITE_DISABLE_MMAP) */
|
||||
|
||||
*ppMap = pNew;
|
||||
return rc;
|
||||
/*
|
||||
** If possible, return a pointer to a mapping of file fd starting at offset
|
||||
** iOff. The mapping must be valid for at least nAmt bytes.
|
||||
**
|
||||
** If such a pointer can be obtained, store it in *pp and return SQLITE_OK.
|
||||
** Or, if one cannot but no error occurs, set *pp to 0 and return SQLITE_OK.
|
||||
** Finally, if an error does occur, return an SQLite error code. The final
|
||||
** value of *pp is undefined in this case.
|
||||
**
|
||||
** If this function does return a pointer, the caller must eventually
|
||||
** release the reference by calling unixUnfetch().
|
||||
*/
|
||||
static int winFetch(sqlite3_file *fd, i64 iOff, int nAmt, void **pp){
|
||||
#if !defined(SQLITE_DISABLE_MMAP)
|
||||
winFile *pFd = (winFile*)fd; /* The underlying database file */
|
||||
#endif
|
||||
*pp = 0;
|
||||
|
||||
#if !defined(SQLITE_DISABLE_MMAP)
|
||||
if( pFd->mmapLimit>0 ){
|
||||
if( pFd->pMapRegion==0 ){
|
||||
int rc = winMapfile(pFd, -1);
|
||||
if( rc!=SQLITE_OK ) return rc;
|
||||
}
|
||||
if( pFd->mmapSize >= iOff+nAmt ){
|
||||
*pp = &((u8 *)pFd->pMapRegion)[iOff];
|
||||
pFd->nFetchOut++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
** If the third argument is non-NULL, then this function releases a
|
||||
** reference obtained by an earlier call to unixFetch(). The second
|
||||
** argument passed to this function must be the same as the corresponding
|
||||
** argument that was passed to the unixFetch() invocation.
|
||||
**
|
||||
** Or, if the third argument is NULL, then this function is being called
|
||||
** to inform the VFS layer that, according to POSIX, any existing mapping
|
||||
** may now be invalid and should be unmapped.
|
||||
*/
|
||||
static int winUnfetch(sqlite3_file *fd, i64 iOff, void *p){
|
||||
#if !defined(SQLITE_DISABLE_MMAP)
|
||||
winFile *pFd = (winFile*)fd; /* The underlying database file */
|
||||
|
||||
/* If p==0 (unmap the entire file) then there must be no outstanding
|
||||
** xFetch references. Or, if p!=0 (meaning it is an xFetch reference),
|
||||
** then there must be at least one outstanding. */
|
||||
assert( (p==0)==(pFd->nFetchOut==0) );
|
||||
|
||||
/* If p!=0, it must match the iOff value. */
|
||||
assert( p==0 || p==&((u8 *)pFd->pMapRegion)[iOff] );
|
||||
|
||||
if( p ){
|
||||
pFd->nFetchOut--;
|
||||
}else{
|
||||
/* FIXME: If Windows truly always prevents truncating or deleting a
|
||||
** file while a mapping is held, then the following winUnmapfile() call
|
||||
** is unnecessary can can be omitted - potentially improving
|
||||
** performance. */
|
||||
winUnmapfile(pFd);
|
||||
}
|
||||
|
||||
assert( pFd->nFetchOut>=0 );
|
||||
#endif
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3654,7 +3738,8 @@ static const sqlite3_io_methods winIoMethod = {
|
||||
winShmLock, /* xShmLock */
|
||||
winShmBarrier, /* xShmBarrier */
|
||||
winShmUnmap, /* xShmUnmap */
|
||||
winMremap, /* xMremap */
|
||||
winFetch, /* xFetch */
|
||||
winUnfetch /* xUnfetch */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
@@ -4049,9 +4134,13 @@ static int winOpen(
|
||||
}
|
||||
pFile->lastErrno = NO_ERROR;
|
||||
pFile->zPath = zName;
|
||||
#if !defined(SQLITE_DISABLE_MMAP)
|
||||
pFile->hMap = NULL;
|
||||
pFile->pMapRegion = 0;
|
||||
pFile->mmapSize = 0;
|
||||
pFile->mmapOrigsize = 0;
|
||||
pFile->mmapLimit = sqlite3GlobalConfig.mxMmap;
|
||||
#endif
|
||||
|
||||
OpenCounter(+1);
|
||||
return rc;
|
||||
|
||||
+40
-23
@@ -659,7 +659,7 @@ struct Pager {
|
||||
u8 bUseFetch; /* True to use xFetch() */
|
||||
int nMmapOut; /* Number of mmap pages currently outstanding */
|
||||
sqlite3_int64 mxMmap; /* Desired maximum mmap size */
|
||||
PgHdr *pFree; /* List of free mmap page headers (pDirty) */
|
||||
PgHdr *pMmapFreelist; /* List of free mmap page headers (pDirty) */
|
||||
/*
|
||||
** End of the routinely-changing class members
|
||||
***************************************************************************/
|
||||
@@ -770,6 +770,16 @@ static const unsigned char aJournalMagic[] = {
|
||||
# define MEMDB pPager->memDb
|
||||
#endif
|
||||
|
||||
/*
|
||||
** The macro USEFETCH is true if we are allowed to use the xFetch and xUnfetch
|
||||
** interfaces to access the database using memory-mapped I/O.
|
||||
*/
|
||||
#ifdef SQLITE_DISABLE_MMAP
|
||||
# define USEFETCH(x) 0
|
||||
#else
|
||||
# define USEFETCH(x) ((x)->bUseFetch)
|
||||
#endif
|
||||
|
||||
/*
|
||||
** The maximum legal page number is (2^31 - 1).
|
||||
*/
|
||||
@@ -2648,6 +2658,7 @@ static int pager_playback(Pager *pPager, int isHot){
|
||||
int res = 1; /* Value returned by sqlite3OsAccess() */
|
||||
char *zMaster = 0; /* Name of master journal file if any */
|
||||
int needPagerReset; /* True to reset page prior to first page rollback */
|
||||
int nPlayback = 0; /* Total number of pages restored from journal */
|
||||
|
||||
/* Figure out how many records are in the journal. Abort early if
|
||||
** the journal is empty.
|
||||
@@ -2748,7 +2759,9 @@ static int pager_playback(Pager *pPager, int isHot){
|
||||
needPagerReset = 0;
|
||||
}
|
||||
rc = pager_playback_one_page(pPager,&pPager->journalOff,0,1,0);
|
||||
if( rc!=SQLITE_OK ){
|
||||
if( rc==SQLITE_OK ){
|
||||
nPlayback++;
|
||||
}else{
|
||||
if( rc==SQLITE_DONE ){
|
||||
pPager->journalOff = szJ;
|
||||
break;
|
||||
@@ -2818,6 +2831,10 @@ end_playback:
|
||||
rc = pager_delmaster(pPager, zMaster);
|
||||
testcase( rc!=SQLITE_OK );
|
||||
}
|
||||
if( isHot && nPlayback ){
|
||||
sqlite3_log(SQLITE_NOTICE_RECOVER_ROLLBACK, "recovered %d pages from %s",
|
||||
nPlayback, pPager->zJournal);
|
||||
}
|
||||
|
||||
/* The Pager.sectorSize variable may have been updated while rolling
|
||||
** back a journal created by a process with a different sector size
|
||||
@@ -2936,15 +2953,14 @@ static int pagerUndoCallback(void *pCtx, Pgno iPg){
|
||||
Pager *pPager = (Pager *)pCtx;
|
||||
PgHdr *pPg;
|
||||
|
||||
assert( pagerUseWal(pPager) );
|
||||
pPg = sqlite3PagerLookup(pPager, iPg);
|
||||
if( pPg ){
|
||||
if( sqlite3PcachePageRefcount(pPg)==1 ){
|
||||
sqlite3PcacheDrop(pPg);
|
||||
}else{
|
||||
u32 iFrame = 0;
|
||||
if( pagerUseWal(pPager) ){
|
||||
rc = sqlite3WalFindFrame(pPager->pWal, pPg->pgno, &iFrame);
|
||||
}
|
||||
rc = sqlite3WalFindFrame(pPager->pWal, pPg->pgno, &iFrame);
|
||||
if( rc==SQLITE_OK ){
|
||||
rc = readDbPage(pPg, iFrame);
|
||||
}
|
||||
@@ -3091,7 +3107,7 @@ static int pagerBeginReadTransaction(Pager *pPager){
|
||||
rc = sqlite3WalBeginReadTransaction(pPager->pWal, &changed);
|
||||
if( rc!=SQLITE_OK || changed ){
|
||||
pager_reset(pPager);
|
||||
if( pPager->bUseFetch ) sqlite3OsUnfetch(pPager->fd, 0, 0);
|
||||
if( USEFETCH(pPager) ) sqlite3OsUnfetch(pPager->fd, 0, 0);
|
||||
}
|
||||
|
||||
return rc;
|
||||
@@ -3357,12 +3373,15 @@ void sqlite3PagerSetCachesize(Pager *pPager, int mxPage){
|
||||
** Invoke SQLITE_FCNTL_MMAP_LIMIT based on the current value of mxMmap.
|
||||
*/
|
||||
static void pagerFixMaplimit(Pager *pPager){
|
||||
#if !defined(SQLITE_DISABLE_MMAP)
|
||||
sqlite3_file *fd = pPager->fd;
|
||||
if( isOpen(fd) ){
|
||||
sqlite3_int64 mx;
|
||||
pPager->bUseFetch = (fd->pMethods->iVersion>=3) && pPager->mxMmap>0;
|
||||
sqlite3OsFileControlHint(pPager->fd, SQLITE_FCNTL_MMAP_LIMIT,
|
||||
(void*)&pPager->mxMmap);
|
||||
mx = pPager->mxMmap;
|
||||
sqlite3OsFileControlHint(pPager->fd, SQLITE_FCNTL_MMAP_LIMIT, &mx);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3637,9 +3656,7 @@ int sqlite3PagerMaxPageCount(Pager *pPager, int mxPage){
|
||||
pPager->mxPgno = mxPage;
|
||||
}
|
||||
assert( pPager->eState!=PAGER_OPEN ); /* Called only by OP_MaxPgcnt */
|
||||
#if 0
|
||||
assert( pPager->mxPgno>=pPager->dbSize ); /* OP_MaxPgcnt enforces this */
|
||||
#endif
|
||||
return pPager->mxPgno;
|
||||
}
|
||||
|
||||
@@ -3854,9 +3871,9 @@ static int pagerAcquireMapPage(
|
||||
){
|
||||
PgHdr *p; /* Memory mapped page to return */
|
||||
|
||||
if( pPager->pFree ){
|
||||
*ppPage = p = pPager->pFree;
|
||||
pPager->pFree = p->pDirty;
|
||||
if( pPager->pMmapFreelist ){
|
||||
*ppPage = p = pPager->pMmapFreelist;
|
||||
pPager->pMmapFreelist = p->pDirty;
|
||||
p->pDirty = 0;
|
||||
memset(p->pExtra, 0, pPager->nExtra);
|
||||
}else{
|
||||
@@ -3891,20 +3908,20 @@ static int pagerAcquireMapPage(
|
||||
static void pagerReleaseMapPage(PgHdr *pPg){
|
||||
Pager *pPager = pPg->pPager;
|
||||
pPager->nMmapOut--;
|
||||
pPg->pDirty = pPager->pFree;
|
||||
pPager->pFree = pPg;
|
||||
pPg->pDirty = pPager->pMmapFreelist;
|
||||
pPager->pMmapFreelist = pPg;
|
||||
|
||||
assert( pPager->fd->pMethods->iVersion>=3 );
|
||||
sqlite3OsUnfetch(pPager->fd, (i64)(pPg->pgno-1)*pPager->pageSize, pPg->pData);
|
||||
}
|
||||
|
||||
/*
|
||||
** Free all PgHdr objects stored in the Pager.pFree list.
|
||||
** Free all PgHdr objects stored in the Pager.pMmapFreelist list.
|
||||
*/
|
||||
static void pagerFreeMapHdrs(Pager *pPager){
|
||||
PgHdr *p;
|
||||
PgHdr *pNext;
|
||||
for(p=pPager->pFree; p; p=pNext){
|
||||
for(p=pPager->pMmapFreelist; p; p=pNext){
|
||||
pNext = p->pDirty;
|
||||
sqlite3_free(p);
|
||||
}
|
||||
@@ -4749,7 +4766,7 @@ int sqlite3PagerOpen(
|
||||
/* pPager->pBusyHandlerArg = 0; */
|
||||
pPager->xReiniter = xReinit;
|
||||
/* memset(pPager->aHash, 0, sizeof(pPager->aHash)); */
|
||||
pPager->mxMmap = SQLITE_DEFAULT_MMAP_LIMIT;
|
||||
/* pPager->mxMmap = SQLITE_DEFAULT_MMAP_LIMIT // will be set by btree.c */
|
||||
|
||||
*ppPager = pPager;
|
||||
return SQLITE_OK;
|
||||
@@ -5044,7 +5061,7 @@ int sqlite3PagerSharedLock(Pager *pPager){
|
||||
if( !pPager->tempFile && (
|
||||
pPager->pBackup
|
||||
|| sqlite3PcachePagecount(pPager->pPCache)>0
|
||||
|| pPager->bUseFetch
|
||||
|| USEFETCH(pPager)
|
||||
)){
|
||||
/* The shared-lock has just been acquired on the database file
|
||||
** and there are already pages in the cache (from a previous
|
||||
@@ -5087,7 +5104,7 @@ int sqlite3PagerSharedLock(Pager *pPager){
|
||||
** In this case there may exist a Pager.pMap mapping that appears
|
||||
** to be the right size but is not actually valid. Avoid this
|
||||
** possibility by unmapping the db here. */
|
||||
if( pPager->bUseFetch ){
|
||||
if( USEFETCH(pPager) ){
|
||||
sqlite3OsUnfetch(pPager->fd, 0, 0);
|
||||
}
|
||||
}
|
||||
@@ -5131,7 +5148,7 @@ int sqlite3PagerSharedLock(Pager *pPager){
|
||||
** nothing to rollback, so this routine is a no-op.
|
||||
*/
|
||||
static void pagerUnlockIfUnused(Pager *pPager){
|
||||
if( (sqlite3PcacheRefCount(pPager->pPCache)==0) && pPager->nMmapOut==0 ){
|
||||
if( pPager->nMmapOut==0 && (sqlite3PcacheRefCount(pPager->pPCache)==0) ){
|
||||
pagerUnlockAndRollback(pPager);
|
||||
}
|
||||
}
|
||||
@@ -5201,7 +5218,7 @@ int sqlite3PagerAcquire(
|
||||
** page 1 if there is no write-transaction open or the ACQUIRE_READONLY
|
||||
** flag was specified by the caller. And so long as the db is not a
|
||||
** temporary or in-memory database. */
|
||||
const int bMmapOk = (pgno!=1 && pPager->bUseFetch
|
||||
const int bMmapOk = (pgno!=1 && USEFETCH(pPager)
|
||||
&& (pPager->eState==PAGER_READER || (flags & PAGER_ACQUIRE_READONLY))
|
||||
);
|
||||
|
||||
@@ -6264,7 +6281,7 @@ int sqlite3PagerRollback(Pager *pPager){
|
||||
}
|
||||
|
||||
assert( pPager->eState==PAGER_READER || rc!=SQLITE_OK );
|
||||
assert( rc==SQLITE_OK || rc==SQLITE_FULL
|
||||
assert( rc==SQLITE_OK || rc==SQLITE_FULL || rc==SQLITE_CORRUPT
|
||||
|| rc==SQLITE_NOMEM || (rc&0xFF)==SQLITE_IOERR );
|
||||
|
||||
/* If an error occurs during a ROLLBACK, we can no longer trust the pager
|
||||
|
||||
+24
-7
@@ -319,7 +319,7 @@ void sqlite3Pragma(
|
||||
int rc; /* return value form SQLITE_FCNTL_PRAGMA */
|
||||
sqlite3 *db = pParse->db; /* The database connection */
|
||||
Db *pDb; /* The specific database being pragmaed */
|
||||
Vdbe *v = pParse->pVdbe = sqlite3VdbeCreate(db); /* Prepared statement */
|
||||
Vdbe *v = sqlite3GetVdbe(pParse); /* Prepared statement */
|
||||
|
||||
if( v==0 ) return;
|
||||
sqlite3VdbeRunOnlyOnce(v);
|
||||
@@ -402,11 +402,12 @@ void sqlite3Pragma(
|
||||
static const VdbeOpList getCacheSize[] = {
|
||||
{ OP_Transaction, 0, 0, 0}, /* 0 */
|
||||
{ OP_ReadCookie, 0, 1, BTREE_DEFAULT_CACHE_SIZE}, /* 1 */
|
||||
{ OP_IfPos, 1, 7, 0},
|
||||
{ OP_IfPos, 1, 8, 0},
|
||||
{ OP_Integer, 0, 2, 0},
|
||||
{ OP_Subtract, 1, 2, 1},
|
||||
{ OP_IfPos, 1, 7, 0},
|
||||
{ OP_IfPos, 1, 8, 0},
|
||||
{ OP_Integer, 0, 1, 0}, /* 6 */
|
||||
{ OP_Noop, 0, 0, 0},
|
||||
{ OP_ResultRow, 1, 1, 0},
|
||||
};
|
||||
int addr;
|
||||
@@ -750,18 +751,34 @@ void sqlite3Pragma(
|
||||
** Used to set mapping size limit. The mapping size limit is
|
||||
** used to limit the aggregate size of all memory mapped regions of the
|
||||
** database file. If this parameter is set to zero, then memory mapping
|
||||
** is not used at all. The parameter N is measured in bytes.
|
||||
** is not used at all. If N is negative, then the default memory map
|
||||
** limit determined by sqlite3_config(SQLITE_CONFIG_MMAP_LIMIT) is set.
|
||||
** The parameter N is measured in bytes.
|
||||
**
|
||||
** This value is advisory. The underlying VFS is free to memory map
|
||||
** as little or as much as it wants. Except, if N is set to 0 then the
|
||||
** upper layers will never invoke the xFetch interfaces to the VFS.
|
||||
*/
|
||||
if( sqlite3StrICmp(zLeft,"mmap_limit")==0 ){
|
||||
sqlite3_int64 mx;
|
||||
assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
|
||||
if( zRight ){
|
||||
sqlite3_int64 size;
|
||||
sqlite3Atoi64(zRight, &size, 1000, SQLITE_UTF8);
|
||||
sqlite3BtreeSetMmapLimit(pDb->pBt, size);
|
||||
int ii;
|
||||
sqlite3Atoi64(zRight, &mx, 1000, SQLITE_UTF8);
|
||||
if( mx<0 ) mx = sqlite3GlobalConfig.mxMmap;
|
||||
if( pId2->n==0 ) db->mxMmap = mx;
|
||||
for(ii=db->nDb-1; ii>=0; ii--){
|
||||
if( db->aDb[ii].pBt && (ii==iDb || pId2->n==0) ){
|
||||
sqlite3BtreeSetMmapLimit(db->aDb[ii].pBt, mx);
|
||||
}
|
||||
}
|
||||
}
|
||||
mx = -1;
|
||||
if( sqlite3_file_control(db,zDb,SQLITE_FCNTL_MMAP_LIMIT,&mx)==SQLITE_OK ){
|
||||
#if defined(SQLITE_DISABLE_MMAP)
|
||||
mx = 0;
|
||||
#endif
|
||||
returnSingleInt(pParse, "mmap_limit", mx);
|
||||
}
|
||||
}else
|
||||
|
||||
|
||||
@@ -654,7 +654,6 @@ static int sqlite3Prepare(
|
||||
}
|
||||
#endif
|
||||
|
||||
assert( db->init.busy==0 || saveSqlFlag==0 );
|
||||
if( db->init.busy==0 ){
|
||||
Vdbe *pVdbe = pParse->pVdbe;
|
||||
sqlite3VdbeSetSql(pVdbe, zSql, (int)(pParse->zTail-zSql), saveSqlFlag);
|
||||
|
||||
+45
-8
@@ -1552,6 +1552,43 @@ static int booleanValue(char *zArg){
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** Interpret zArg as an integer value, possibly with suffixes.
|
||||
*/
|
||||
static sqlite3_int64 integerValue(const char *zArg){
|
||||
sqlite3_int64 v = 0;
|
||||
static const struct { char *zSuffix; int iMult; } aMult[] = {
|
||||
{ "KiB", 1024 },
|
||||
{ "MiB", 1024*1024 },
|
||||
{ "GiB", 1024*1024*1024 },
|
||||
{ "KB", 1000 },
|
||||
{ "MB", 1000000 },
|
||||
{ "GB", 1000000000 },
|
||||
{ "K", 1000 },
|
||||
{ "M", 1000000 },
|
||||
{ "G", 1000000000 },
|
||||
};
|
||||
int i;
|
||||
int isNeg = 0;
|
||||
if( zArg[0]=='-' ){
|
||||
isNeg = 1;
|
||||
zArg++;
|
||||
}else if( zArg[0]=='+' ){
|
||||
zArg++;
|
||||
}
|
||||
while( isdigit(zArg[0]) ){
|
||||
v = v*10 + zArg[0] - '0';
|
||||
zArg++;
|
||||
}
|
||||
for(i=0; i<sizeof(aMult)/sizeof(aMult[0]); i++){
|
||||
if( sqlite3_stricmp(aMult[i].zSuffix, zArg)==0 ){
|
||||
v *= aMult[i].iMult;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return isNeg? -v : v;
|
||||
}
|
||||
|
||||
/*
|
||||
** Close an output file, assuming it is not stderr or stdout
|
||||
*/
|
||||
@@ -2469,7 +2506,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
|
||||
/* sqlite3_test_control(int, uint) */
|
||||
case SQLITE_TESTCTRL_PENDING_BYTE:
|
||||
if( nArg==3 ){
|
||||
unsigned int opt = (unsigned int)atoi(azArg[2]);
|
||||
unsigned int opt = (unsigned int)integerValue(azArg[2]);
|
||||
rc = sqlite3_test_control(testctrl, opt);
|
||||
printf("%d (0x%08x)\n", rc, rc);
|
||||
} else {
|
||||
@@ -2561,7 +2598,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
|
||||
#if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_WHERETRACE)
|
||||
if( c=='w' && strncmp(azArg[0], "wheretrace", n)==0 ){
|
||||
extern int sqlite3WhereTrace;
|
||||
sqlite3WhereTrace = atoi(azArg[1]);
|
||||
sqlite3WhereTrace = booleanValue(azArg[1]);
|
||||
}else
|
||||
#endif
|
||||
|
||||
@@ -2882,6 +2919,7 @@ static const char zOptions[] =
|
||||
" -interactive force interactive I/O\n"
|
||||
" -line set output mode to 'line'\n"
|
||||
" -list set output mode to 'list'\n"
|
||||
" -mmap N default mmap size set to N\n"
|
||||
#ifdef SQLITE_ENABLE_MULTIPLEX
|
||||
" -multiplex enable the multiplexor VFS\n"
|
||||
#endif
|
||||
@@ -3001,12 +3039,7 @@ int main(int argc, char **argv){
|
||||
sqlite3_int64 szHeap;
|
||||
|
||||
zSize = cmdline_option_value(argc, argv, ++i);
|
||||
szHeap = atoi(zSize);
|
||||
for(j=0; (c = zSize[j])!=0; j++){
|
||||
if( c=='M' ){ szHeap *= 1000000; break; }
|
||||
if( c=='K' ){ szHeap *= 1000; break; }
|
||||
if( c=='G' ){ szHeap *= 1000000000; break; }
|
||||
}
|
||||
szHeap = integerValue(zSize);
|
||||
if( szHeap>0x7fff0000 ) szHeap = 0x7fff0000;
|
||||
sqlite3_config(SQLITE_CONFIG_HEAP, malloc((int)szHeap), (int)szHeap, 64);
|
||||
#endif
|
||||
@@ -3026,6 +3059,8 @@ int main(int argc, char **argv){
|
||||
extern int sqlite3_multiple_initialize(const char*,int);
|
||||
sqlite3_multiplex_initialize(0, 1);
|
||||
#endif
|
||||
}else if( strcmp(z,"-mmap")==0 ){
|
||||
sqlite3_config(SQLITE_CONFIG_MMAP_LIMIT, integerValue(cmdline_option_value(argc,argv,++i)));
|
||||
}else if( strcmp(z,"-vfs")==0 ){
|
||||
sqlite3_vfs *pVfs = sqlite3_vfs_find(cmdline_option_value(argc,argv,++i));
|
||||
if( pVfs ){
|
||||
@@ -3111,6 +3146,8 @@ int main(int argc, char **argv){
|
||||
stdin_is_interactive = 0;
|
||||
}else if( strcmp(z,"-heap")==0 ){
|
||||
i++;
|
||||
}else if( strcmp(z,"-mmap")==0 ){
|
||||
i++;
|
||||
}else if( strcmp(z,"-vfs")==0 ){
|
||||
i++;
|
||||
#ifdef SQLITE_ENABLE_VFSTRACE
|
||||
|
||||
+44
-4
@@ -420,6 +420,8 @@ int sqlite3_exec(
|
||||
#define SQLITE_FORMAT 24 /* Auxiliary database format error */
|
||||
#define SQLITE_RANGE 25 /* 2nd parameter to sqlite3_bind out of range */
|
||||
#define SQLITE_NOTADB 26 /* File opened that is not a database file */
|
||||
#define SQLITE_NOTICE 27 /* Notifications from sqlite3_log() */
|
||||
#define SQLITE_WARNING 28 /* Warnings from sqlite3_log() */
|
||||
#define SQLITE_ROW 100 /* sqlite3_step() has another row ready */
|
||||
#define SQLITE_DONE 101 /* sqlite3_step() has finished executing */
|
||||
/* end-of-error-codes */
|
||||
@@ -490,6 +492,8 @@ int sqlite3_exec(
|
||||
#define SQLITE_CONSTRAINT_TRIGGER (SQLITE_CONSTRAINT | (7<<8))
|
||||
#define SQLITE_CONSTRAINT_UNIQUE (SQLITE_CONSTRAINT | (8<<8))
|
||||
#define SQLITE_CONSTRAINT_VTAB (SQLITE_CONSTRAINT | (9<<8))
|
||||
#define SQLITE_NOTICE_RECOVER_WAL (SQLITE_NOTICE | (1<<8))
|
||||
#define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8))
|
||||
|
||||
/*
|
||||
** CAPI3REF: Flags For File Open Operations
|
||||
@@ -868,7 +872,8 @@ struct sqlite3_io_methods {
|
||||
** it is able to override built-in [PRAGMA] statements.
|
||||
**
|
||||
** <li>[[SQLITE_FCNTL_BUSYHANDLER]]
|
||||
** ^This file-control may be invoked by SQLite on the database file handle
|
||||
** ^The [SQLITE_FCNTL_BUSYHANDLER]
|
||||
** file-control may be invoked by SQLite on the database file handle
|
||||
** shortly after it is opened in order to provide a custom VFS with access
|
||||
** to the connections busy-handler callback. The argument is of type (void **)
|
||||
** - an array of two (void *) values. The first (void *) actually points
|
||||
@@ -879,7 +884,8 @@ struct sqlite3_io_methods {
|
||||
** current operation.
|
||||
**
|
||||
** <li>[[SQLITE_FCNTL_TEMPFILENAME]]
|
||||
** ^Application can invoke this file-control to have SQLite generate a
|
||||
** ^Application can invoke the [SQLITE_FCNTL_TEMPFILENAME] file-control
|
||||
** to have SQLite generate a
|
||||
** temporary filename using the same algorithm that is followed to generate
|
||||
** temporary filenames for TEMP tables and other internal uses. The
|
||||
** argument should be a char** which will be filled with the filename
|
||||
@@ -887,8 +893,14 @@ struct sqlite3_io_methods {
|
||||
** invoke [sqlite3_free()] on the result to avoid a memory leak.
|
||||
**
|
||||
** <li>[[SQLITE_FCNTL_MMAP_LIMIT]]
|
||||
** The argument is assumed to pointer to a value of type sqlite3_int64 that
|
||||
** is an advisory maximum number of bytes in the file to memory map.
|
||||
** The [SQLITE_FCNTL_MMAP_LIMIT] file control is used to query or set the
|
||||
** maximum number of bytes that will be used for memory-mapped I/O.
|
||||
** The argument is a pointer to a value of type sqlite3_int64 that
|
||||
** is an advisory maximum number of bytes in the file to memory map. The
|
||||
** pointer is overwritten with the old value. The limit is not changed if
|
||||
** the originally pointed to is negative, and so the current limit can be
|
||||
** queried by passing in a pointer to a negative number. This file-control
|
||||
** is used internally to implement [PRAGMA mmap_limit].
|
||||
**
|
||||
** </ul>
|
||||
*/
|
||||
@@ -1637,6 +1649,18 @@ struct sqlite3_mem_methods {
|
||||
** points to has just been executed. Or, if the fourth parameter is 2, then
|
||||
** the connection being passed as the second parameter is being closed. The
|
||||
** third parameter is passed NULL In this case.
|
||||
**
|
||||
** [[SQLITE_CONFIG_MMAP_LIMIT]]
|
||||
** <dt>SQLITE_CONFIG_MMAP_LIMIT
|
||||
** <dd>The sole argument should be a 64-bit integer (an sqlite3_int64) that
|
||||
** is the default maximum number of bytes of process address space that
|
||||
** should be used for accessing each database file using memory mapping.
|
||||
** The default setting can be overridden by each database connection using
|
||||
** either the [PRAGMA mmap_limit] command, or by using the
|
||||
** [SQLITE_FCNTL_MMAP_LIMIT] file control. The value set here overrides the
|
||||
** compile-time default that is set using [SQLITE_DEFAULT_MMAP_LIMIT].
|
||||
** If the argument to this option is negative, then
|
||||
** the memory map limit is set to the compile-time default.
|
||||
** </dl>
|
||||
*/
|
||||
#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
|
||||
@@ -1660,6 +1684,7 @@ struct sqlite3_mem_methods {
|
||||
#define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */
|
||||
#define SQLITE_CONFIG_COVERING_INDEX_SCAN 20 /* int */
|
||||
#define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */
|
||||
#define SQLITE_CONFIG_MMAP_LIMIT 22 /* sqlite3_int64 */
|
||||
|
||||
/*
|
||||
** CAPI3REF: Database Connection Configuration Options
|
||||
@@ -6816,6 +6841,21 @@ int sqlite3_unlock_notify(
|
||||
int sqlite3_stricmp(const char *, const char *);
|
||||
int sqlite3_strnicmp(const char *, const char *, int);
|
||||
|
||||
/*
|
||||
** CAPI3REF: String Globbing
|
||||
*
|
||||
** ^The [sqlite3_strglob(P,X)] interface returns zero if string X matches
|
||||
** the glob pattern P, and it returns non-zero if string X does not match
|
||||
** the glob pattern P. ^The definition of glob pattern matching used in
|
||||
** [sqlite3_strglob(P,X) is the same as for the "X GLOB P" operator in the
|
||||
** SQL dialect used by SQLite. ^The sqlite3_strglob(P,X) function is case
|
||||
** sensitive.
|
||||
**
|
||||
** Note that this routine returns zero on a match and non-zero if the strings
|
||||
** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()].
|
||||
*/
|
||||
int sqlite3_strglob(const char *zGlob, const char *zStr);
|
||||
|
||||
/*
|
||||
** CAPI3REF: Error Logging Interface
|
||||
**
|
||||
|
||||
@@ -539,6 +539,14 @@ extern const int sqlite3one;
|
||||
# define EIGHT_BYTE_ALIGNMENT(X) ((((char*)(X) - (char*)0)&7)==0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Disable MMAP on platforms where it is not supported
|
||||
*/
|
||||
#if defined(__OpenBSD__) || defined(__QNXNTO__)
|
||||
# undef SQLITE_DISABLE_MMAP
|
||||
# define SQLITE_DISABLE_MMAP 1
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
** An instance of the following structure is used to store the busy-handler
|
||||
@@ -834,6 +842,7 @@ struct sqlite3 {
|
||||
int nDb; /* Number of backends currently in use */
|
||||
int flags; /* Miscellaneous flags. See below */
|
||||
i64 lastRowid; /* ROWID of most recent insert (see above) */
|
||||
i64 mxMmap; /* Default mmap_limit setting */
|
||||
unsigned int openFlags; /* Flags passed to sqlite3_vfs.xOpen() */
|
||||
int errCode; /* Most recent error code (SQLITE_*) */
|
||||
int errMask; /* & result codes with this before returning */
|
||||
@@ -2505,6 +2514,7 @@ struct Sqlite3Config {
|
||||
void *pHeap; /* Heap storage space */
|
||||
int nHeap; /* Size of pHeap[] */
|
||||
int mnReq, mxReq; /* Min and max heap requests sizes */
|
||||
sqlite3_int64 mxMmap; /* Maximum mmap() space per open file */
|
||||
void *pScratch; /* Scratch memory */
|
||||
int szScratch; /* Size of each scratch buffer */
|
||||
int nScratch; /* Number of scratch buffers */
|
||||
|
||||
+19
-2
@@ -210,6 +210,23 @@
|
||||
/*
|
||||
** Default maximum size of memory used by xFetch in the VFS.
|
||||
*/
|
||||
#ifndef SQLITE_DEFAULT_MMAP_LIMIT
|
||||
# define SQLITE_DEFAULT_MMAP_LIMIT (256*1024*1024)
|
||||
#ifdef SQLITE_DISABLE_MMAP
|
||||
# undef SQLITE_DEFAULT_MMAP_LIMIT
|
||||
# define SQLITE_DEFAULT_MMAP_LIMIT 0
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
# include <TargetConditionals.h>
|
||||
# if TARGET_OS_IPHONE
|
||||
# define SQLITE_DEFAULT_MMAP_LIMIT 0
|
||||
# endif
|
||||
#endif
|
||||
#ifndef SQLITE_DEFAULT_MMAP_LIMIT
|
||||
# if defined(__linux__) \
|
||||
|| defined(_WIN32) \
|
||||
|| (defined(__APPLE__) && defined(__MACH__)) \
|
||||
|| defined(__sun)
|
||||
# define SQLITE_DEFAULT_MMAP_LIMIT 268435456 /* = 256*1024*1024 */
|
||||
# else
|
||||
# define SQLITE_DEFAULT_MMAP_LIMIT 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
+69
-64
@@ -116,71 +116,76 @@ int getDbPointer(Tcl_Interp *interp, const char *zA, sqlite3 **ppDb){
|
||||
|
||||
const char *sqlite3TestErrorName(int rc){
|
||||
const char *zName = 0;
|
||||
switch( rc ){
|
||||
case SQLITE_OK: zName = "SQLITE_OK"; break;
|
||||
case SQLITE_ERROR: zName = "SQLITE_ERROR"; break;
|
||||
case SQLITE_INTERNAL: zName = "SQLITE_INTERNAL"; break;
|
||||
case SQLITE_PERM: zName = "SQLITE_PERM"; break;
|
||||
case SQLITE_ABORT: zName = "SQLITE_ABORT"; break;
|
||||
case SQLITE_BUSY: zName = "SQLITE_BUSY"; break;
|
||||
case SQLITE_LOCKED: zName = "SQLITE_LOCKED"; break;
|
||||
case SQLITE_LOCKED_SHAREDCACHE: zName = "SQLITE_LOCKED_SHAREDCACHE";break;
|
||||
case SQLITE_NOMEM: zName = "SQLITE_NOMEM"; break;
|
||||
case SQLITE_READONLY: zName = "SQLITE_READONLY"; break;
|
||||
case SQLITE_INTERRUPT: zName = "SQLITE_INTERRUPT"; break;
|
||||
case SQLITE_IOERR: zName = "SQLITE_IOERR"; break;
|
||||
case SQLITE_CORRUPT: zName = "SQLITE_CORRUPT"; break;
|
||||
case SQLITE_NOTFOUND: zName = "SQLITE_NOTFOUND"; break;
|
||||
case SQLITE_FULL: zName = "SQLITE_FULL"; break;
|
||||
case SQLITE_CANTOPEN: zName = "SQLITE_CANTOPEN"; break;
|
||||
case SQLITE_PROTOCOL: zName = "SQLITE_PROTOCOL"; break;
|
||||
case SQLITE_EMPTY: zName = "SQLITE_EMPTY"; break;
|
||||
case SQLITE_SCHEMA: zName = "SQLITE_SCHEMA"; break;
|
||||
case SQLITE_TOOBIG: zName = "SQLITE_TOOBIG"; break;
|
||||
case SQLITE_CONSTRAINT: zName = "SQLITE_CONSTRAINT"; break;
|
||||
case SQLITE_CONSTRAINT_UNIQUE: zName = "SQLITE_CONSTRAINT_UNIQUE"; break;
|
||||
case SQLITE_CONSTRAINT_TRIGGER: zName = "SQLITE_CONSTRAINT_TRIGGER";break;
|
||||
case SQLITE_CONSTRAINT_FOREIGNKEY:
|
||||
zName = "SQLITE_CONSTRAINT_FOREIGNKEY"; break;
|
||||
case SQLITE_CONSTRAINT_CHECK: zName = "SQLITE_CONSTRAINT_CHECK"; break;
|
||||
case SQLITE_CONSTRAINT_PRIMARYKEY:
|
||||
zName = "SQLITE_CONSTRAINT_PRIMARYKEY"; break;
|
||||
case SQLITE_CONSTRAINT_NOTNULL: zName = "SQLITE_CONSTRAINT_NOTNULL";break;
|
||||
case SQLITE_CONSTRAINT_COMMITHOOK:
|
||||
zName = "SQLITE_CONSTRAINT_COMMITHOOK"; break;
|
||||
case SQLITE_CONSTRAINT_VTAB: zName = "SQLITE_CONSTRAINT_VTAB"; break;
|
||||
case SQLITE_CONSTRAINT_FUNCTION: zName = "SQLITE_CONSTRAINT_FUNCTION";break;
|
||||
case SQLITE_MISMATCH: zName = "SQLITE_MISMATCH"; break;
|
||||
case SQLITE_MISUSE: zName = "SQLITE_MISUSE"; break;
|
||||
case SQLITE_NOLFS: zName = "SQLITE_NOLFS"; break;
|
||||
case SQLITE_AUTH: zName = "SQLITE_AUTH"; break;
|
||||
case SQLITE_FORMAT: zName = "SQLITE_FORMAT"; break;
|
||||
case SQLITE_RANGE: zName = "SQLITE_RANGE"; break;
|
||||
case SQLITE_NOTADB: zName = "SQLITE_NOTADB"; break;
|
||||
case SQLITE_ROW: zName = "SQLITE_ROW"; break;
|
||||
case SQLITE_DONE: zName = "SQLITE_DONE"; break;
|
||||
case SQLITE_IOERR_READ: zName = "SQLITE_IOERR_READ"; break;
|
||||
case SQLITE_IOERR_SHORT_READ: zName = "SQLITE_IOERR_SHORT_READ"; break;
|
||||
case SQLITE_IOERR_WRITE: zName = "SQLITE_IOERR_WRITE"; break;
|
||||
case SQLITE_IOERR_FSYNC: zName = "SQLITE_IOERR_FSYNC"; break;
|
||||
case SQLITE_IOERR_DIR_FSYNC: zName = "SQLITE_IOERR_DIR_FSYNC"; break;
|
||||
case SQLITE_IOERR_TRUNCATE: zName = "SQLITE_IOERR_TRUNCATE"; break;
|
||||
case SQLITE_IOERR_FSTAT: zName = "SQLITE_IOERR_FSTAT"; break;
|
||||
case SQLITE_IOERR_UNLOCK: zName = "SQLITE_IOERR_UNLOCK"; break;
|
||||
case SQLITE_IOERR_RDLOCK: zName = "SQLITE_IOERR_RDLOCK"; break;
|
||||
case SQLITE_IOERR_DELETE: zName = "SQLITE_IOERR_DELETE"; break;
|
||||
case SQLITE_IOERR_BLOCKED: zName = "SQLITE_IOERR_BLOCKED"; break;
|
||||
case SQLITE_IOERR_NOMEM: zName = "SQLITE_IOERR_NOMEM"; break;
|
||||
case SQLITE_IOERR_ACCESS: zName = "SQLITE_IOERR_ACCESS"; break;
|
||||
case SQLITE_IOERR_CHECKRESERVEDLOCK:
|
||||
zName = "SQLITE_IOERR_CHECKRESERVEDLOCK"; break;
|
||||
case SQLITE_IOERR_LOCK: zName = "SQLITE_IOERR_LOCK"; break;
|
||||
case SQLITE_CORRUPT_VTAB: zName = "SQLITE_CORRUPT_VTAB"; break;
|
||||
case SQLITE_READONLY_RECOVERY: zName = "SQLITE_READONLY_RECOVERY"; break;
|
||||
case SQLITE_READONLY_CANTLOCK: zName = "SQLITE_READONLY_CANTLOCK"; break;
|
||||
case SQLITE_READONLY_ROLLBACK: zName = "SQLITE_READONLY_ROLLBACK"; break;
|
||||
default: zName = "SQLITE_Unknown"; break;
|
||||
int i;
|
||||
for(i=0; i<2 && zName==0; i++, rc &= 0xff){
|
||||
switch( rc ){
|
||||
case SQLITE_OK: zName = "SQLITE_OK"; break;
|
||||
case SQLITE_ERROR: zName = "SQLITE_ERROR"; break;
|
||||
case SQLITE_INTERNAL: zName = "SQLITE_INTERNAL"; break;
|
||||
case SQLITE_PERM: zName = "SQLITE_PERM"; break;
|
||||
case SQLITE_ABORT: zName = "SQLITE_ABORT"; break;
|
||||
case SQLITE_BUSY: zName = "SQLITE_BUSY"; break;
|
||||
case SQLITE_LOCKED: zName = "SQLITE_LOCKED"; break;
|
||||
case SQLITE_LOCKED_SHAREDCACHE: zName = "SQLITE_LOCKED_SHAREDCACHE";break;
|
||||
case SQLITE_NOMEM: zName = "SQLITE_NOMEM"; break;
|
||||
case SQLITE_READONLY: zName = "SQLITE_READONLY"; break;
|
||||
case SQLITE_INTERRUPT: zName = "SQLITE_INTERRUPT"; break;
|
||||
case SQLITE_IOERR: zName = "SQLITE_IOERR"; break;
|
||||
case SQLITE_CORRUPT: zName = "SQLITE_CORRUPT"; break;
|
||||
case SQLITE_NOTFOUND: zName = "SQLITE_NOTFOUND"; break;
|
||||
case SQLITE_FULL: zName = "SQLITE_FULL"; break;
|
||||
case SQLITE_CANTOPEN: zName = "SQLITE_CANTOPEN"; break;
|
||||
case SQLITE_PROTOCOL: zName = "SQLITE_PROTOCOL"; break;
|
||||
case SQLITE_EMPTY: zName = "SQLITE_EMPTY"; break;
|
||||
case SQLITE_SCHEMA: zName = "SQLITE_SCHEMA"; break;
|
||||
case SQLITE_TOOBIG: zName = "SQLITE_TOOBIG"; break;
|
||||
case SQLITE_CONSTRAINT: zName = "SQLITE_CONSTRAINT"; break;
|
||||
case SQLITE_CONSTRAINT_UNIQUE: zName = "SQLITE_CONSTRAINT_UNIQUE"; break;
|
||||
case SQLITE_CONSTRAINT_TRIGGER: zName = "SQLITE_CONSTRAINT_TRIGGER";break;
|
||||
case SQLITE_CONSTRAINT_FOREIGNKEY:
|
||||
zName = "SQLITE_CONSTRAINT_FOREIGNKEY"; break;
|
||||
case SQLITE_CONSTRAINT_CHECK: zName = "SQLITE_CONSTRAINT_CHECK"; break;
|
||||
case SQLITE_CONSTRAINT_PRIMARYKEY:
|
||||
zName = "SQLITE_CONSTRAINT_PRIMARYKEY"; break;
|
||||
case SQLITE_CONSTRAINT_NOTNULL: zName = "SQLITE_CONSTRAINT_NOTNULL";break;
|
||||
case SQLITE_CONSTRAINT_COMMITHOOK:
|
||||
zName = "SQLITE_CONSTRAINT_COMMITHOOK"; break;
|
||||
case SQLITE_CONSTRAINT_VTAB: zName = "SQLITE_CONSTRAINT_VTAB"; break;
|
||||
case SQLITE_CONSTRAINT_FUNCTION: zName = "SQLITE_CONSTRAINT_FUNCTION";break;
|
||||
case SQLITE_MISMATCH: zName = "SQLITE_MISMATCH"; break;
|
||||
case SQLITE_MISUSE: zName = "SQLITE_MISUSE"; break;
|
||||
case SQLITE_NOLFS: zName = "SQLITE_NOLFS"; break;
|
||||
case SQLITE_AUTH: zName = "SQLITE_AUTH"; break;
|
||||
case SQLITE_FORMAT: zName = "SQLITE_FORMAT"; break;
|
||||
case SQLITE_RANGE: zName = "SQLITE_RANGE"; break;
|
||||
case SQLITE_NOTADB: zName = "SQLITE_NOTADB"; break;
|
||||
case SQLITE_ROW: zName = "SQLITE_ROW"; break;
|
||||
case SQLITE_NOTICE: zName = "SQLITE_NOTICE"; break;
|
||||
case SQLITE_WARNING: zName = "SQLITE_WARNING"; break;
|
||||
case SQLITE_DONE: zName = "SQLITE_DONE"; break;
|
||||
case SQLITE_IOERR_READ: zName = "SQLITE_IOERR_READ"; break;
|
||||
case SQLITE_IOERR_SHORT_READ: zName = "SQLITE_IOERR_SHORT_READ"; break;
|
||||
case SQLITE_IOERR_WRITE: zName = "SQLITE_IOERR_WRITE"; break;
|
||||
case SQLITE_IOERR_FSYNC: zName = "SQLITE_IOERR_FSYNC"; break;
|
||||
case SQLITE_IOERR_DIR_FSYNC: zName = "SQLITE_IOERR_DIR_FSYNC"; break;
|
||||
case SQLITE_IOERR_TRUNCATE: zName = "SQLITE_IOERR_TRUNCATE"; break;
|
||||
case SQLITE_IOERR_FSTAT: zName = "SQLITE_IOERR_FSTAT"; break;
|
||||
case SQLITE_IOERR_UNLOCK: zName = "SQLITE_IOERR_UNLOCK"; break;
|
||||
case SQLITE_IOERR_RDLOCK: zName = "SQLITE_IOERR_RDLOCK"; break;
|
||||
case SQLITE_IOERR_DELETE: zName = "SQLITE_IOERR_DELETE"; break;
|
||||
case SQLITE_IOERR_BLOCKED: zName = "SQLITE_IOERR_BLOCKED"; break;
|
||||
case SQLITE_IOERR_NOMEM: zName = "SQLITE_IOERR_NOMEM"; break;
|
||||
case SQLITE_IOERR_ACCESS: zName = "SQLITE_IOERR_ACCESS"; break;
|
||||
case SQLITE_IOERR_CHECKRESERVEDLOCK:
|
||||
zName = "SQLITE_IOERR_CHECKRESERVEDLOCK"; break;
|
||||
case SQLITE_IOERR_LOCK: zName = "SQLITE_IOERR_LOCK"; break;
|
||||
case SQLITE_CORRUPT_VTAB: zName = "SQLITE_CORRUPT_VTAB"; break;
|
||||
case SQLITE_READONLY_RECOVERY: zName = "SQLITE_READONLY_RECOVERY"; break;
|
||||
case SQLITE_READONLY_CANTLOCK: zName = "SQLITE_READONLY_CANTLOCK"; break;
|
||||
case SQLITE_READONLY_ROLLBACK: zName = "SQLITE_READONLY_ROLLBACK"; break;
|
||||
}
|
||||
}
|
||||
if( zName==0 ) zName = "SQLITE_Unknown";
|
||||
return zName;
|
||||
}
|
||||
#define t1ErrorName sqlite3TestErrorName
|
||||
|
||||
+13
-41
@@ -19,35 +19,7 @@
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
/*
|
||||
** Interpret an SQLite error number
|
||||
*/
|
||||
static char *errorName(int rc){
|
||||
char *zName;
|
||||
switch( rc ){
|
||||
case SQLITE_OK: zName = "SQLITE_OK"; break;
|
||||
case SQLITE_ERROR: zName = "SQLITE_ERROR"; break;
|
||||
case SQLITE_PERM: zName = "SQLITE_PERM"; break;
|
||||
case SQLITE_ABORT: zName = "SQLITE_ABORT"; break;
|
||||
case SQLITE_BUSY: zName = "SQLITE_BUSY"; break;
|
||||
case SQLITE_NOMEM: zName = "SQLITE_NOMEM"; break;
|
||||
case SQLITE_READONLY: zName = "SQLITE_READONLY"; break;
|
||||
case SQLITE_INTERRUPT: zName = "SQLITE_INTERRUPT"; break;
|
||||
case SQLITE_IOERR: zName = "SQLITE_IOERR"; break;
|
||||
case SQLITE_CORRUPT: zName = "SQLITE_CORRUPT"; break;
|
||||
case SQLITE_FULL: zName = "SQLITE_FULL"; break;
|
||||
case SQLITE_CANTOPEN: zName = "SQLITE_CANTOPEN"; break;
|
||||
case SQLITE_PROTOCOL: zName = "SQLITE_PROTOCOL"; break;
|
||||
case SQLITE_EMPTY: zName = "SQLITE_EMPTY"; break;
|
||||
case SQLITE_SCHEMA: zName = "SQLITE_SCHEMA"; break;
|
||||
case SQLITE_CONSTRAINT: zName = "SQLITE_CONSTRAINT"; break;
|
||||
case SQLITE_MISMATCH: zName = "SQLITE_MISMATCH"; break;
|
||||
case SQLITE_MISUSE: zName = "SQLITE_MISUSE"; break;
|
||||
case SQLITE_NOLFS: zName = "SQLITE_NOLFS"; break;
|
||||
default: zName = "SQLITE_Unknown"; break;
|
||||
}
|
||||
return zName;
|
||||
}
|
||||
extern const char *sqlite3TestErrorName(int rc);
|
||||
|
||||
/*
|
||||
** Page size and reserved size used for testing.
|
||||
@@ -87,7 +59,7 @@ static int pager_open(
|
||||
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_MAIN_DB,
|
||||
pager_test_reiniter);
|
||||
if( rc!=SQLITE_OK ){
|
||||
Tcl_AppendResult(interp, errorName(rc), 0);
|
||||
Tcl_AppendResult(interp, sqlite3TestErrorName(rc), 0);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
sqlite3PagerSetCachesize(pPager, nPage);
|
||||
@@ -119,7 +91,7 @@ static int pager_close(
|
||||
pPager = sqlite3TestTextToPtr(argv[1]);
|
||||
rc = sqlite3PagerClose(pPager);
|
||||
if( rc!=SQLITE_OK ){
|
||||
Tcl_AppendResult(interp, errorName(rc), 0);
|
||||
Tcl_AppendResult(interp, sqlite3TestErrorName(rc), 0);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
return TCL_OK;
|
||||
@@ -146,7 +118,7 @@ static int pager_rollback(
|
||||
pPager = sqlite3TestTextToPtr(argv[1]);
|
||||
rc = sqlite3PagerRollback(pPager);
|
||||
if( rc!=SQLITE_OK ){
|
||||
Tcl_AppendResult(interp, errorName(rc), 0);
|
||||
Tcl_AppendResult(interp, sqlite3TestErrorName(rc), 0);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
return TCL_OK;
|
||||
@@ -173,12 +145,12 @@ static int pager_commit(
|
||||
pPager = sqlite3TestTextToPtr(argv[1]);
|
||||
rc = sqlite3PagerCommitPhaseOne(pPager, 0, 0);
|
||||
if( rc!=SQLITE_OK ){
|
||||
Tcl_AppendResult(interp, errorName(rc), 0);
|
||||
Tcl_AppendResult(interp, sqlite3TestErrorName(rc), 0);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
rc = sqlite3PagerCommitPhaseTwo(pPager);
|
||||
if( rc!=SQLITE_OK ){
|
||||
Tcl_AppendResult(interp, errorName(rc), 0);
|
||||
Tcl_AppendResult(interp, sqlite3TestErrorName(rc), 0);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
return TCL_OK;
|
||||
@@ -205,7 +177,7 @@ static int pager_stmt_begin(
|
||||
pPager = sqlite3TestTextToPtr(argv[1]);
|
||||
rc = sqlite3PagerOpenSavepoint(pPager, 1);
|
||||
if( rc!=SQLITE_OK ){
|
||||
Tcl_AppendResult(interp, errorName(rc), 0);
|
||||
Tcl_AppendResult(interp, sqlite3TestErrorName(rc), 0);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
return TCL_OK;
|
||||
@@ -233,7 +205,7 @@ static int pager_stmt_rollback(
|
||||
rc = sqlite3PagerSavepoint(pPager, SAVEPOINT_ROLLBACK, 0);
|
||||
sqlite3PagerSavepoint(pPager, SAVEPOINT_RELEASE, 0);
|
||||
if( rc!=SQLITE_OK ){
|
||||
Tcl_AppendResult(interp, errorName(rc), 0);
|
||||
Tcl_AppendResult(interp, sqlite3TestErrorName(rc), 0);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
return TCL_OK;
|
||||
@@ -260,7 +232,7 @@ static int pager_stmt_commit(
|
||||
pPager = sqlite3TestTextToPtr(argv[1]);
|
||||
rc = sqlite3PagerSavepoint(pPager, SAVEPOINT_RELEASE, 0);
|
||||
if( rc!=SQLITE_OK ){
|
||||
Tcl_AppendResult(interp, errorName(rc), 0);
|
||||
Tcl_AppendResult(interp, sqlite3TestErrorName(rc), 0);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
return TCL_OK;
|
||||
@@ -353,7 +325,7 @@ static int page_get(
|
||||
rc = sqlite3PagerGet(pPager, pgno, &pPage);
|
||||
}
|
||||
if( rc!=SQLITE_OK ){
|
||||
Tcl_AppendResult(interp, errorName(rc), 0);
|
||||
Tcl_AppendResult(interp, sqlite3TestErrorName(rc), 0);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
sqlite3_snprintf(sizeof(zBuf),zBuf,"%p",pPage);
|
||||
@@ -507,7 +479,7 @@ static int page_write(
|
||||
pPage = (DbPage *)sqlite3TestTextToPtr(argv[1]);
|
||||
rc = sqlite3PagerWrite(pPage);
|
||||
if( rc!=SQLITE_OK ){
|
||||
Tcl_AppendResult(interp, errorName(rc), 0);
|
||||
Tcl_AppendResult(interp, sqlite3TestErrorName(rc), 0);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
pData = sqlite3PagerGetData(pPage);
|
||||
@@ -556,7 +528,7 @@ static int fake_big_file(
|
||||
(SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE|SQLITE_OPEN_MAIN_DB), 0
|
||||
);
|
||||
if( rc ){
|
||||
Tcl_AppendResult(interp, "open failed: ", errorName(rc), 0);
|
||||
Tcl_AppendResult(interp, "open failed: ", sqlite3TestErrorName(rc), 0);
|
||||
sqlite3_free(zFile);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -566,7 +538,7 @@ static int fake_big_file(
|
||||
sqlite3OsCloseFree(fd);
|
||||
sqlite3_free(zFile);
|
||||
if( rc ){
|
||||
Tcl_AppendResult(interp, "write failed: ", errorName(rc), 0);
|
||||
Tcl_AppendResult(interp, "write failed: ", sqlite3TestErrorName(rc), 0);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
return TCL_OK;
|
||||
|
||||
+8
-32
@@ -19,31 +19,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
** Interpret an SQLite error number
|
||||
*/
|
||||
static char *errorName(int rc){
|
||||
char *zName;
|
||||
switch( rc ){
|
||||
case SQLITE_OK: zName = "SQLITE_OK"; break;
|
||||
case SQLITE_ERROR: zName = "SQLITE_ERROR"; break;
|
||||
case SQLITE_PERM: zName = "SQLITE_PERM"; break;
|
||||
case SQLITE_ABORT: zName = "SQLITE_ABORT"; break;
|
||||
case SQLITE_BUSY: zName = "SQLITE_BUSY"; break;
|
||||
case SQLITE_NOMEM: zName = "SQLITE_NOMEM"; break;
|
||||
case SQLITE_READONLY: zName = "SQLITE_READONLY"; break;
|
||||
case SQLITE_INTERRUPT: zName = "SQLITE_INTERRUPT"; break;
|
||||
case SQLITE_IOERR: zName = "SQLITE_IOERR"; break;
|
||||
case SQLITE_CORRUPT: zName = "SQLITE_CORRUPT"; break;
|
||||
case SQLITE_FULL: zName = "SQLITE_FULL"; break;
|
||||
case SQLITE_CANTOPEN: zName = "SQLITE_CANTOPEN"; break;
|
||||
case SQLITE_PROTOCOL: zName = "SQLITE_PROTOCOL"; break;
|
||||
case SQLITE_EMPTY: zName = "SQLITE_EMPTY"; break;
|
||||
case SQLITE_LOCKED: zName = "SQLITE_LOCKED"; break;
|
||||
default: zName = "SQLITE_Unknown"; break;
|
||||
}
|
||||
return zName;
|
||||
}
|
||||
extern const char *sqlite3TestErrorName(int rc);
|
||||
|
||||
/*
|
||||
** A bogus sqlite3 connection structure for use in the btree
|
||||
@@ -89,7 +65,7 @@ static int btree_open(
|
||||
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_MAIN_DB);
|
||||
sqlite3_free(zFilename);
|
||||
if( rc!=SQLITE_OK ){
|
||||
Tcl_AppendResult(interp, errorName(rc), 0);
|
||||
Tcl_AppendResult(interp, sqlite3TestErrorName(rc), 0);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
sqlite3BtreeSetCacheSize(pBt, nCache);
|
||||
@@ -119,7 +95,7 @@ static int btree_close(
|
||||
pBt = sqlite3TestTextToPtr(argv[1]);
|
||||
rc = sqlite3BtreeClose(pBt);
|
||||
if( rc!=SQLITE_OK ){
|
||||
Tcl_AppendResult(interp, errorName(rc), 0);
|
||||
Tcl_AppendResult(interp, sqlite3TestErrorName(rc), 0);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
nRefSqlite3--;
|
||||
@@ -156,7 +132,7 @@ static int btree_begin_transaction(
|
||||
rc = sqlite3BtreeBeginTrans(pBt, 1);
|
||||
sqlite3BtreeLeave(pBt);
|
||||
if( rc!=SQLITE_OK ){
|
||||
Tcl_AppendResult(interp, errorName(rc), 0);
|
||||
Tcl_AppendResult(interp, sqlite3TestErrorName(rc), 0);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
return TCL_OK;
|
||||
@@ -250,7 +226,7 @@ static int btree_cursor(
|
||||
sqlite3BtreeLeave(pBt);
|
||||
if( rc ){
|
||||
ckfree((char *)pCur);
|
||||
Tcl_AppendResult(interp, errorName(rc), 0);
|
||||
Tcl_AppendResult(interp, sqlite3TestErrorName(rc), 0);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
sqlite3_snprintf(sizeof(zBuf), zBuf,"%p", pCur);
|
||||
@@ -285,7 +261,7 @@ static int btree_close_cursor(
|
||||
sqlite3BtreeLeave(pBt);
|
||||
ckfree((char *)pCur);
|
||||
if( rc ){
|
||||
Tcl_AppendResult(interp, errorName(rc), 0);
|
||||
Tcl_AppendResult(interp, sqlite3TestErrorName(rc), 0);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
return SQLITE_OK;
|
||||
@@ -319,7 +295,7 @@ static int btree_next(
|
||||
rc = sqlite3BtreeNext(pCur, &res);
|
||||
sqlite3BtreeLeave(pCur->pBtree);
|
||||
if( rc ){
|
||||
Tcl_AppendResult(interp, errorName(rc), 0);
|
||||
Tcl_AppendResult(interp, sqlite3TestErrorName(rc), 0);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
sqlite3_snprintf(sizeof(zBuf),zBuf,"%d",res);
|
||||
@@ -354,7 +330,7 @@ static int btree_first(
|
||||
rc = sqlite3BtreeFirst(pCur, &res);
|
||||
sqlite3BtreeLeave(pCur->pBtree);
|
||||
if( rc ){
|
||||
Tcl_AppendResult(interp, errorName(rc), 0);
|
||||
Tcl_AppendResult(interp, sqlite3TestErrorName(rc), 0);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
sqlite3_snprintf(sizeof(zBuf),zBuf,"%d",res);
|
||||
|
||||
+3
-28
@@ -20,6 +20,8 @@
|
||||
#include <sched.h>
|
||||
#include <ctype.h>
|
||||
|
||||
extern const char *sqlite3TestErrorName(int rc);
|
||||
|
||||
/*
|
||||
** Each thread is controlled by an instance of the following
|
||||
** structure.
|
||||
@@ -372,34 +374,7 @@ static int tcl_thread_result(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
thread_wait(&threadset[i]);
|
||||
switch( threadset[i].rc ){
|
||||
case SQLITE_OK: zName = "SQLITE_OK"; break;
|
||||
case SQLITE_ERROR: zName = "SQLITE_ERROR"; break;
|
||||
case SQLITE_PERM: zName = "SQLITE_PERM"; break;
|
||||
case SQLITE_ABORT: zName = "SQLITE_ABORT"; break;
|
||||
case SQLITE_BUSY: zName = "SQLITE_BUSY"; break;
|
||||
case SQLITE_LOCKED: zName = "SQLITE_LOCKED"; break;
|
||||
case SQLITE_NOMEM: zName = "SQLITE_NOMEM"; break;
|
||||
case SQLITE_READONLY: zName = "SQLITE_READONLY"; break;
|
||||
case SQLITE_INTERRUPT: zName = "SQLITE_INTERRUPT"; break;
|
||||
case SQLITE_IOERR: zName = "SQLITE_IOERR"; break;
|
||||
case SQLITE_CORRUPT: zName = "SQLITE_CORRUPT"; break;
|
||||
case SQLITE_FULL: zName = "SQLITE_FULL"; break;
|
||||
case SQLITE_CANTOPEN: zName = "SQLITE_CANTOPEN"; break;
|
||||
case SQLITE_PROTOCOL: zName = "SQLITE_PROTOCOL"; break;
|
||||
case SQLITE_EMPTY: zName = "SQLITE_EMPTY"; break;
|
||||
case SQLITE_SCHEMA: zName = "SQLITE_SCHEMA"; break;
|
||||
case SQLITE_CONSTRAINT: zName = "SQLITE_CONSTRAINT"; break;
|
||||
case SQLITE_MISMATCH: zName = "SQLITE_MISMATCH"; break;
|
||||
case SQLITE_MISUSE: zName = "SQLITE_MISUSE"; break;
|
||||
case SQLITE_NOLFS: zName = "SQLITE_NOLFS"; break;
|
||||
case SQLITE_AUTH: zName = "SQLITE_AUTH"; break;
|
||||
case SQLITE_FORMAT: zName = "SQLITE_FORMAT"; break;
|
||||
case SQLITE_RANGE: zName = "SQLITE_RANGE"; break;
|
||||
case SQLITE_ROW: zName = "SQLITE_ROW"; break;
|
||||
case SQLITE_DONE: zName = "SQLITE_DONE"; break;
|
||||
default: zName = "SQLITE_Unknown"; break;
|
||||
}
|
||||
zName = sqlite3TestErrorName(threadset[i].rc);
|
||||
Tcl_AppendResult(interp, zName, 0);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
+3
-28
@@ -376,6 +376,8 @@ static int tcl_client_colname(
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
extern const char *sqlite3TestErrorName(int rc);
|
||||
|
||||
/*
|
||||
** Usage: client_result ID
|
||||
**
|
||||
@@ -403,34 +405,7 @@ static int tcl_client_result(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
client_wait(&threadset[i]);
|
||||
switch( threadset[i].rc ){
|
||||
case SQLITE_OK: zName = "SQLITE_OK"; break;
|
||||
case SQLITE_ERROR: zName = "SQLITE_ERROR"; break;
|
||||
case SQLITE_PERM: zName = "SQLITE_PERM"; break;
|
||||
case SQLITE_ABORT: zName = "SQLITE_ABORT"; break;
|
||||
case SQLITE_BUSY: zName = "SQLITE_BUSY"; break;
|
||||
case SQLITE_LOCKED: zName = "SQLITE_LOCKED"; break;
|
||||
case SQLITE_NOMEM: zName = "SQLITE_NOMEM"; break;
|
||||
case SQLITE_READONLY: zName = "SQLITE_READONLY"; break;
|
||||
case SQLITE_INTERRUPT: zName = "SQLITE_INTERRUPT"; break;
|
||||
case SQLITE_IOERR: zName = "SQLITE_IOERR"; break;
|
||||
case SQLITE_CORRUPT: zName = "SQLITE_CORRUPT"; break;
|
||||
case SQLITE_FULL: zName = "SQLITE_FULL"; break;
|
||||
case SQLITE_CANTOPEN: zName = "SQLITE_CANTOPEN"; break;
|
||||
case SQLITE_PROTOCOL: zName = "SQLITE_PROTOCOL"; break;
|
||||
case SQLITE_EMPTY: zName = "SQLITE_EMPTY"; break;
|
||||
case SQLITE_SCHEMA: zName = "SQLITE_SCHEMA"; break;
|
||||
case SQLITE_CONSTRAINT: zName = "SQLITE_CONSTRAINT"; break;
|
||||
case SQLITE_MISMATCH: zName = "SQLITE_MISMATCH"; break;
|
||||
case SQLITE_MISUSE: zName = "SQLITE_MISUSE"; break;
|
||||
case SQLITE_NOLFS: zName = "SQLITE_NOLFS"; break;
|
||||
case SQLITE_AUTH: zName = "SQLITE_AUTH"; break;
|
||||
case SQLITE_FORMAT: zName = "SQLITE_FORMAT"; break;
|
||||
case SQLITE_RANGE: zName = "SQLITE_RANGE"; break;
|
||||
case SQLITE_ROW: zName = "SQLITE_ROW"; break;
|
||||
case SQLITE_DONE: zName = "SQLITE_DONE"; break;
|
||||
default: zName = "SQLITE_Unknown"; break;
|
||||
}
|
||||
zName = sqlite3TestErrorName(threadset[i].rc);
|
||||
Tcl_AppendResult(interp, zName, 0);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@@ -87,6 +87,12 @@ static void set_options(Tcl_Interp *interp){
|
||||
Tcl_SetVar2(interp, "sqlite_options", "lfs", "1", TCL_GLOBAL_ONLY);
|
||||
#endif
|
||||
|
||||
#ifdef SQLITE_DISABLE_MMAP
|
||||
Tcl_SetVar2(interp, "sqlite_options", "mmap", "0", TCL_GLOBAL_ONLY);
|
||||
#else
|
||||
Tcl_SetVar2(interp, "sqlite_options", "mmap", "1", TCL_GLOBAL_ONLY);
|
||||
#endif
|
||||
|
||||
#if 1 /* def SQLITE_MEMDEBUG */
|
||||
Tcl_SetVar2(interp, "sqlite_options", "memdebug", "1", TCL_GLOBAL_ONLY);
|
||||
#else
|
||||
|
||||
+1
-1
@@ -99,7 +99,7 @@ static int fsConnect(
|
||||
}
|
||||
zTbl = argv[3];
|
||||
|
||||
nByte = sizeof(fs_vtab) + strlen(zTbl) + 1 + strlen(zDb) + 1;
|
||||
nByte = sizeof(fs_vtab) + (int)strlen(zTbl) + 1 + (int)strlen(zDb) + 1;
|
||||
pVtab = (fs_vtab *)sqlite3MallocZero( nByte );
|
||||
if( !pVtab ) return SQLITE_NOMEM;
|
||||
|
||||
|
||||
+2
-2
@@ -188,7 +188,7 @@ int re_match(ReCompiled *pRe, const unsigned char *zIn, int nIn){
|
||||
|
||||
in.z = zIn;
|
||||
in.i = 0;
|
||||
in.mx = nIn>=0 ? nIn : strlen((char const*)zIn);
|
||||
in.mx = nIn>=0 ? nIn : (int)strlen((char const*)zIn);
|
||||
|
||||
/* Look for the initial prefix match, if there is one. */
|
||||
if( pRe->nInit ){
|
||||
@@ -628,7 +628,7 @@ const char *re_compile(ReCompiled **ppRe, const char *zIn, int noCase){
|
||||
}
|
||||
pRe->sIn.z = (unsigned char*)zIn;
|
||||
pRe->sIn.i = 0;
|
||||
pRe->sIn.mx = strlen(zIn);
|
||||
pRe->sIn.mx = (int)strlen(zIn);
|
||||
zErr = re_subcompile_re(pRe);
|
||||
if( zErr ){
|
||||
re_free(pRe);
|
||||
|
||||
+14
-1
@@ -108,7 +108,7 @@ static int ts_pwrite64(int fd, const void *aBuf, size_t nBuf, off_t off);
|
||||
static int ts_fchmod(int fd, mode_t mode);
|
||||
static int ts_fallocate(int fd, off_t off, off_t len);
|
||||
static void *ts_mmap(void *, size_t, int, int, int, off_t);
|
||||
|
||||
static void *ts_mremap(void*, size_t, size_t, int, ...);
|
||||
|
||||
struct TestSyscallArray {
|
||||
const char *zName;
|
||||
@@ -134,6 +134,7 @@ struct TestSyscallArray {
|
||||
/* 14 */ { "fchmod", (sqlite3_syscall_ptr)ts_fchmod, 0, 0, 0 },
|
||||
/* 15 */ { "fallocate", (sqlite3_syscall_ptr)ts_fallocate, 0, 0, 0 },
|
||||
/* 16 */ { "mmap", (sqlite3_syscall_ptr)ts_mmap, 0, 0, 0 },
|
||||
/* 17 */ { "mremap", (sqlite3_syscall_ptr)ts_mremap, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
@@ -156,6 +157,7 @@ struct TestSyscallArray {
|
||||
#define orig_fchmod ((int(*)(int,mode_t))aSyscall[14].xOrig)
|
||||
#define orig_fallocate ((int(*)(int,off_t,off_t))aSyscall[15].xOrig)
|
||||
#define orig_mmap ((void*(*)(void*,size_t,int,int,int,off_t))aSyscall[16].xOrig)
|
||||
#define orig_mremap ((void*(*)(void*,size_t,size_t,int,...))aSyscall[17].xOrig)
|
||||
|
||||
/*
|
||||
** This function is called exactly once from within each invocation of a
|
||||
@@ -395,6 +397,17 @@ static void *ts_mmap(
|
||||
return orig_mmap(pAddr, nByte, prot, flags, fd, iOff);
|
||||
}
|
||||
|
||||
static void *ts_mremap(void *a, size_t b, size_t c, int d, ...){
|
||||
va_list ap;
|
||||
void *pArg;
|
||||
if( tsIsFailErrno("mremap") ){
|
||||
return MAP_FAILED;
|
||||
}
|
||||
va_start(ap, d);
|
||||
pArg = va_arg(ap, void *);
|
||||
return orig_mremap(a, b, c, d, pArg);
|
||||
}
|
||||
|
||||
static int test_syscall_install(
|
||||
void * clientData,
|
||||
Tcl_Interp *interp,
|
||||
|
||||
+9
-3
@@ -125,8 +125,9 @@ struct Testvfs {
|
||||
#define TESTVFS_ACCESS_MASK 0x00004000
|
||||
#define TESTVFS_FULLPATHNAME_MASK 0x00008000
|
||||
#define TESTVFS_READ_MASK 0x00010000
|
||||
#define TESTVFS_UNLOCK_MASK 0x00020000
|
||||
|
||||
#define TESTVFS_ALL_MASK 0x0001FFFF
|
||||
#define TESTVFS_ALL_MASK 0x0003FFFF
|
||||
|
||||
|
||||
#define TESTVFS_MAX_PAGES 1024
|
||||
@@ -467,8 +468,12 @@ static int tvfsLock(sqlite3_file *pFile, int eLock){
|
||||
** Unlock an tvfs-file.
|
||||
*/
|
||||
static int tvfsUnlock(sqlite3_file *pFile, int eLock){
|
||||
TestvfsFd *p = tvfsGetFd(pFile);
|
||||
return sqlite3OsUnlock(p->pReal, eLock);
|
||||
TestvfsFd *pFd = tvfsGetFd(pFile);
|
||||
Testvfs *p = (Testvfs *)pFd->pVfs->pAppData;
|
||||
if( p->mask&TESTVFS_WRITE_MASK && tvfsInjectIoerr(p) ){
|
||||
return SQLITE_IOERR_UNLOCK;
|
||||
}
|
||||
return sqlite3OsUnlock(pFd->pReal, eLock);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1101,6 +1106,7 @@ static int testvfs_obj_cmd(
|
||||
{ "xClose", TESTVFS_CLOSE_MASK },
|
||||
{ "xAccess", TESTVFS_ACCESS_MASK },
|
||||
{ "xFullPathname", TESTVFS_FULLPATHNAME_MASK },
|
||||
{ "xUnlock", TESTVFS_UNLOCK_MASK },
|
||||
};
|
||||
Tcl_Obj **apElem = 0;
|
||||
int nElem = 0;
|
||||
|
||||
+1
-1
@@ -520,7 +520,7 @@ int sqlite3Atoi64(const char *zNum, i64 *pNum, int length, u8 enc){
|
||||
testcase( i==18 );
|
||||
testcase( i==19 );
|
||||
testcase( i==20 );
|
||||
if( (c+nonNum!=0 && &zNum[i]<zEnd) || (i==0 && zStart==zNum) || i>19*incr ){
|
||||
if( (c!=0 && &zNum[i]<zEnd) || (i==0 && zStart==zNum) || i>19*incr || nonNum ){
|
||||
/* zNum is empty or contains non-numeric text or is longer
|
||||
** than 19 digits (thus guaranteeing that it is too large) */
|
||||
return 1;
|
||||
|
||||
+1
-1
@@ -3515,7 +3515,7 @@ case OP_SeekGt: { /* jump, in3 */
|
||||
** r.flags = 0;
|
||||
** }
|
||||
*/
|
||||
r.flags = (u16)(UNPACKED_INCRKEY * (1 & (oc - OP_SeekLt)));
|
||||
r.flags = (u8)(UNPACKED_INCRKEY * (1 & (oc - OP_SeekLt)));
|
||||
assert( oc!=OP_SeekGt || r.flags==UNPACKED_INCRKEY );
|
||||
assert( oc!=OP_SeekLe || r.flags==UNPACKED_INCRKEY );
|
||||
assert( oc!=OP_SeekGe || r.flags==0 );
|
||||
|
||||
@@ -18,6 +18,14 @@
|
||||
#ifndef _VDBEINT_H_
|
||||
#define _VDBEINT_H_
|
||||
|
||||
/*
|
||||
** The maximum number of times that a statement will try to reparse
|
||||
** itself before giving up and returning SQLITE_SCHEMA.
|
||||
*/
|
||||
#ifndef SQLITE_MAX_SCHEMA_RETRY
|
||||
# define SQLITE_MAX_SCHEMA_RETRY 50
|
||||
#endif
|
||||
|
||||
/*
|
||||
** SQL is translated into a sequence of instructions to be
|
||||
** executed by a virtual machine. Each instruction is an instance
|
||||
|
||||
@@ -453,14 +453,6 @@ end_of_step:
|
||||
return (rc&db->errMask);
|
||||
}
|
||||
|
||||
/*
|
||||
** The maximum number of times that a statement will try to reparse
|
||||
** itself before giving up and returning SQLITE_SCHEMA.
|
||||
*/
|
||||
#ifndef SQLITE_MAX_SCHEMA_RETRY
|
||||
# define SQLITE_MAX_SCHEMA_RETRY 5
|
||||
#endif
|
||||
|
||||
/*
|
||||
** This is the top-level implementation of sqlite3_step(). Call
|
||||
** sqlite3Step() to do most of the work. If a schema error occurs,
|
||||
|
||||
+1
-1
@@ -313,7 +313,7 @@ int sqlite3_blob_open(
|
||||
}
|
||||
sqlite3_bind_int64(pBlob->pStmt, 1, iRow);
|
||||
rc = blobSeekToRow(pBlob, iRow, &zErr);
|
||||
} while( (++nAttempt)<5 && rc==SQLITE_SCHEMA );
|
||||
} while( (++nAttempt)<SQLITE_MAX_SCHEMA_RETRY && rc==SQLITE_SCHEMA );
|
||||
|
||||
blob_open_out:
|
||||
if( rc==SQLITE_OK && db->mallocFailed==0 ){
|
||||
|
||||
+32
-8
@@ -53,6 +53,11 @@ static int findNextHostParameter(const char *zSql, int *pnToken){
|
||||
** then the returned string holds a copy of zRawSql with "-- " prepended
|
||||
** to each line of text.
|
||||
**
|
||||
** If the SQLITE_TRACE_SIZE_LIMIT macro is defined to an integer, then
|
||||
** then long strings and blobs are truncated to that many bytes. This
|
||||
** can be used to prevent unreasonably large trace strings when dealing
|
||||
** with large (multi-megabyte) strings and blobs.
|
||||
**
|
||||
** The calling function is responsible for making sure the memory returned
|
||||
** is eventually freed.
|
||||
**
|
||||
@@ -123,30 +128,49 @@ char *sqlite3VdbeExpandSql(
|
||||
}else if( pVar->flags & MEM_Real ){
|
||||
sqlite3XPrintf(&out, "%!.15g", pVar->r);
|
||||
}else if( pVar->flags & MEM_Str ){
|
||||
int n; /* Number of bytes of the string text to include in output */
|
||||
#ifndef SQLITE_OMIT_UTF16
|
||||
u8 enc = ENC(db);
|
||||
Mem utf8;
|
||||
if( enc!=SQLITE_UTF8 ){
|
||||
Mem utf8;
|
||||
memset(&utf8, 0, sizeof(utf8));
|
||||
utf8.db = db;
|
||||
sqlite3VdbeMemSetStr(&utf8, pVar->z, pVar->n, enc, SQLITE_STATIC);
|
||||
sqlite3VdbeChangeEncoding(&utf8, SQLITE_UTF8);
|
||||
sqlite3XPrintf(&out, "'%.*q'", utf8.n, utf8.z);
|
||||
sqlite3VdbeMemRelease(&utf8);
|
||||
}else
|
||||
#endif
|
||||
{
|
||||
sqlite3XPrintf(&out, "'%.*q'", pVar->n, pVar->z);
|
||||
pVar = &utf8;
|
||||
}
|
||||
#endif
|
||||
n = pVar->n;
|
||||
#ifdef SQLITE_TRACE_SIZE_LIMIT
|
||||
if( n>SQLITE_TRACE_SIZE_LIMIT ){
|
||||
n = SQLITE_TRACE_SIZE_LIMIT;
|
||||
while( n<pVar->n && (pVar->z[n]&0xc0)==0x80 ){ n++; }
|
||||
}
|
||||
#endif
|
||||
sqlite3XPrintf(&out, "'%.*q'", n, pVar->z);
|
||||
#ifdef SQLITE_TRACE_SIZE_LIMIT
|
||||
if( n<pVar->n ) sqlite3XPrintf(&out, "/*+%d bytes*/", pVar->n-n);
|
||||
#endif
|
||||
#ifndef SQLITE_OMIT_UTF16
|
||||
if( enc!=SQLITE_UTF8 ) sqlite3VdbeMemRelease(&utf8);
|
||||
#endif
|
||||
}else if( pVar->flags & MEM_Zero ){
|
||||
sqlite3XPrintf(&out, "zeroblob(%d)", pVar->u.nZero);
|
||||
}else{
|
||||
int n; /* Number of bytes of the blob to include in output */
|
||||
assert( pVar->flags & MEM_Blob );
|
||||
sqlite3StrAccumAppend(&out, "x'", 2);
|
||||
for(i=0; i<pVar->n; i++){
|
||||
n = pVar->n;
|
||||
#ifdef SQLITE_TRACE_SIZE_LIMIT
|
||||
if( n>SQLITE_TRACE_SIZE_LIMIT ) n = SQLITE_TRACE_SIZE_LIMIT;
|
||||
#endif
|
||||
for(i=0; i<n; i++){
|
||||
sqlite3XPrintf(&out, "%02x", pVar->z[i]&0xff);
|
||||
}
|
||||
sqlite3StrAccumAppend(&out, "'", 1);
|
||||
#ifdef SQLITE_TRACE_SIZE_LIMIT
|
||||
if( n<pVar->n ) sqlite3XPrintf(&out, "/*+%d bytes*/", pVar->n-n);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1207,7 +1207,8 @@ finished:
|
||||
** checkpointing the log file.
|
||||
*/
|
||||
if( pWal->hdr.nPage ){
|
||||
sqlite3_log(SQLITE_OK, "Recovered %d frames from WAL file %s",
|
||||
sqlite3_log(SQLITE_NOTICE_RECOVER_WAL,
|
||||
"recovered %d frames from WAL file %s",
|
||||
pWal->hdr.mxFrame, pWal->zWalName
|
||||
);
|
||||
}
|
||||
@@ -2956,6 +2957,9 @@ int sqlite3WalCheckpoint(
|
||||
/* Read the wal-index header. */
|
||||
if( rc==SQLITE_OK ){
|
||||
rc = walIndexReadHdr(pWal, &isChanged);
|
||||
if( isChanged && pWal->pDbFd->pMethods->iVersion>=3 ){
|
||||
sqlite3OsUnfetch(pWal->pDbFd, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* Copy data from the log to the database file. */
|
||||
|
||||
+36
-8
@@ -262,6 +262,8 @@ struct WhereCost {
|
||||
#define WHERE_REVERSE 0x01000000 /* Scan in reverse order */
|
||||
#define WHERE_UNIQUE 0x02000000 /* Selects no more than one row */
|
||||
#define WHERE_ALL_UNIQUE 0x04000000 /* This and all prior have one row */
|
||||
#define WHERE_OB_UNIQUE 0x00004000 /* Values in ORDER BY columns are
|
||||
** different for every output row */
|
||||
#define WHERE_VIRTUALTABLE 0x08000000 /* Use virtual-table processing */
|
||||
#define WHERE_MULTI_OR 0x10000000 /* OR using multiple indices */
|
||||
#define WHERE_TEMP_INDEX 0x20000000 /* Uses an ephemeral index */
|
||||
@@ -2903,7 +2905,8 @@ static int isSortingIndex(
|
||||
WhereBestIdx *p, /* Best index search context */
|
||||
Index *pIdx, /* The index we are testing */
|
||||
int base, /* Cursor number for the table to be sorted */
|
||||
int *pbRev /* Set to 1 for reverse-order scan of pIdx */
|
||||
int *pbRev, /* Set to 1 for reverse-order scan of pIdx */
|
||||
int *pbObUnique /* ORDER BY column values will different in every row */
|
||||
){
|
||||
int i; /* Number of pIdx terms used */
|
||||
int j; /* Number of ORDER BY terms satisfied */
|
||||
@@ -2917,12 +2920,16 @@ static int isSortingIndex(
|
||||
int nPriorSat; /* ORDER BY terms satisfied by outer loops */
|
||||
int seenRowid = 0; /* True if an ORDER BY rowid term is seen */
|
||||
int uniqueNotNull; /* pIdx is UNIQUE with all terms are NOT NULL */
|
||||
int outerObUnique; /* Outer loops generate different values in
|
||||
** every row for the ORDER BY columns */
|
||||
|
||||
if( p->i==0 ){
|
||||
nPriorSat = 0;
|
||||
outerObUnique = 1;
|
||||
}else{
|
||||
u32 wsFlags = p->aLevel[p->i-1].plan.wsFlags;
|
||||
nPriorSat = p->aLevel[p->i-1].plan.nOBSat;
|
||||
if( (p->aLevel[p->i-1].plan.wsFlags & WHERE_ORDERED)==0 ){
|
||||
if( (wsFlags & WHERE_ORDERED)==0 ){
|
||||
/* This loop cannot be ordered unless the next outer loop is
|
||||
** also ordered */
|
||||
return nPriorSat;
|
||||
@@ -2932,6 +2939,9 @@ static int isSortingIndex(
|
||||
** optimization is disabled */
|
||||
return nPriorSat;
|
||||
}
|
||||
testcase( wsFlags & WHERE_OB_UNIQUE );
|
||||
testcase( wsFlags & WHERE_ALL_UNIQUE );
|
||||
outerObUnique = (wsFlags & (WHERE_OB_UNIQUE|WHERE_ALL_UNIQUE))!=0;
|
||||
}
|
||||
pOrderBy = p->pOrderBy;
|
||||
assert( pOrderBy!=0 );
|
||||
@@ -3073,11 +3083,26 @@ static int isSortingIndex(
|
||||
uniqueNotNull = 0;
|
||||
}
|
||||
}
|
||||
if( seenRowid ){
|
||||
uniqueNotNull = 1;
|
||||
}else if( uniqueNotNull==0 || i<pIdx->nColumn ){
|
||||
uniqueNotNull = 0;
|
||||
}
|
||||
|
||||
/* If we have not found at least one ORDER BY term that matches the
|
||||
** index, then show no progress. */
|
||||
if( pOBItem==&pOrderBy->a[nPriorSat] ) return nPriorSat;
|
||||
|
||||
/* Either the outer queries must generate rows where there are no two
|
||||
** rows with the same values in all ORDER BY columns, or else this
|
||||
** loop must generate just a single row of output. Example: Suppose
|
||||
** the outer loops generate A=1 and A=1, and this loop generates B=3
|
||||
** and B=4. Then without the following test, ORDER BY A,B would
|
||||
** generate the wrong order output: 1,3 1,4 1,3 1,4
|
||||
*/
|
||||
if( outerObUnique==0 && uniqueNotNull==0 ) return nPriorSat;
|
||||
*pbObUnique = uniqueNotNull;
|
||||
|
||||
/* Return the necessary scan order back to the caller */
|
||||
*pbRev = sortOrder & 1;
|
||||
|
||||
@@ -3085,7 +3110,7 @@ static int isSortingIndex(
|
||||
** possible for a single row from this table to match, then skip over
|
||||
** any additional ORDER BY terms dealing with this table.
|
||||
*/
|
||||
if( seenRowid || (uniqueNotNull && i>=pIdx->nColumn) ){
|
||||
if( uniqueNotNull ){
|
||||
/* Advance j over additional ORDER BY terms associated with base */
|
||||
WhereMaskSet *pMS = p->pWC->pMaskSet;
|
||||
Bitmask m = ~getMask(pMS, base);
|
||||
@@ -3369,12 +3394,14 @@ static void bestBtreeIndex(WhereBestIdx *p){
|
||||
** variable. */
|
||||
if( bSort && (pSrc->jointype & JT_LEFT)==0 ){
|
||||
int bRev = 2;
|
||||
WHERETRACE((" --> before isSortingIndex: nPriorSat=%d\n",nPriorSat));
|
||||
pc.plan.nOBSat = isSortingIndex(p, pProbe, iCur, &bRev);
|
||||
WHERETRACE((" --> after isSortingIndex: bRev=%d nOBSat=%d\n",
|
||||
bRev, pc.plan.nOBSat));
|
||||
int bObUnique = 0;
|
||||
WHERETRACE((" --> before isSortIndex: nPriorSat=%d\n",nPriorSat));
|
||||
pc.plan.nOBSat = isSortingIndex(p, pProbe, iCur, &bRev, &bObUnique);
|
||||
WHERETRACE((" --> after isSortIndex: bRev=%d bObU=%d nOBSat=%d\n",
|
||||
bRev, bObUnique, pc.plan.nOBSat));
|
||||
if( nPriorSat<pc.plan.nOBSat || (pc.plan.wsFlags & WHERE_ALL_UNIQUE)!=0 ){
|
||||
pc.plan.wsFlags |= WHERE_ORDERED;
|
||||
if( bObUnique ) pc.plan.wsFlags |= WHERE_OB_UNIQUE;
|
||||
}
|
||||
if( nOrderBy==pc.plan.nOBSat ){
|
||||
bSort = 0;
|
||||
@@ -3468,7 +3495,8 @@ static void bestBtreeIndex(WhereBestIdx *p){
|
||||
** So this computation assumes table records are about twice as big
|
||||
** as index records
|
||||
*/
|
||||
if( (pc.plan.wsFlags&~(WHERE_REVERSE|WHERE_ORDERED))==WHERE_IDX_ONLY
|
||||
if( (pc.plan.wsFlags&~(WHERE_REVERSE|WHERE_ORDERED|WHERE_OB_UNIQUE))
|
||||
==WHERE_IDX_ONLY
|
||||
&& (pWC->wctrlFlags & WHERE_ONEPASS_DESIRED)==0
|
||||
&& sqlite3GlobalConfig.bUseCis
|
||||
&& OptimizationEnabled(pParse->db, SQLITE_CoverIdxScan)
|
||||
|
||||
@@ -32,7 +32,7 @@ proc make_str {char len} {
|
||||
|
||||
# Return the number of pages in the file test.db by looking at the file system.
|
||||
proc file_pages {} {
|
||||
file_page_count test.db
|
||||
return [expr [file size test.db] / 1024]
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@@ -614,7 +614,7 @@ do_test autovacuum-7.1 {
|
||||
INSERT INTO t1 SELECT randstr(400,400), randstr(400,400) FROM t1; -- 32
|
||||
}
|
||||
|
||||
file_page_count test.db
|
||||
expr {[file size test.db] / 1024}
|
||||
} {73}
|
||||
|
||||
do_test autovacuum-7.2 {
|
||||
@@ -628,7 +628,7 @@ do_test autovacuum-7.2 {
|
||||
CREATE TABLE t5(a, b, PRIMARY KEY(a, b));
|
||||
INSERT INTO t5 SELECT randstr(400,400), randstr(400,400) FROM t1; -- 2
|
||||
}
|
||||
file_page_count test.db
|
||||
expr {[file size test.db] / 1024}
|
||||
} {354}
|
||||
|
||||
do_test autovacuum-7.3 {
|
||||
@@ -640,7 +640,7 @@ do_test autovacuum-7.3 {
|
||||
COMMIT;
|
||||
SELECT count(*) FROM t1;
|
||||
}
|
||||
file_page_count test.db
|
||||
expr {[file size test.db] / 1024}
|
||||
} {286}
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
+1
-1
@@ -661,7 +661,7 @@ do_test backup-6.1 {
|
||||
}
|
||||
} {}
|
||||
do_test backup-6.2 {
|
||||
set nTotal [file_page_count test.db]
|
||||
set nTotal [expr {[file size test.db]/1024}]
|
||||
sqlite3_backup B db2 main db main
|
||||
B step 1
|
||||
} {SQLITE_OK}
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ do_execsql_test 2.1 {
|
||||
CREATE TABLE t1(a, b);
|
||||
CREATE INDEX i1 ON t1(a, b);
|
||||
}
|
||||
do_test 2.2 { file_page_count test.db } [expr $AUTOVACUUM ? 4 : 3]
|
||||
do_test 2.2 { file size test.db } [expr $AUTOVACUUM ? 4096 : 3072]
|
||||
|
||||
do_test 2.3 {
|
||||
sqlite3 db1 test.db2
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
# 2013 April 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.
|
||||
#
|
||||
#***********************************************************************
|
||||
#
|
||||
# This file contains fault injection tests designed to test the btree.c
|
||||
# module.
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
source $testdir/malloc_common.tcl
|
||||
set testprefix btreefault
|
||||
|
||||
do_test 1-pre1 {
|
||||
execsql {
|
||||
PRAGMA auto_vacuum = incremental;
|
||||
PRAGMA journal_mode = DELETE;
|
||||
CREATE TABLE t1(a PRIMARY KEY, b);
|
||||
INSERT INTO t1 VALUES(randomblob(1000), randomblob(100));
|
||||
INSERT INTO t1 SELECT randomblob(1000), randomblob(1000) FROM t1;
|
||||
INSERT INTO t1 SELECT randomblob(1000), randomblob(1000) FROM t1;
|
||||
INSERT INTO t1 SELECT randomblob(1000), randomblob(1000) FROM t1;
|
||||
INSERT INTO t1 SELECT randomblob(1000), randomblob(1000) FROM t1;
|
||||
DELETE FROM t1 WHERE rowid%2;
|
||||
}
|
||||
faultsim_save_and_close
|
||||
} {}
|
||||
|
||||
do_faultsim_test 1 -prep {
|
||||
faultsim_restore_and_reopen
|
||||
set ::STMT [sqlite3_prepare db "SELECT * FROM t1 ORDER BY a" -1 DUMMY]
|
||||
sqlite3_step $::STMT
|
||||
sqlite3_step $::STMT
|
||||
} -body {
|
||||
execsql { PRAGMA incremental_vacuum = 10 }
|
||||
} -test {
|
||||
sqlite3_finalize $::STMT
|
||||
faultsim_test_result {0 {}}
|
||||
faultsim_integrity_check
|
||||
}
|
||||
|
||||
finish_test
|
||||
|
||||
+1
-1
@@ -334,7 +334,7 @@ ifcapable autovacuum {
|
||||
INSERT INTO t1 VALUES(3, randomblob(2500));
|
||||
DELETE FROM t1 WHERE a = 1;
|
||||
} -corrupt {
|
||||
set nPage [file_page_count corrupt.db]
|
||||
set nPage [expr [file size corrupt.db] / 1024]
|
||||
hexio_write corrupt.db [expr 1024 + ($nPage-3)*5] 010000000
|
||||
} -test {
|
||||
do_test corrupt2-6.3 {
|
||||
|
||||
+2
-2
@@ -40,8 +40,8 @@ do_test corrupt3-1.1 {
|
||||
CREATE TABLE t1(x);
|
||||
INSERT INTO t1 VALUES($bigstring);
|
||||
}
|
||||
list [file_page_count test.db] [file_page_size test.db]
|
||||
} {3 1024}
|
||||
file size test.db
|
||||
} [expr {1024*3}]
|
||||
|
||||
# Verify that the file format is as we expect. The page size
|
||||
# should be 1024 bytes. The only record should have a single
|
||||
|
||||
+2
-2
@@ -41,8 +41,8 @@ do_test corrupt6-1.1 {
|
||||
INSERT INTO t1(x) VALUES('varint32-01234567890123456789012345678901234567890123456789');
|
||||
INSERT INTO t1(x) VALUES('varint32-01234567890123456789012345678901234567890123456789');
|
||||
}
|
||||
file_page_count test.db
|
||||
} {2}
|
||||
file size test.db
|
||||
} [expr {1024*2}]
|
||||
|
||||
# Verify that the file format is as we expect. The page size
|
||||
# should be 1024 bytes.
|
||||
|
||||
+2
-2
@@ -44,8 +44,8 @@ do_test corrupt7-1.1 {
|
||||
INSERT INTO t1(x) SELECT x+4 FROM t1;
|
||||
INSERT INTO t1(x) SELECT x+8 FROM t1;
|
||||
}
|
||||
file_page_count test.db
|
||||
} {2}
|
||||
file size test.db
|
||||
} [expr {1024*2}]
|
||||
|
||||
# Verify that the file format is as we expect. The page size
|
||||
# should be 1024 bytes.
|
||||
|
||||
+1
-1
@@ -270,7 +270,7 @@ do_test corruptC-2.14 {
|
||||
execsql { INSERT INTO t1 VALUES (1, $blob) }
|
||||
|
||||
sqlite3 db test.db
|
||||
set filesize [expr [file_page_count test.db] * [file_page_size test.db]]
|
||||
set filesize [file size test.db]
|
||||
hexio_write test.db [expr $filesize-2048] 00000001
|
||||
catchsql {DELETE FROM t1 WHERE rowid = (SELECT max(rowid) FROM t1)}
|
||||
} {1 {database disk image is malformed}}
|
||||
|
||||
+2
-2
@@ -56,7 +56,7 @@ do_test 1.1 { create_test_db } {}
|
||||
# Check the db is as we expect. 6 pages in total, with 3 and 4 on the free
|
||||
# list. Page 3 is the free list trunk and page 4 is a leaf.
|
||||
#
|
||||
do_test 1.2 { file_page_count test.db } 6
|
||||
do_test 1.2 { file size test.db } [expr 6*1024]
|
||||
do_test 1.3 { hexio_read test.db 32 4 } 00000003
|
||||
do_test 1.4 { hexio_read test.db [expr 2*1024] 12 } 000000000000000100000004
|
||||
|
||||
@@ -109,7 +109,7 @@ for {set i 0} {$i < 128} {incr i} {
|
||||
}
|
||||
|
||||
do_test 2.1 { create_test_db } {}
|
||||
do_test 2.2 { file_page_count test.db } 6
|
||||
do_test 2.2 { file size test.db } [expr 6*1024]
|
||||
do_test 2.3 { hexio_read test.db 32 4 } 00000003
|
||||
do_test 2.4 { hexio_read test.db [expr 2*1024] 12 } 000000000000000100000004
|
||||
|
||||
|
||||
+1
-1
@@ -330,7 +330,7 @@ do_test crash-5.1 {
|
||||
}
|
||||
} {}
|
||||
do_test crash-5.2 {
|
||||
file_page_count test.db
|
||||
expr [file size test.db] / 1024
|
||||
} [expr [string match [execsql {pragma auto_vacuum}] 1] ? 11 : 10]
|
||||
set sig [signature]
|
||||
do_test crash-5.3 {
|
||||
|
||||
+2
-2
@@ -52,8 +52,8 @@ for {set av 0} {$av<=$upperBound} {incr av} {
|
||||
}
|
||||
|
||||
do_test createtab-$av.2 {
|
||||
file_page_count test.db
|
||||
} [expr {4+($av!=0)+(${isUtf16}*2)}]
|
||||
file size test.db
|
||||
} [expr {1024*(4+($av!=0)+(${isUtf16}*2))}]
|
||||
|
||||
# Start reading the table
|
||||
#
|
||||
|
||||
@@ -20,7 +20,6 @@ set ::testprefix dbstatus2
|
||||
do_execsql_test 1.0 {
|
||||
PRAGMA page_size = 1024;
|
||||
PRAGMA auto_vacuum = 0;
|
||||
PRAGMA mmap_limit = 0;
|
||||
|
||||
CREATE TABLE t1(a PRIMARY KEY, b);
|
||||
INSERT INTO t1 VALUES(1, randomblob(600));
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ proc create_db {{sql ""}} {
|
||||
}
|
||||
}
|
||||
|
||||
return [file_page_count test.db]
|
||||
return [expr {[file size test.db] / 1024}]
|
||||
}
|
||||
|
||||
# This proc returns the number of contiguous blocks of pages that make up
|
||||
|
||||
@@ -65,7 +65,6 @@ ifcapable pager_pragmas {
|
||||
db close
|
||||
forcedelete test.db
|
||||
sqlite3 db test.db
|
||||
db eval "PRAGMA mmap_limit=0"
|
||||
db eval "PRAGMA auto_vacuum=OFF"
|
||||
db eval "PRAGMA page_size=$pagesize"
|
||||
db eval {CREATE TABLE t1(x)}
|
||||
@@ -216,7 +215,6 @@ do_execsql_test filefmt-3.3 {
|
||||
|
||||
reset_db
|
||||
do_execsql_test filefmt-4.1 {
|
||||
PRAGMA mmap_limit = 0;
|
||||
PRAGMA auto_vacuum = 1;
|
||||
CREATE TABLE t1(x, y);
|
||||
CREATE TABLE t2(x, y);
|
||||
|
||||
+3
-3
@@ -46,19 +46,19 @@ do_test format4-1.1 {
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
}
|
||||
expr {1024 * [file_page_count test.db]}
|
||||
file size test.db
|
||||
} $small
|
||||
do_test format4-1.2 {
|
||||
execsql {
|
||||
UPDATE t1 SET x0=1, x1=1, x2=1, x3=1, x4=1, x5=1, x6=1, x7=1, x8=1, x9=1
|
||||
}
|
||||
expr {1024 * [file_page_count test.db]}
|
||||
file size test.db
|
||||
} $small
|
||||
do_test format4-1.3 {
|
||||
execsql {
|
||||
UPDATE t1 SET x0=2, x1=2, x2=2, x3=2, x4=2, x5=2, x6=2, x7=2, x8=2, x9=2
|
||||
}
|
||||
expr {1024 * [file_page_count test.db]}
|
||||
file size test.db
|
||||
} $large
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -619,7 +619,7 @@ do_test incrblob-7.3.1 {
|
||||
read $::b
|
||||
} $::otherdata
|
||||
do_test incrblob-7.3.2 {
|
||||
file_page_count test.db
|
||||
expr [file size test.db]/1024
|
||||
} 30
|
||||
do_test incrblob-7.3.3 {
|
||||
execsql {
|
||||
|
||||
+10
-10
@@ -149,21 +149,21 @@ do_test incrvacuum-3.2 {
|
||||
# 4 -> table tbl2
|
||||
# 5 -> table tbl2 overflow page.
|
||||
#
|
||||
file_page_count test.db
|
||||
expr {[file size test.db] / 1024}
|
||||
} {5}
|
||||
do_test incrvacuum-3.3 {
|
||||
execsql {
|
||||
DROP TABLE abc;
|
||||
DELETE FROM tbl2;
|
||||
}
|
||||
file_page_count test.db
|
||||
expr {[file size test.db] / 1024}
|
||||
} {5}
|
||||
do_test incrvacuum-3.4 {
|
||||
execsql {
|
||||
PRAGMA auto_vacuum = 1;
|
||||
INSERT INTO tbl2 VALUES('hello world');
|
||||
}
|
||||
file_page_count test.db
|
||||
expr {[file size test.db] / 1024}
|
||||
} {3}
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
@@ -178,14 +178,14 @@ do_test incrvacuum-4.1 {
|
||||
INSERT INTO tbl2 VALUES($::str);
|
||||
CREATE TABLE tbl1(a, b, c);
|
||||
}
|
||||
file_page_count test.db
|
||||
expr {[file size test.db] / 1024}
|
||||
} {5}
|
||||
do_test incrvacuum-4.2 {
|
||||
execsql {
|
||||
DELETE FROM tbl2;
|
||||
DROP TABLE tbl1;
|
||||
}
|
||||
file_page_count test.db
|
||||
expr {[file size test.db] / 1024}
|
||||
} {5}
|
||||
do_test incrvacuum-4.3 {
|
||||
set ::nStep 0
|
||||
@@ -221,7 +221,7 @@ do_test incrvacuum-5.2.1 {
|
||||
PRAGMA incremental_vacuum; -- this is a no-op.
|
||||
COMMIT;
|
||||
}
|
||||
file_page_count test.db
|
||||
expr {[file size test.db] / 1024}
|
||||
} {4}
|
||||
do_test incrvacuum-5.2.2 {
|
||||
set ::str [string repeat abcdefghij 110]
|
||||
@@ -232,7 +232,7 @@ do_test incrvacuum-5.2.2 {
|
||||
DELETE FROM tbl1 WHERE oid%2; -- Put 2 overflow pages on free-list.
|
||||
COMMIT;
|
||||
}
|
||||
file_page_count test.db
|
||||
expr {[file size test.db] / 1024}
|
||||
} {7}
|
||||
do_test incrvacuum-5.2.3 {
|
||||
execsql {
|
||||
@@ -242,7 +242,7 @@ do_test incrvacuum-5.2.3 {
|
||||
INSERT INTO tbl2 VALUES('a nice string');
|
||||
COMMIT;
|
||||
}
|
||||
file_page_count test.db
|
||||
expr {[file size test.db] / 1024}
|
||||
} {6}
|
||||
do_test incrvacuum-5.2.4 {
|
||||
execsql {
|
||||
@@ -255,7 +255,7 @@ do_test incrvacuum-5.2.5 {
|
||||
DROP TABLE tbl2;
|
||||
PRAGMA incremental_vacuum;
|
||||
}
|
||||
file_page_count test.db
|
||||
expr {[file size test.db] / 1024}
|
||||
} {1}
|
||||
|
||||
|
||||
@@ -527,7 +527,7 @@ do_test incrvacuum-10.1 {
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
}
|
||||
file_page_count test.db
|
||||
expr [file size test.db] / 1024
|
||||
} {29}
|
||||
|
||||
do_test incrvacuum-10.2 {
|
||||
|
||||
+4
-6
@@ -418,8 +418,8 @@ ifcapable pager_pragmas {
|
||||
do_test io-3.3 {
|
||||
# The COMMIT requires a single fsync() - to the database file.
|
||||
execsql { COMMIT }
|
||||
list [file_page_count test.db] [nSync]
|
||||
} {39 1}
|
||||
list [file size test.db] [nSync]
|
||||
} {39936 1}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
@@ -488,7 +488,7 @@ do_test io-4.3.1 {
|
||||
INSERT INTO abc SELECT * FROM abc;
|
||||
INSERT INTO abc SELECT * FROM abc;
|
||||
}
|
||||
file_page_count test.db
|
||||
expr {[file size test.db]/1024}
|
||||
} {43}
|
||||
ifcapable pager_pragmas {
|
||||
do_test io-4.3.2 {
|
||||
@@ -562,9 +562,7 @@ foreach {char sectorsize pgsize} {
|
||||
CREATE TABLE abc(a, b, c);
|
||||
}
|
||||
expr {[file size test.db]/2}
|
||||
|
||||
list [file_page_count test.db] [file_page_size test.db]
|
||||
} [list 2 $pgsize]
|
||||
} $pgsize
|
||||
}
|
||||
|
||||
sqlite3_simulate_device -char {} -sectorsize 0
|
||||
|
||||
+1
-3
@@ -521,9 +521,7 @@ ifcapable pragma {
|
||||
PRAGMA user_version;
|
||||
}
|
||||
} {memory 5}
|
||||
do_test jrnlmode-7.2 {
|
||||
list [file_page_count test.db] [file_page_size test.db]
|
||||
} {1 1024}
|
||||
do_test jrnlmode-7.2 { file size test.db } {1024}
|
||||
}
|
||||
|
||||
do_execsql_test jrnlmode-8.1 { PRAGMA locking_mode=EXCLUSIVE } {exclusive}
|
||||
|
||||
+2
-2
@@ -33,8 +33,8 @@ do_test lock4-1.1 {
|
||||
CREATE TABLE t2(x)
|
||||
}
|
||||
db2 close
|
||||
list [file_page_count test.db] [file_page_count test2.db]
|
||||
} {2 2}
|
||||
list [file size test.db] [file size test2.db]
|
||||
} {2048 2048}
|
||||
|
||||
# Create a script to drive a separate process that will
|
||||
#
|
||||
|
||||
@@ -62,7 +62,6 @@ ifcapable explain {
|
||||
# Malloc failure during integrity_check pragma.
|
||||
#
|
||||
do_malloc_test mallocH-5 -sqlprep {
|
||||
PRAGMA mmap_limit = 0;
|
||||
CREATE TABLE t1(a PRIMARY KEY, b UNIQUE);
|
||||
CREATE TABLE t2(x,y);
|
||||
INSERT INTO t1 VALUES(1,2);
|
||||
|
||||
+203
-18
@@ -12,6 +12,10 @@
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
ifcapable !mmap {
|
||||
finish_test
|
||||
return
|
||||
}
|
||||
source $testdir/lock_common.tcl
|
||||
set testprefix mmap1
|
||||
|
||||
@@ -20,32 +24,39 @@ proc nRead {db} {
|
||||
db_enter $db
|
||||
array set stats [btree_pager_stats $bt]
|
||||
db_leave $db
|
||||
# puts [array get stats]
|
||||
return $stats(read)
|
||||
}
|
||||
|
||||
proc register_rblob_code {dbname seed} {
|
||||
return [subst -nocommands {
|
||||
set ::rcnt $seed
|
||||
proc rblob {n} {
|
||||
set ::rcnt [expr (([set ::rcnt] << 3) + [set ::rcnt] + 456) & 0xFFFFFFFF]
|
||||
set str [format %.8x [expr [set ::rcnt] ^ 0xbdf20da3]]
|
||||
string range [string repeat [set str] [expr [set n]/4]] 1 [set n]
|
||||
}
|
||||
$dbname func rblob rblob
|
||||
}]
|
||||
}
|
||||
|
||||
foreach {t mmap_limit nRead c2init} {
|
||||
1.1 { PRAGMA mmap_limit = 70000000 } 4 {}
|
||||
1.2 { PRAGMA mmap_limit = 51200 } 156 {}
|
||||
1.3 { PRAGMA mmap_limit = 0 } 344 {}
|
||||
1.4 { PRAGMA mmap_limit = 70000000 } 4 {PRAGMA mmap_limit = 70000000 }
|
||||
1.5 { PRAGMA mmap_limit = 51200 } 156 {PRAGMA mmap_limit = 70000000 }
|
||||
1.6 { PRAGMA mmap_limit = 0 } 344 {PRAGMA mmap_limit = 70000000 }
|
||||
1.1 { PRAGMA mmap_limit = 67108864 } 4 {PRAGMA mmap_limit = 0}
|
||||
1.2 { PRAGMA mmap_limit = 53248 } 150 {PRAGMA mmap_limit = 0}
|
||||
1.3 { PRAGMA mmap_limit = 0 } 344 {PRAGMA mmap_limit = 0}
|
||||
1.4 { PRAGMA mmap_limit = 67108864 } 4 {PRAGMA mmap_limit = 67108864 }
|
||||
1.5 { PRAGMA mmap_limit = 53248 } 150 {PRAGMA mmap_limit = 67108864 }
|
||||
1.6 { PRAGMA mmap_limit = 0 } 344 {PRAGMA mmap_limit = 67108864 }
|
||||
} {
|
||||
do_multiclient_test tn {
|
||||
sql1 {PRAGMA page_size=1024}
|
||||
sql1 $mmap_limit
|
||||
sql2 $c2init
|
||||
|
||||
code2 {
|
||||
set ::rcnt 0
|
||||
proc rblob {n} {
|
||||
set ::rcnt [expr (($::rcnt << 3) + $::rcnt + 456) & 0xFFFFFFFF]
|
||||
set str [format %.8x [expr $::rcnt ^ 0xbdf20da3]]
|
||||
string range [string repeat $str [expr $n/4]] 1 $n
|
||||
}
|
||||
db2 func rblob rblob
|
||||
}
|
||||
code2 [register_rblob_code db2 0]
|
||||
|
||||
sql2 {
|
||||
sql2 {
|
||||
PRAGMA page_size=1024;
|
||||
PRAGMA auto_vacuum = 1;
|
||||
CREATE TABLE t1(a, b, UNIQUE(a, b));
|
||||
INSERT INTO t1 VALUES(rblob(500), rblob(500));
|
||||
@@ -95,7 +106,7 @@ db func rblob rblob
|
||||
|
||||
do_execsql_test 2.1 {
|
||||
PRAGMA auto_vacuum = 1;
|
||||
PRAGMA mmap_limit = 70000000;
|
||||
PRAGMA mmap_limit = 67108864;
|
||||
PRAGMA journal_mode = wal;
|
||||
CREATE TABLE t1(a, b, UNIQUE(a, b));
|
||||
INSERT INTO t1 VALUES(rblob(500), rblob(500));
|
||||
@@ -105,7 +116,7 @@ do_execsql_test 2.1 {
|
||||
INSERT INTO t1 SELECT rblob(500), rblob(500) FROM t1; -- 16
|
||||
INSERT INTO t1 SELECT rblob(500), rblob(500) FROM t1; -- 32
|
||||
PRAGMA wal_checkpoint;
|
||||
} {wal 0 103 103}
|
||||
} {67108864 wal 0 103 103}
|
||||
|
||||
do_execsql_test 2.2 {
|
||||
PRAGMA auto_vacuum;
|
||||
@@ -129,4 +140,178 @@ do_execsql_test 2.4 {
|
||||
PRAGMA wal_checkpoint;
|
||||
} {0 24 24}
|
||||
|
||||
db2 close
|
||||
reset_db
|
||||
db func rblob rblob
|
||||
do_execsql_test 3.1 {
|
||||
PRAGMA auto_vacuum = 1;
|
||||
|
||||
CREATE TABLE t1(a, b, UNIQUE(a, b));
|
||||
INSERT INTO t1 VALUES(rblob(500), rblob(500));
|
||||
INSERT INTO t1 SELECT rblob(500), rblob(500) FROM t1; -- 2
|
||||
INSERT INTO t1 SELECT rblob(500), rblob(500) FROM t1; -- 4
|
||||
INSERT INTO t1 SELECT rblob(500), rblob(500) FROM t1; -- 8
|
||||
|
||||
CREATE TABLE t2(a, b, UNIQUE(a, b));
|
||||
INSERT INTO t2 SELECT * FROM t1;
|
||||
} {}
|
||||
|
||||
do_test 3.2 {
|
||||
set nRow 0
|
||||
db eval {SELECT * FROM t2 ORDER BY a, b} {
|
||||
if {$nRow==4} { db eval { DELETE FROM t1 } }
|
||||
incr nRow
|
||||
}
|
||||
set nRow
|
||||
} {8}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Ensure that existing cursors using xFetch() pages see changes made
|
||||
# to rows using the incrblob API.
|
||||
#
|
||||
reset_db
|
||||
set aaa [string repeat a 400]
|
||||
set bbb [string repeat b 400]
|
||||
set ccc [string repeat c 400]
|
||||
set ddd [string repeat d 400]
|
||||
set eee [string repeat e 400]
|
||||
|
||||
do_execsql_test 4.1 {
|
||||
PRAGMA page_size = 1024;
|
||||
CREATE TABLE t1(x);
|
||||
INSERT INTO t1 VALUES($aaa);
|
||||
INSERT INTO t1 VALUES($bbb);
|
||||
INSERT INTO t1 VALUES($ccc);
|
||||
INSERT INTO t1 VALUES($ddd);
|
||||
SELECT * FROM t1;
|
||||
BEGIN;
|
||||
} [list $aaa $bbb $ccc $ddd]
|
||||
|
||||
do_test 4.2 {
|
||||
set ::STMT [sqlite3_prepare db "SELECT * FROM t1 ORDER BY rowid" -1 dummy]
|
||||
sqlite3_step $::STMT
|
||||
sqlite3_column_text $::STMT 0
|
||||
} $aaa
|
||||
|
||||
do_test 4.3 {
|
||||
foreach r {2 3 4} {
|
||||
set fd [db incrblob t1 x $r]
|
||||
puts -nonewline $fd $eee
|
||||
close $fd
|
||||
}
|
||||
|
||||
set res [list]
|
||||
while {"SQLITE_ROW" == [sqlite3_step $::STMT]} {
|
||||
lappend res [sqlite3_column_text $::STMT 0]
|
||||
}
|
||||
set res
|
||||
} [list $eee $eee $eee]
|
||||
|
||||
do_test 4.4 {
|
||||
sqlite3_finalize $::STMT
|
||||
} SQLITE_OK
|
||||
|
||||
do_execsql_test 4.5 { COMMIT }
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Ensure that existing cursors holding xFetch() references are not
|
||||
# confused if those pages are moved to make way for the root page of a
|
||||
# new table or index.
|
||||
#
|
||||
reset_db
|
||||
do_execsql_test 5.1 {
|
||||
PRAGMA auto_vacuum = 2;
|
||||
PRAGMA page_size = 1024;
|
||||
CREATE TABLE t1(x);
|
||||
INSERT INTO t1 VALUES($aaa);
|
||||
INSERT INTO t1 VALUES($bbb);
|
||||
INSERT INTO t1 VALUES($ccc);
|
||||
INSERT INTO t1 VALUES($ddd);
|
||||
|
||||
PRAGMA auto_vacuum;
|
||||
SELECT * FROM t1;
|
||||
} [list 2 $aaa $bbb $ccc $ddd]
|
||||
|
||||
do_test 5.2 {
|
||||
set ::STMT [sqlite3_prepare db "SELECT * FROM t1 ORDER BY rowid" -1 dummy]
|
||||
sqlite3_step $::STMT
|
||||
sqlite3_column_text $::STMT 0
|
||||
} $aaa
|
||||
|
||||
do_execsql_test 5.3 {
|
||||
CREATE TABLE t2(x);
|
||||
INSERT INTO t2 VALUES('tricked you!');
|
||||
INSERT INTO t2 VALUES('tricked you!');
|
||||
}
|
||||
|
||||
do_test 5.4 {
|
||||
sqlite3_step $::STMT
|
||||
sqlite3_column_text $::STMT 0
|
||||
} $bbb
|
||||
|
||||
do_test 5.5 {
|
||||
sqlite3_finalize $::STMT
|
||||
} SQLITE_OK
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Test various mmap_limit settings.
|
||||
#
|
||||
foreach {tn1 mmap1 mmap2} {
|
||||
1 6144 167773
|
||||
2 18432 140399
|
||||
3 43008 401302
|
||||
4 92160 253899
|
||||
5 190464 2
|
||||
6 387072 752431
|
||||
7 780288 291143
|
||||
8 1566720 594306
|
||||
9 3139584 829137
|
||||
10 6285312 793963
|
||||
11 12576768 1015590
|
||||
} {
|
||||
do_multiclient_test tn {
|
||||
sql1 {
|
||||
CREATE TABLE t1(a PRIMARY KEY);
|
||||
CREATE TABLE t2(x);
|
||||
INSERT INTO t2 VALUES('');
|
||||
}
|
||||
|
||||
code1 [register_rblob_code db 0]
|
||||
code2 [register_rblob_code db2 444]
|
||||
|
||||
sql1 "PRAGMA mmap_limit = $mmap1"
|
||||
sql2 "PRAGMA mmap_limit = $mmap2"
|
||||
|
||||
do_test $tn1.$tn {
|
||||
for {set i 1} {$i <= 100} {incr i} {
|
||||
if {$i % 2} {
|
||||
set c1 sql1
|
||||
set c2 sql2
|
||||
} else {
|
||||
set c1 sql2
|
||||
set c2 sql1
|
||||
}
|
||||
|
||||
$c1 {
|
||||
INSERT INTO t1 VALUES( rblob(5000) );
|
||||
UPDATE t2 SET x = (SELECT md5sum(a) FROM t1);
|
||||
}
|
||||
|
||||
set res [$c2 {
|
||||
SELECT count(*) FROM t1;
|
||||
SELECT x == (SELECT md5sum(a) FROM t1) FROM t2;
|
||||
PRAGMA integrity_check;
|
||||
}]
|
||||
if {$res != [list $i 1 ok]} {
|
||||
do_test $tn1.$tn.$i {
|
||||
set ::res
|
||||
} [list $i 1 ok]
|
||||
}
|
||||
}
|
||||
set res 1
|
||||
} {1}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
finish_test
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
# 2013 March 20
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
#
|
||||
# This file tests the effect of the mmap() or mremap() system calls
|
||||
# returning an error on the library.
|
||||
#
|
||||
# If either mmap() or mremap() fails, SQLite should log an error
|
||||
# message, then continue accessing the database using read() and
|
||||
# write() exclusively.
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
set testprefix mmap2
|
||||
|
||||
if {$::tcl_platform(platform)!="unix" || [test_syscall defaultvfs] != "unix"} {
|
||||
finish_test
|
||||
return
|
||||
}
|
||||
ifcapable !mmap {
|
||||
finish_test
|
||||
return
|
||||
}
|
||||
|
||||
db close
|
||||
sqlite3_shutdown
|
||||
test_sqlite3_log xLog
|
||||
proc xLog {error_code msg} {
|
||||
if {[string match os_unix.c* $msg]} {
|
||||
lappend ::log $msg
|
||||
}
|
||||
}
|
||||
|
||||
foreach syscall {mmap mremap} {
|
||||
test_syscall uninstall
|
||||
if {[catch {test_syscall install $syscall}]} continue
|
||||
|
||||
for {set i 1} {$i < 20} {incr i} {
|
||||
reset_db
|
||||
|
||||
test_syscall fault $i 1
|
||||
test_syscall errno $syscall ENOMEM
|
||||
set ::log ""
|
||||
|
||||
do_execsql_test 1.$syscall.$i.1 {
|
||||
CREATE TABLE t1(a, b, UNIQUE(a, b));
|
||||
INSERT INTO t1 VALUES(randomblob(1000), randomblob(1000));
|
||||
INSERT INTO t1 SELECT randomblob(1000), randomblob(1000) FROM t1;
|
||||
INSERT INTO t1 SELECT randomblob(1000), randomblob(1000) FROM t1;
|
||||
INSERT INTO t1 SELECT randomblob(1000), randomblob(1000) FROM t1;
|
||||
INSERT INTO t1 SELECT randomblob(1000), randomblob(1000) FROM t1;
|
||||
INSERT INTO t1 SELECT randomblob(1000), randomblob(1000) FROM t1;
|
||||
INSERT INTO t1 SELECT randomblob(1000), randomblob(1000) FROM t1;
|
||||
}
|
||||
|
||||
set nFail [test_syscall fault 0 0]
|
||||
|
||||
do_execsql_test 1.$syscall.$i.2 {
|
||||
SELECT count(*) FROM t1;
|
||||
PRAGMA integrity_check;
|
||||
} {64 ok}
|
||||
|
||||
do_test 1.$syscall.$i.3 {
|
||||
expr {$nFail==0 || $nFail==1}
|
||||
} {1}
|
||||
|
||||
do_test 1.$syscall.$i.4.nFail=$nFail {
|
||||
regexp ".*${syscall}.*" $::log
|
||||
} [expr $nFail>0]
|
||||
}
|
||||
}
|
||||
|
||||
db close
|
||||
test_syscall uninstall
|
||||
sqlite3_shutdown
|
||||
test_sqlite3_log
|
||||
sqlite3_initialize
|
||||
finish_test
|
||||
@@ -0,0 +1,56 @@
|
||||
# 2013 March 26
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing that the optimizations that disable
|
||||
# ORDER BY clauses work correctly on multi-value primary keys and
|
||||
# unique indices when only some prefix of the terms in the key are
|
||||
# used. See ticket http://www.sqlite.org/src/info/a179fe74659
|
||||
#
|
||||
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
set ::testprefix orderby4
|
||||
|
||||
# Generate test data for a join. Verify that the join gets the
|
||||
# correct answer.
|
||||
#
|
||||
do_execsql_test 1.1 {
|
||||
CREATE TABLE t1(a, b, PRIMARY KEY(a,b));
|
||||
INSERT INTO t1 VALUES(1,1),(1,2);
|
||||
CREATE TABLE t2(x, y, PRIMARY KEY(x,y));
|
||||
INSERT INTO t2 VALUES(3,3),(4,4);
|
||||
SELECT a, x FROM t1, t2 ORDER BY 1, 2;
|
||||
} {1 3 1 3 1 4 1 4}
|
||||
do_execsql_test 1.2 {
|
||||
SELECT a, x FROM t1 CROSS JOIN t2 ORDER BY 1, 2;
|
||||
} {1 3 1 3 1 4 1 4}
|
||||
do_execsql_test 1.3 {
|
||||
SELECT a, x FROM t2 CROSS JOIN t1 ORDER BY 1, 2;
|
||||
} {1 3 1 3 1 4 1 4}
|
||||
|
||||
do_execsql_test 2.1 {
|
||||
CREATE TABLE t3(a);
|
||||
INSERT INTO t3 VALUES(1),(1);
|
||||
CREATE INDEX t3a ON t3(a);
|
||||
CREATE TABLE t4(x);
|
||||
INSERT INTO t4 VALUES(3),(4);
|
||||
CREATE INDEX t4x ON t4(x);
|
||||
SELECT a, x FROM t3, t4 ORDER BY 1, 2;
|
||||
} {1 3 1 3 1 4 1 4}
|
||||
do_execsql_test 2.2 {
|
||||
SELECT a, x FROM t3 CROSS JOIN t4 ORDER BY 1, 2;
|
||||
} {1 3 1 3 1 4 1 4}
|
||||
do_execsql_test 2.3 {
|
||||
SELECT a, x FROM t4 CROSS JOIN t3 ORDER BY 1, 2;
|
||||
} {1 3 1 3 1 4 1 4}
|
||||
|
||||
finish_test
|
||||
+303
-12
@@ -15,6 +15,7 @@ source $testdir/tester.tcl
|
||||
source $testdir/lock_common.tcl
|
||||
source $testdir/malloc_common.tcl
|
||||
source $testdir/wal_common.tcl
|
||||
set testprefix pager1
|
||||
|
||||
# Do not use a codec for tests in this file, as the database file is
|
||||
# manipulated directly using tcl scripts (using the [hexio_write] command).
|
||||
@@ -1109,7 +1110,6 @@ do_test pager1-5.5.2 {
|
||||
do_test pager1-6.1 {
|
||||
faultsim_delete_and_reopen
|
||||
execsql {
|
||||
PRAGMA page_size = 4096;
|
||||
PRAGMA auto_vacuum = none;
|
||||
PRAGMA max_page_count = 10;
|
||||
CREATE TABLE t2(a, b);
|
||||
@@ -1358,8 +1358,8 @@ do_test pager1-9.3.3 {
|
||||
db2 close
|
||||
db close
|
||||
tv delete
|
||||
file_page_count test.db2
|
||||
} [file_page_count test.db]
|
||||
file size test.db2
|
||||
} [file size test.db]
|
||||
|
||||
do_test pager1-9.4.1 {
|
||||
faultsim_delete_and_reopen
|
||||
@@ -1383,6 +1383,7 @@ db2 close
|
||||
#
|
||||
testvfs tv -default 1
|
||||
foreach sectorsize {
|
||||
16
|
||||
32 64 128 256 512 1024 2048
|
||||
4096 8192 16384 32768 65536 131072 262144
|
||||
} {
|
||||
@@ -1405,7 +1406,7 @@ foreach sectorsize {
|
||||
COMMIT;
|
||||
}
|
||||
file size test.db-journal
|
||||
} [expr $sectorsize > 65536 ? 65536 : $sectorsize]
|
||||
} [expr $sectorsize > 65536 ? 65536 : ($sectorsize<32 ? 512 : $sectorsize)]
|
||||
|
||||
do_test pager1-10.$sectorsize.2 {
|
||||
execsql {
|
||||
@@ -1472,8 +1473,8 @@ do_test pager1.10.x.2 {
|
||||
CREATE TABLE t2(x);
|
||||
DROP TABLE t2;
|
||||
}
|
||||
list [file_page_count test.db] [file_page_size test.db]
|
||||
} {33 1024}
|
||||
file size test.db
|
||||
} {33792}
|
||||
do_test pager1.10.x.3 {
|
||||
execsql {
|
||||
BEGIN;
|
||||
@@ -1553,7 +1554,7 @@ foreach pagesize {
|
||||
PRAGMA page_size = $pagesize;
|
||||
CREATE VIEW v AS SELECT * FROM sqlite_master;
|
||||
" db2
|
||||
file_page_size test.db
|
||||
file size test.db
|
||||
} $eff
|
||||
do_test pager1-12.$pagesize.2 {
|
||||
sqlite3 db2 test.db
|
||||
@@ -2244,7 +2245,6 @@ do_test pager1-25-1 {
|
||||
}
|
||||
db close
|
||||
} {}
|
||||
breakpoint
|
||||
do_test pager1-25-2 {
|
||||
faultsim_delete_and_reopen
|
||||
execsql {
|
||||
@@ -2389,15 +2389,15 @@ do_test pager1-29.1 {
|
||||
CREATE TABLE t1(a, b);
|
||||
INSERT INTO t1 VALUES(1, 2);
|
||||
}
|
||||
list [file_page_count test.db] [file_page_size test.db]
|
||||
} {3 1024}
|
||||
file size test.db
|
||||
} [expr 1024*3]
|
||||
do_test pager1-29.2 {
|
||||
execsql {
|
||||
PRAGMA page_size = 4096;
|
||||
VACUUM;
|
||||
}
|
||||
list [file_page_count test.db] [file_page_size test.db]
|
||||
} {3 4096}
|
||||
file size test.db
|
||||
} [expr 4096*3]
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Test that if an empty database file (size 0 bytes) is opened in
|
||||
@@ -2524,4 +2524,295 @@ if {$::tcl_platform(platform)=="unix"} {
|
||||
} {one two}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Test that appending pages to the database file then moving those pages
|
||||
# to the free-list before the transaction is committed does not cause
|
||||
# an error.
|
||||
#
|
||||
foreach {tn pragma strsize} {
|
||||
1 { PRAGMA mmap_limit = 0 } 2400
|
||||
2 { } 2400
|
||||
3 { PRAGMA mmap_limit = 0 } 4400
|
||||
4 { } 4400
|
||||
} {
|
||||
reset_db
|
||||
db func a_string a_string
|
||||
db eval $pragma
|
||||
do_execsql_test 34.$tn.1 {
|
||||
CREATE TABLE t1(a, b);
|
||||
INSERT INTO t1 VALUES(1, 2);
|
||||
}
|
||||
do_execsql_test 34.$tn.2 {
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES(2, a_string($strsize));
|
||||
DELETE FROM t1 WHERE oid=2;
|
||||
COMMIT;
|
||||
PRAGMA integrity_check;
|
||||
} {ok}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
reset_db
|
||||
do_test 35 {
|
||||
sqlite3 db test.db
|
||||
|
||||
execsql {
|
||||
CREATE TABLE t1(x, y);
|
||||
PRAGMA journal_mode = WAL;
|
||||
INSERT INTO t1 VALUES(1, 2);
|
||||
}
|
||||
|
||||
execsql {
|
||||
BEGIN;
|
||||
CREATE TABLE t2(a, b);
|
||||
}
|
||||
|
||||
hexio_write test.db-shm [expr 16*1024] [string repeat 0055 8192]
|
||||
catchsql ROLLBACK
|
||||
} {0 {}}
|
||||
|
||||
do_multiclient_test tn {
|
||||
sql1 {
|
||||
PRAGMA auto_vacuum = 0;
|
||||
CREATE TABLE t1(x, y);
|
||||
INSERT INTO t1 VALUES(1, 2);
|
||||
}
|
||||
|
||||
do_test 36.$tn.1 {
|
||||
sql2 { PRAGMA max_page_count = 2 }
|
||||
list [catch { sql2 { CREATE TABLE t2(x) } } msg] $msg
|
||||
} {1 {database or disk is full}}
|
||||
|
||||
sql1 { PRAGMA checkpoint_fullfsync = 1 }
|
||||
sql1 { CREATE TABLE t2(x) }
|
||||
|
||||
do_test 36.$tn.2 {
|
||||
sql2 { INSERT INTO t2 VALUES('xyz') }
|
||||
list [catch { sql2 { CREATE TABLE t3(x) } } msg] $msg
|
||||
} {1 {database or disk is full}}
|
||||
}
|
||||
|
||||
forcedelete test1 test2
|
||||
foreach {tn uri} {
|
||||
1 {file:?mode=memory&cache=shared}
|
||||
2 {file:one?mode=memory&cache=shared}
|
||||
3 {file:test1?cache=shared}
|
||||
4 {file:test2?another=parameter&yet=anotherone}
|
||||
} {
|
||||
do_test 37.$tn {
|
||||
catch { db close }
|
||||
sqlite3_shutdown
|
||||
sqlite3_config_uri 1
|
||||
sqlite3 db $uri
|
||||
|
||||
db eval {
|
||||
CREATE TABLE t1(x);
|
||||
INSERT INTO t1 VALUES(1);
|
||||
SELECT * FROM t1;
|
||||
}
|
||||
} {1}
|
||||
|
||||
do_execsql_test 37.$tn.2 {
|
||||
VACUUM;
|
||||
SELECT * FROM t1;
|
||||
} {1}
|
||||
|
||||
db close
|
||||
sqlite3_shutdown
|
||||
sqlite3_config_uri 0
|
||||
}
|
||||
|
||||
do_test 38.1 {
|
||||
catch { db close }
|
||||
forcedelete test.db
|
||||
set fd [open test.db w]
|
||||
puts $fd "hello world"
|
||||
close $fd
|
||||
sqlite3 db test.db
|
||||
catchsql { CREATE TABLE t1(x) }
|
||||
} {1 {file is encrypted or is not a database}}
|
||||
do_test 38.2 {
|
||||
catch { db close }
|
||||
forcedelete test.db
|
||||
} {}
|
||||
|
||||
do_test 39.1 {
|
||||
sqlite3 db test.db
|
||||
execsql {
|
||||
PRAGMA auto_vacuum = 1;
|
||||
CREATE TABLE t1(x);
|
||||
INSERT INTO t1 VALUES('xxx');
|
||||
INSERT INTO t1 VALUES('two');
|
||||
INSERT INTO t1 VALUES(randomblob(400));
|
||||
INSERT INTO t1 VALUES(randomblob(400));
|
||||
INSERT INTO t1 VALUES(randomblob(400));
|
||||
INSERT INTO t1 VALUES(randomblob(400));
|
||||
BEGIN;
|
||||
UPDATE t1 SET x = 'one' WHERE rowid=1;
|
||||
}
|
||||
set ::stmt [sqlite3_prepare db "SELECT * FROM t1 ORDER BY rowid" -1 dummy]
|
||||
sqlite3_step $::stmt
|
||||
sqlite3_column_text $::stmt 0
|
||||
} {one}
|
||||
do_test 39.2 {
|
||||
execsql { CREATE TABLE t2(x) }
|
||||
sqlite3_step $::stmt
|
||||
sqlite3_column_text $::stmt 0
|
||||
} {two}
|
||||
do_test 39.3 {
|
||||
sqlite3_finalize $::stmt
|
||||
execsql COMMIT
|
||||
} {}
|
||||
|
||||
do_execsql_test 39.4 {
|
||||
PRAGMA auto_vacuum = 2;
|
||||
CREATE TABLE t3(x);
|
||||
CREATE TABLE t4(x);
|
||||
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t3;
|
||||
DROP TABLE t4;
|
||||
}
|
||||
do_test 39.5 {
|
||||
db close
|
||||
sqlite3 db test.db
|
||||
execsql {
|
||||
PRAGMA cache_size = 1;
|
||||
PRAGMA incremental_vacuum;
|
||||
PRAGMA integrity_check;
|
||||
}
|
||||
} {ok}
|
||||
|
||||
do_test 40.1 {
|
||||
reset_db
|
||||
execsql {
|
||||
PRAGMA auto_vacuum = 1;
|
||||
CREATE TABLE t1(x PRIMARY KEY);
|
||||
INSERT INTO t1 VALUES(randomblob(1200));
|
||||
PRAGMA page_count;
|
||||
}
|
||||
} {6}
|
||||
do_test 40.2 {
|
||||
execsql {
|
||||
INSERT INTO t1 VALUES(randomblob(1200));
|
||||
INSERT INTO t1 VALUES(randomblob(1200));
|
||||
INSERT INTO t1 VALUES(randomblob(1200));
|
||||
}
|
||||
} {}
|
||||
do_test 40.3 {
|
||||
db close
|
||||
sqlite3 db test.db
|
||||
execsql {
|
||||
PRAGMA cache_size = 1;
|
||||
CREATE TABLE t2(x);
|
||||
PRAGMA integrity_check;
|
||||
}
|
||||
} {ok}
|
||||
|
||||
do_test 41.1 {
|
||||
reset_db
|
||||
execsql {
|
||||
CREATE TABLE t1(x PRIMARY KEY);
|
||||
INSERT INTO t1 VALUES(randomblob(200));
|
||||
INSERT INTO t1 SELECT randomblob(200) FROM t1;
|
||||
INSERT INTO t1 SELECT randomblob(200) FROM t1;
|
||||
INSERT INTO t1 SELECT randomblob(200) FROM t1;
|
||||
INSERT INTO t1 SELECT randomblob(200) FROM t1;
|
||||
INSERT INTO t1 SELECT randomblob(200) FROM t1;
|
||||
INSERT INTO t1 SELECT randomblob(200) FROM t1;
|
||||
}
|
||||
} {}
|
||||
do_test 41.2 {
|
||||
testvfs tv -default 1
|
||||
tv sectorsize 16384;
|
||||
tv devchar [list]
|
||||
db close
|
||||
sqlite3 db test.db
|
||||
execsql {
|
||||
PRAGMA cache_size = 1;
|
||||
DELETE FROM t1 WHERE rowid%4;
|
||||
PRAGMA integrity_check;
|
||||
}
|
||||
} {ok}
|
||||
db close
|
||||
tv delete
|
||||
|
||||
set pending_prev [sqlite3_test_control_pending_byte 0x1000000]
|
||||
do_test 42.1 {
|
||||
reset_db
|
||||
execsql {
|
||||
CREATE TABLE t1(x, y);
|
||||
INSERT INTO t1 VALUES(randomblob(200), randomblob(200));
|
||||
INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1;
|
||||
INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1;
|
||||
INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1;
|
||||
INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1;
|
||||
INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1;
|
||||
INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1;
|
||||
INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1;
|
||||
INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1;
|
||||
INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1;
|
||||
}
|
||||
db close
|
||||
sqlite3_test_control_pending_byte 0x0010000
|
||||
sqlite3 db test.db
|
||||
db eval { PRAGMA mmap_limit = 0 }
|
||||
catchsql { SELECT sum(length(y)) FROM t1 }
|
||||
} {1 {database disk image is malformed}}
|
||||
do_test 42.2 {
|
||||
reset_db
|
||||
execsql {
|
||||
CREATE TABLE t1(x, y);
|
||||
INSERT INTO t1 VALUES(randomblob(200), randomblob(200));
|
||||
INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1;
|
||||
INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1;
|
||||
INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1;
|
||||
INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1;
|
||||
INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1;
|
||||
INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1;
|
||||
INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1;
|
||||
INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1;
|
||||
}
|
||||
db close
|
||||
|
||||
testvfs tv -default 1
|
||||
tv sectorsize 16384;
|
||||
tv devchar [list]
|
||||
sqlite3 db test.db -vfs tv
|
||||
execsql { UPDATE t1 SET x = randomblob(200) }
|
||||
} {}
|
||||
db close
|
||||
tv delete
|
||||
sqlite3_test_control_pending_byte $pending_prev
|
||||
|
||||
do_test 43.1 {
|
||||
reset_db
|
||||
execsql {
|
||||
CREATE TABLE t1(x, y);
|
||||
INSERT INTO t1 VALUES(1, 2);
|
||||
CREATE TABLE t2(x, y);
|
||||
INSERT INTO t2 VALUES(1, 2);
|
||||
CREATE TABLE t3(x, y);
|
||||
INSERT INTO t3 VALUES(1, 2);
|
||||
}
|
||||
db close
|
||||
sqlite3 db test.db
|
||||
|
||||
db eval { PRAGMA mmap_limit = 0 }
|
||||
db eval { SELECT * FROM t1 }
|
||||
sqlite3_db_status db CACHE_MISS 0
|
||||
} {0 2 0}
|
||||
|
||||
do_test 43.2 {
|
||||
db eval { SELECT * FROM t2 }
|
||||
sqlite3_db_status db CACHE_MISS 1
|
||||
} {0 3 0}
|
||||
|
||||
do_test 43.3 {
|
||||
db eval { SELECT * FROM t3 }
|
||||
sqlite3_db_status db CACHE_MISS 0
|
||||
} {0 1 0}
|
||||
|
||||
finish_test
|
||||
|
||||
|
||||
+18
-1
@@ -118,7 +118,6 @@ tv delete
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# pager2-2.1: Test a ROLLBACK with journal_mode=off.
|
||||
# pager2-2.2: Test shrinking the database (auto-vacuum) with
|
||||
# journal_mode=off
|
||||
@@ -148,4 +147,22 @@ do_test pager2-2.2 {
|
||||
file size test.db
|
||||
} {3072}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Test that shared in-memory databases seem to work.
|
||||
#
|
||||
db close
|
||||
do_test pager2-3.1 {
|
||||
forcedelete test.db
|
||||
sqlite3_shutdown
|
||||
sqlite3_config_uri 1
|
||||
|
||||
sqlite3 db1 {file:test.db?mode=memory&cache=shared}
|
||||
sqlite3 db2 {file:test.db?mode=memory&cache=shared}
|
||||
sqlite3 db3 test.db
|
||||
|
||||
db1 eval { CREATE TABLE t1(a, b) }
|
||||
db2 eval { INSERT INTO t1 VALUES(1, 2) }
|
||||
list [catch { db3 eval { INSERT INTO t1 VALUES(3, 4) } } msg] $msg
|
||||
} {1 {no such table: t1}}
|
||||
|
||||
finish_test
|
||||
|
||||
+304
-6
@@ -1201,13 +1201,12 @@ do_faultsim_test pagerfault-26 -prep {
|
||||
set contents [db eval {SELECT * FROM t1}]
|
||||
if {$contents != "1 2"} { error "Bad database contents ($contents)" }
|
||||
|
||||
set nPg [file_page_count test.db]
|
||||
set pgsz [file_page_size test.db]
|
||||
if {$testrc!=0 && ($nPg!=3 || ($pgsz!=1024 && $pgsz!=4096))} {
|
||||
error "File should be 3 pages. Page size 1024 or 4096 bytes. Is $nPg/$pgsz."
|
||||
set sz [file size test.db]
|
||||
if {$testrc!=0 && $sz!=1024*3 && $sz!=4096*3} {
|
||||
error "Expected file size to be 3072 or 12288 bytes - actual size $sz bytes"
|
||||
}
|
||||
if {$testrc==0 && ($nPg!=3 || $pgsz!=4096)} {
|
||||
error "File should be 3 pages. Page size 4096 bytes. Is $nPg/$pgsz."
|
||||
if {$testrc==0 && $sz!=4096*3} {
|
||||
error "Expected file size to be 12288 bytes - actual size $sz bytes"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1247,5 +1246,304 @@ do_faultsim_test pagerfault-27 -faults ioerr-persistent -prep {
|
||||
faultsim_integrity_check
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
do_test pagerfault-28-pre {
|
||||
faultsim_delete_and_reopen
|
||||
db func a_string a_string
|
||||
execsql {
|
||||
PRAGMA page_size = 512;
|
||||
|
||||
PRAGMA journal_mode = wal;
|
||||
PRAGMA wal_autocheckpoint = 0;
|
||||
PRAGMA cache_size = 100000;
|
||||
|
||||
BEGIN;
|
||||
CREATE TABLE t2(a UNIQUE, b UNIQUE);
|
||||
INSERT INTO t2 VALUES( a_string(800), a_string(800) );
|
||||
INSERT INTO t2 SELECT a_string(800), a_string(800) FROM t2;
|
||||
INSERT INTO t2 SELECT a_string(800), a_string(800) FROM t2;
|
||||
INSERT INTO t2 SELECT a_string(800), a_string(800) FROM t2;
|
||||
INSERT INTO t2 SELECT a_string(800), a_string(800) FROM t2;
|
||||
INSERT INTO t2 SELECT a_string(800), a_string(800) FROM t2;
|
||||
INSERT INTO t2 SELECT a_string(800), a_string(800) FROM t2;
|
||||
INSERT INTO t2 SELECT a_string(800), a_string(800) FROM t2;
|
||||
INSERT INTO t2 SELECT a_string(800), a_string(800) FROM t2;
|
||||
INSERT INTO t2 SELECT a_string(800), a_string(800) FROM t2;
|
||||
INSERT INTO t2 SELECT a_string(800), a_string(800) FROM t2;
|
||||
INSERT INTO t2 SELECT a_string(800), a_string(800) FROM t2;
|
||||
COMMIT;
|
||||
CREATE TABLE t1(a PRIMARY KEY, b);
|
||||
}
|
||||
expr {[file size test.db-shm] >= 96*1024}
|
||||
} {1}
|
||||
faultsim_save_and_close
|
||||
|
||||
do_faultsim_test pagerfault-28a -faults oom* -prep {
|
||||
faultsim_restore_and_reopen
|
||||
execsql { PRAGMA mmap_limit=0 }
|
||||
|
||||
sqlite3 db2 test.db
|
||||
db2 eval { SELECT count(*) FROM t2 }
|
||||
|
||||
db func a_string a_string
|
||||
execsql {
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES(a_string(2000), a_string(2000));
|
||||
INSERT INTO t1 VALUES(a_string(2000), a_string(2000));
|
||||
}
|
||||
set ::STMT [sqlite3_prepare db "SELECT * FROM t1 ORDER BY a" -1 DUMMY]
|
||||
sqlite3_step $::STMT
|
||||
} -body {
|
||||
execsql { ROLLBACK }
|
||||
} -test {
|
||||
db2 close
|
||||
sqlite3_finalize $::STMT
|
||||
catchsql { ROLLBACK }
|
||||
faultsim_integrity_check
|
||||
}
|
||||
|
||||
faultsim_restore_and_reopen
|
||||
sqlite3 db2 test.db
|
||||
db2 eval {SELECT count(*) FROM t2}
|
||||
db close
|
||||
|
||||
do_faultsim_test pagerfault-28b -faults oom* -prep {
|
||||
sqlite3 db test.db
|
||||
} -body {
|
||||
execsql { SELECT count(*) FROM t2 }
|
||||
} -test {
|
||||
faultsim_test_result {0 2048}
|
||||
db close
|
||||
}
|
||||
|
||||
db2 close
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Try this:
|
||||
#
|
||||
# 1) Put the pager in ERROR state (error during rollback)
|
||||
#
|
||||
# 2) Next time the connection is used inject errors into all xWrite() and
|
||||
# xUnlock() calls. This causes the hot-journal rollback to fail and
|
||||
# the pager to declare its locking state UNKNOWN.
|
||||
#
|
||||
# 3) Same again.
|
||||
#
|
||||
# 4a) Stop injecting errors. Allow the rollback to succeed. Check that
|
||||
# the database is Ok. Or,
|
||||
#
|
||||
# 4b) Close and reopen the db. Check that the db is Ok.
|
||||
#
|
||||
proc custom_injectinstall {} {
|
||||
testvfs custom -default true
|
||||
custom filter {xWrite xUnlock}
|
||||
}
|
||||
proc custom_injectuninstall {} {
|
||||
catch {db close}
|
||||
catch {db2 close}
|
||||
custom delete
|
||||
}
|
||||
proc custom_injectstart {iFail} {
|
||||
custom ioerr $iFail 1
|
||||
}
|
||||
proc custom_injectstop {} {
|
||||
custom ioerr
|
||||
}
|
||||
set ::FAULTSIM(custom) [list \
|
||||
-injectinstall custom_injectinstall \
|
||||
-injectstart custom_injectstart \
|
||||
-injectstop custom_injectstop \
|
||||
-injecterrlist {{1 {disk I/O error}}} \
|
||||
-injectuninstall custom_injectuninstall \
|
||||
]
|
||||
|
||||
do_test pagerfault-29-pre {
|
||||
faultsim_delete_and_reopen
|
||||
db func a_string a_string
|
||||
execsql {
|
||||
PRAGMA page_size = 1024;
|
||||
PRAGMA cache_size = 5;
|
||||
|
||||
BEGIN;
|
||||
CREATE TABLE t2(a UNIQUE, b UNIQUE);
|
||||
INSERT INTO t2 VALUES( a_string(800), a_string(800) );
|
||||
INSERT INTO t2 SELECT a_string(800), a_string(800) FROM t2;
|
||||
INSERT INTO t2 SELECT a_string(800), a_string(800) FROM t2;
|
||||
INSERT INTO t2 SELECT a_string(800), a_string(800) FROM t2;
|
||||
INSERT INTO t2 SELECT a_string(800), a_string(800) FROM t2;
|
||||
COMMIT;
|
||||
}
|
||||
expr {[file size test.db] >= 50*1024}
|
||||
} {1}
|
||||
faultsim_save_and_close
|
||||
foreach {tn tt} {
|
||||
29 { catchsql ROLLBACK }
|
||||
30 { db close ; sqlite3 db test.db }
|
||||
} {
|
||||
do_faultsim_test pagerfault-$tn -faults custom -prep {
|
||||
faultsim_restore_and_reopen
|
||||
db func a_string a_string
|
||||
execsql {
|
||||
PRAGMA cache_size = 5;
|
||||
BEGIN;
|
||||
UPDATE t2 SET a = a_string(799);
|
||||
}
|
||||
} -body {
|
||||
catchsql ROLLBACK
|
||||
catchsql ROLLBACK
|
||||
catchsql ROLLBACK
|
||||
} -test {
|
||||
eval $::tt
|
||||
if {"ok" != [db one {PRAGMA integrity_check}]} {
|
||||
error "integrity check failed"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
do_test pagerfault-31-pre {
|
||||
sqlite3_shutdown
|
||||
sqlite3_config_uri 1
|
||||
} {SQLITE_OK}
|
||||
do_faultsim_test pagerfault-31 -faults oom* -body {
|
||||
sqlite3 db {file:one?mode=memory&cache=shared}
|
||||
db eval {
|
||||
CREATE TABLE t1(x);
|
||||
INSERT INTO t1 VALUES(1);
|
||||
SELECT * FROM t1;
|
||||
}
|
||||
} -test {
|
||||
faultsim_test_result {0 1} {1 {}}
|
||||
catch { db close }
|
||||
}
|
||||
sqlite3_shutdown
|
||||
sqlite3_config_uri 0
|
||||
|
||||
do_test pagerfault-32-pre {
|
||||
reset_db
|
||||
execsql {
|
||||
CREATE TABLE t1(x);
|
||||
INSERT INTO t1 VALUES('one');
|
||||
}
|
||||
} {}
|
||||
faultsim_save_and_close
|
||||
|
||||
do_faultsim_test pagerfault-32 -prep {
|
||||
faultsim_restore_and_reopen
|
||||
db eval { SELECT * FROM t1; }
|
||||
} -body {
|
||||
execsql { SELECT * FROM t1; }
|
||||
} -test {
|
||||
faultsim_test_result {0 one}
|
||||
}
|
||||
sqlite3_shutdown
|
||||
sqlite3_config_uri 0
|
||||
|
||||
do_faultsim_test pagerfault-33a -prep {
|
||||
sqlite3 db :memory:
|
||||
execsql {
|
||||
CREATE TABLE t1(a, b);
|
||||
INSERT INTO t1 VALUES(1, 2);
|
||||
}
|
||||
} -body {
|
||||
execsql { VACUUM }
|
||||
} -test {
|
||||
faultsim_test_result {0 {}}
|
||||
}
|
||||
do_faultsim_test pagerfault-33b -prep {
|
||||
sqlite3 db ""
|
||||
execsql {
|
||||
CREATE TABLE t1(a, b);
|
||||
INSERT INTO t1 VALUES(1, 2);
|
||||
}
|
||||
} -body {
|
||||
execsql { VACUUM }
|
||||
} -test {
|
||||
faultsim_test_result {0 {}}
|
||||
}
|
||||
|
||||
do_test pagerfault-34-pre {
|
||||
reset_db
|
||||
execsql {
|
||||
CREATE TABLE t1(x PRIMARY KEY);
|
||||
}
|
||||
} {}
|
||||
faultsim_save_and_close
|
||||
do_faultsim_test pagerfault-34 -prep {
|
||||
faultsim_restore_and_reopen
|
||||
execsql {
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES( randomblob(4000) );
|
||||
DELETE FROM t1;
|
||||
}
|
||||
} -body {
|
||||
execsql COMMIT
|
||||
} -test {
|
||||
faultsim_test_result {0 {}}
|
||||
}
|
||||
|
||||
do_test pagerfault-35-pre {
|
||||
faultsim_delete_and_reopen
|
||||
execsql {
|
||||
CREATE TABLE t1(x PRIMARY KEY, y);
|
||||
INSERT INTO t1 VALUES(randomblob(200), randomblob(200));
|
||||
INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1;
|
||||
INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1;
|
||||
INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1;
|
||||
}
|
||||
faultsim_save_and_close
|
||||
} {}
|
||||
testvfs tv -default 1
|
||||
tv sectorsize 8192;
|
||||
tv devchar [list]
|
||||
do_faultsim_test pagerfault-35 -prep {
|
||||
faultsim_restore_and_reopen
|
||||
} -body {
|
||||
execsql { UPDATE t1 SET x=randomblob(200) }
|
||||
} -test {
|
||||
faultsim_test_result {0 {}}
|
||||
}
|
||||
catch {db close}
|
||||
tv delete
|
||||
|
||||
sqlite3_shutdown
|
||||
sqlite3_config_uri 1
|
||||
do_test pagerfault-36-pre {
|
||||
faultsim_delete_and_reopen
|
||||
execsql {
|
||||
CREATE TABLE t1(x PRIMARY KEY, y);
|
||||
INSERT INTO t1 VALUES(randomblob(200), randomblob(200));
|
||||
INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1;
|
||||
INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1;
|
||||
INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1;
|
||||
}
|
||||
faultsim_save_and_close
|
||||
} {}
|
||||
do_faultsim_test pagerfault-36 -prep {
|
||||
faultsim_restore
|
||||
sqlite3 db file:test.db?cache=shared
|
||||
sqlite3 db2 file:test.db?cache=shared
|
||||
db2 eval {
|
||||
BEGIN;
|
||||
SELECT count(*) FROM sqlite_master;
|
||||
}
|
||||
db eval {
|
||||
PRAGMA cache_size = 1;
|
||||
BEGIN;
|
||||
UPDATE t1 SET x = randomblob(200);
|
||||
}
|
||||
} -body {
|
||||
execsql ROLLBACK db
|
||||
} -test {
|
||||
catch { db eval {UPDATE t1 SET x = randomblob(200)} }
|
||||
faultsim_test_result {0 {}}
|
||||
catch { db close }
|
||||
catch { db2 close }
|
||||
}
|
||||
|
||||
sqlite3_shutdown
|
||||
sqlite3_config_uri 0
|
||||
|
||||
finish_test
|
||||
|
||||
|
||||
+6
-1
@@ -87,12 +87,17 @@ do_test pageropt-1.4 {
|
||||
# But if the other thread modifies the database, then the cache
|
||||
# must refill.
|
||||
#
|
||||
ifcapable mmap {
|
||||
set x [expr {[permutation]=="nommap" ? 6 : 1}]
|
||||
} else {
|
||||
set x 6
|
||||
}
|
||||
do_test pageropt-1.5 {
|
||||
db2 eval {CREATE TABLE t2(y)}
|
||||
pagercount_sql {
|
||||
SELECT hex(x) FROM t1
|
||||
}
|
||||
} [list [expr {[permutation]=="nommap" ? 6 : 1}] 0 0 $blobcontent]
|
||||
} [list $x 0 0 $blobcontent]
|
||||
do_test pageropt-1.6 {
|
||||
pagercount_sql {
|
||||
SELECT hex(x) FROM t1
|
||||
|
||||
+2
-2
@@ -115,8 +115,8 @@ foreach PGSZ {512 2048 4096 8192} {
|
||||
}
|
||||
} $PGSZ
|
||||
do_test pagesize-2.$PGSZ.3 {
|
||||
list [file_page_count test.db] [file_page_size test.db]
|
||||
} [list [expr ($AUTOVACUUM?3:2)] $PGSZ]
|
||||
file size test.db
|
||||
} [expr {$PGSZ*($AUTOVACUUM?3:2)}]
|
||||
ifcapable {vacuum} {
|
||||
do_test pagesize-2.$PGSZ.4 {
|
||||
execsql {VACUUM}
|
||||
|
||||
@@ -168,7 +168,7 @@ test_suite "full" -prefix "" -description {
|
||||
} -files [
|
||||
test_set $alltests
|
||||
] -initialize {
|
||||
# unset -nocomplain ::G(isquick)
|
||||
unset -nocomplain ::G(isquick)
|
||||
}
|
||||
|
||||
test_suite "threads" -prefix "" -description {
|
||||
|
||||
+2
-4
@@ -262,7 +262,6 @@ do_test pragma-3.1 {
|
||||
forcedelete test.db test.db-journal
|
||||
sqlite3 db test.db
|
||||
execsql {
|
||||
PRAGMA mmap_limit=0;
|
||||
PRAGMA auto_vacuum=OFF;
|
||||
BEGIN;
|
||||
CREATE TABLE t2(a,b,c);
|
||||
@@ -285,7 +284,6 @@ ifcapable attach {
|
||||
hexio_write test.db $offset 0a00000000040000000000
|
||||
db close
|
||||
sqlite3 db test.db
|
||||
execsql {PRAGMA mmap_limit=0}
|
||||
execsql {PRAGMA integrity_check}
|
||||
} {{rowid 1 missing from index i2} {rowid 2 missing from index i2} {wrong # of entries in index i2}}
|
||||
do_test pragma-3.3 {
|
||||
@@ -1253,8 +1251,8 @@ ifcapable pager_pragmas {
|
||||
|
||||
do_test pragma-14.4 {
|
||||
set page_size [db one {pragma page_size}]
|
||||
list [file_page_count test.db] $page_size
|
||||
} [list 2 [file_page_size test.db]]
|
||||
expr [file size test.db] / $page_size
|
||||
} {2}
|
||||
|
||||
do_test pragma-14.5 {
|
||||
execsql {
|
||||
|
||||
+2
-2
@@ -86,8 +86,8 @@ ifcapable attach {
|
||||
}
|
||||
} {0}
|
||||
do_test pragma2-2.4 {
|
||||
list [file_page_count test2.db] [file_page_size test2.db]
|
||||
} {11 1024}
|
||||
expr {[file size test2.db] / 1024}
|
||||
} {11}
|
||||
do_test pragma2-2.5 {
|
||||
execsql {
|
||||
DELETE FROM aux.abc;
|
||||
|
||||
@@ -71,7 +71,6 @@ do_test quota-2.1.1 {
|
||||
do_test quota-2.1.2 {
|
||||
sqlite3 db test.db
|
||||
execsql {
|
||||
PRAGMA mmap_limit=0;
|
||||
PRAGMA page_size=1024;
|
||||
PRAGMA auto_vacuum=OFF;
|
||||
PRAGMA journal_mode=DELETE;
|
||||
@@ -144,7 +143,6 @@ do_test quota-3.1.1 {
|
||||
do_test quota-3.1.2 {
|
||||
sqlite3 db test.db
|
||||
execsql {
|
||||
PRAGMA mmap_limit = 0;
|
||||
PRAGMA page_size = 1024;
|
||||
PRAGMA journal_mode = delete;
|
||||
PRAGMA auto_vacuum = off;
|
||||
@@ -156,7 +154,6 @@ do_test quota-3.1.2 {
|
||||
do_test quota-3.1.3 {
|
||||
sqlite3 db2 test.db
|
||||
set ::quota [list]
|
||||
execsql { PRAGMA mmap_limit=0 } db2
|
||||
execsql { CREATE TABLE t2(a, b) } db2
|
||||
set ::quota
|
||||
} {}
|
||||
@@ -182,7 +179,6 @@ do_test quota-3.2.1 {
|
||||
|
||||
foreach db {db1a db2a} {
|
||||
execsql {
|
||||
PRAGMA mmap_limit=0;
|
||||
PRAGMA page_size = 1024;
|
||||
PRAGMA journal_mode = delete;
|
||||
PRAGMA auto_vacuum = off;
|
||||
|
||||
+2
-1
@@ -24,6 +24,8 @@ set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
speed_trial_init speed1
|
||||
|
||||
sqlite3_memdebug_vfs_oom_test 0
|
||||
|
||||
# Set a uniform random seed
|
||||
expr srand(0)
|
||||
|
||||
@@ -78,7 +80,6 @@ do_test speed1p-1.0 {
|
||||
}
|
||||
} {i2a i2b t1 t2}
|
||||
|
||||
|
||||
# 50000 INSERTs on an unindexed table
|
||||
#
|
||||
set list {}
|
||||
|
||||
@@ -534,7 +534,7 @@ do_test sqllimits1-7.7.1 {
|
||||
INSERT INTO abc SELECT b, a, c FROM abc;
|
||||
INSERT INTO abc SELECT c, b, a FROM abc;
|
||||
}
|
||||
file_page_count test.db
|
||||
expr [file size test.db] / 1024
|
||||
} $fsize
|
||||
do_test sqllimits1-7.7.2 {
|
||||
db close
|
||||
@@ -550,7 +550,7 @@ do_test sqllimits1-7.7.3 {
|
||||
execsql {
|
||||
PRAGMA max_page_count;
|
||||
}
|
||||
} [expr [file size test.db] / 1024]
|
||||
} $fsize
|
||||
do_test sqllimits1-7.7.4 {
|
||||
execsql {
|
||||
DROP TABLE abc;
|
||||
|
||||
@@ -1636,7 +1636,6 @@ proc sql36231 {sql} {
|
||||
set B [hexio_read test.db 92 8]
|
||||
set A [hexio_read test.db 28 4]
|
||||
sqlite3 db36231 test.db
|
||||
db36231 eval { PRAGMA mmap_limit = 0 }
|
||||
catch { db36231 func a_string a_string }
|
||||
execsql $sql db36231
|
||||
db36231 close
|
||||
@@ -1675,35 +1674,6 @@ proc db_delete_and_reopen {{file test.db}} {
|
||||
sqlite3 db $file
|
||||
}
|
||||
|
||||
# Return the number of pages in the database file $zFile, according to
|
||||
# the database header.
|
||||
#
|
||||
proc file_page_count {zFile} {
|
||||
set nPg [hexio_get_int [hexio_read $zFile 28 4]]
|
||||
set pgsz [file_page_size $zFile]
|
||||
set filesz [file size $zFile]
|
||||
set syspgsz 4096
|
||||
|
||||
# Check that the file size is consistent with the database page size,
|
||||
# the page count, and the system page size.
|
||||
if {($filesz < ($nPg * $pgsz))
|
||||
|| ($filesz > (((($nPg * $pgsz)+$syspgsz-1) / $syspgsz) * $syspgsz))
|
||||
} {
|
||||
error "file_size=$filesz. page_count=$nPg. page_size=$pgsz."
|
||||
}
|
||||
|
||||
return $nPg
|
||||
}
|
||||
|
||||
# Return the page size of database file $zFile, according to the database
|
||||
# header.
|
||||
#
|
||||
proc file_page_size {zFile} {
|
||||
set pgsz [hexio_get_int [hexio_read $zFile 16 2]]
|
||||
if {$pgsz==1} {set pgsz 65536}
|
||||
return $pgsz
|
||||
}
|
||||
|
||||
# If the library is compiled with the SQLITE_DEFAULT_AUTOVACUUM macro set
|
||||
# to non-zero, then set the global variable $AUTOVACUUM to 1.
|
||||
set AUTOVACUUM $sqlite_options(default_autovacuum)
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
# 2013 March 27
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library. Specifically,
|
||||
# it tests that ticket [6bfb98dfc0]
|
||||
#
|
||||
# The final INSERT in the script below reports that the database is
|
||||
# corrupt (SQLITE_CORRUPT) and aborts even though the database is not
|
||||
# corrupt.
|
||||
#
|
||||
# PRAGMA page_size=512;
|
||||
# CREATE TABLE t1(x INTEGER PRIMARY KEY, y);
|
||||
# INSERT INTO t1 VALUES(1,randomblob(400));
|
||||
# INSERT INTO t1 VALUES(2,randomblob(400));
|
||||
# INSERT INTO t1 SELECT x+2, randomblob(400) FROM t1;
|
||||
# INSERT INTO t1 SELECT x+4, randomblob(400) FROM t1;
|
||||
# INSERT INTO t1 SELECT x+8, randomblob(400) FROM t1;
|
||||
# INSERT INTO t1 SELECT x+16, randomblob(400) FROM t1;
|
||||
# INSERT INTO t1 SELECT x+32, randomblob(400) FROM t1;
|
||||
# INSERT INTO t1 SELECT x+64, randomblob(400) FROM t1 WHERE x<10;
|
||||
# CREATE TRIGGER r1 AFTER INSERT ON t1 WHEN new.x=74 BEGIN
|
||||
# DELETE FROM t1;
|
||||
# INSERT INTO t1 VALUES(75, randomblob(400));
|
||||
# INSERT INTO t1 VALUES(76, randomblob(400));
|
||||
# END;
|
||||
# INSERT INTO t1 VALUES(74, randomblob(400));
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
|
||||
do_test tkt-6bfb98dfc0.100 {
|
||||
db eval {
|
||||
PRAGMA page_size=512;
|
||||
CREATE TABLE t1(x INTEGER PRIMARY KEY, y);
|
||||
INSERT INTO t1 VALUES(1,randomblob(400));
|
||||
INSERT INTO t1 VALUES(2,randomblob(400));
|
||||
INSERT INTO t1 SELECT x+2, randomblob(400) FROM t1;
|
||||
INSERT INTO t1 SELECT x+4, randomblob(400) FROM t1;
|
||||
INSERT INTO t1 SELECT x+8, randomblob(400) FROM t1;
|
||||
INSERT INTO t1 SELECT x+16, randomblob(400) FROM t1;
|
||||
INSERT INTO t1 SELECT x+32, randomblob(400) FROM t1;
|
||||
INSERT INTO t1 SELECT x+64, randomblob(400) FROM t1 WHERE x<10;
|
||||
CREATE TRIGGER r1 AFTER INSERT ON t1 WHEN new.x=74 BEGIN
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES(75, randomblob(400));
|
||||
INSERT INTO t1 VALUES(76, randomblob(400));
|
||||
END;
|
||||
INSERT INTO t1 VALUES(74, randomblob(400));
|
||||
SELECT x, length(y) FROM t1 ORDER BY x;
|
||||
}
|
||||
} {75 400 76 400}
|
||||
|
||||
finish_test
|
||||
+6
-6
@@ -35,20 +35,20 @@ do_test tkt1512-1.1 {
|
||||
}
|
||||
} {1 2 3 4}
|
||||
do_test tkt1512-1.2 {
|
||||
file_page_count test.db
|
||||
} {2}
|
||||
file size test.db
|
||||
} {2048}
|
||||
do_test tkt1512-1.3 {
|
||||
execsql {
|
||||
DROP TABLE t1;
|
||||
}
|
||||
file_page_count test.db
|
||||
} {2}
|
||||
file size test.db
|
||||
} {2048}
|
||||
do_test tkt1512-1.4 {
|
||||
execsql {
|
||||
VACUUM;
|
||||
}
|
||||
file_page_count test.db
|
||||
} {1}
|
||||
file size test.db
|
||||
} {1024}
|
||||
|
||||
|
||||
finish_test
|
||||
|
||||
+2
-2
@@ -26,8 +26,8 @@ do_test tkt2920-1.1 {
|
||||
PRAGMA auto_vacuum=0;
|
||||
CREATE TABLE filler (fill);
|
||||
}
|
||||
list [file_page_count test.db] [file_page_size test.db]
|
||||
} {2 1024}
|
||||
file size test.db
|
||||
} {2048}
|
||||
do_test tkt2920-1.2 {
|
||||
db eval BEGIN
|
||||
for {set i 0} {$i<34} {incr i} {
|
||||
|
||||
+5
-6
@@ -42,8 +42,8 @@ do_test vacuum3-1.2 {
|
||||
execsql { PRAGMA page_size }
|
||||
} {1024}
|
||||
do_test vacuum3-1.3 {
|
||||
file_page_count test.db
|
||||
} {2}
|
||||
file size test.db
|
||||
} {2048}
|
||||
|
||||
set I 4
|
||||
foreach {request actual database} [list \
|
||||
@@ -63,8 +63,7 @@ foreach {request actual database} [list \
|
||||
execsql { PRAGMA page_size }
|
||||
} $actual
|
||||
do_test vacuum3-1.$I.2 {
|
||||
set nPg [file_page_count test.db]
|
||||
expr {$nPg * $actual}
|
||||
file size test.db
|
||||
} $database
|
||||
do_test vacuum3-1.$I.3 {
|
||||
execsql { SELECT * FROM t1 }
|
||||
@@ -85,8 +84,8 @@ do_test vacuum3-2.1 {
|
||||
ALTER TABLE t1 ADD COLUMN d;
|
||||
UPDATE t1 SET d = randomblob(1000);
|
||||
}
|
||||
file_page_count test.db
|
||||
} {3}
|
||||
file size test.db
|
||||
} {3072}
|
||||
do_test vacuum3-2.2 {
|
||||
execsql { PRAGMA page_size }
|
||||
} {1024}
|
||||
|
||||
+47
-49
@@ -67,8 +67,8 @@ do_test wal-0.1 {
|
||||
execsql { PRAGMA journal_mode = wal }
|
||||
} {wal}
|
||||
do_test wal-0.2 {
|
||||
file_page_count test.db
|
||||
} {1}
|
||||
file size test.db
|
||||
} {1024}
|
||||
|
||||
do_test wal-1.0 {
|
||||
execsql {
|
||||
@@ -77,8 +77,8 @@ do_test wal-1.0 {
|
||||
}
|
||||
list [file exists test.db-journal] \
|
||||
[file exists test.db-wal] \
|
||||
[file_page_count test.db]
|
||||
} {0 1 1}
|
||||
[file size test.db]
|
||||
} {0 1 1024}
|
||||
do_test wal-1.1 {
|
||||
execsql COMMIT
|
||||
list [file exists test.db-journal] [file exists test.db-wal]
|
||||
@@ -347,8 +347,8 @@ foreach sector {512 4096} {
|
||||
INSERT INTO t1 VALUES(1, 2);
|
||||
"
|
||||
db close
|
||||
list [file_page_count test.db] [file_page_size test.db]
|
||||
} [list 2 $pgsz]
|
||||
file size test.db
|
||||
} [expr $pgsz*2]
|
||||
|
||||
do_test wal-6.$sector.$pgsz.2 {
|
||||
log_deleted test.db-wal
|
||||
@@ -364,16 +364,12 @@ do_test wal-7.1 {
|
||||
CREATE TABLE t1(a, b);
|
||||
INSERT INTO t1 VALUES(1, 2);
|
||||
}
|
||||
list [file_page_count test.db] \
|
||||
[file_page_size test.db] \
|
||||
[file size test.db-wal]
|
||||
} [list 1 1024 [wal_file_size 3 1024]]
|
||||
list [file size test.db] [file size test.db-wal]
|
||||
} [list 1024 [wal_file_size 3 1024]]
|
||||
do_test wal-7.2 {
|
||||
execsql { PRAGMA wal_checkpoint }
|
||||
list [file_page_count test.db] \
|
||||
[file_page_size test.db] \
|
||||
[file size test.db-wal]
|
||||
} [list 2 1024 [wal_file_size 3 1024]]
|
||||
list [file size test.db] [file size test.db-wal]
|
||||
} [list 2048 [wal_file_size 3 1024]]
|
||||
|
||||
# Execute some transactions in auto-vacuum mode to test database file
|
||||
# truncation.
|
||||
@@ -432,8 +428,8 @@ do_test wal-9.1 {
|
||||
INSERT INTO t1 SELECT blob(900) FROM t1; /* 128 */
|
||||
INSERT INTO t1 SELECT blob(900) FROM t1; /* 256 */
|
||||
}
|
||||
file_page_count test.db
|
||||
} 1
|
||||
file size test.db
|
||||
} 1024
|
||||
do_test wal-9.2 {
|
||||
sqlite3_wal db2 test.db
|
||||
execsql {PRAGMA integrity_check } db2
|
||||
@@ -685,15 +681,15 @@ do_test wal-11.1 {
|
||||
PRAGMA page_size = 1024;
|
||||
CREATE TABLE t1(x PRIMARY KEY);
|
||||
}
|
||||
list [file_page_count test.db] [expr [file size test.db-wal]/1044]
|
||||
list [expr [file size test.db]/1024] [expr [file size test.db-wal]/1044]
|
||||
} {1 3}
|
||||
do_test wal-11.2 {
|
||||
execsql { PRAGMA wal_checkpoint }
|
||||
list [file_page_count test.db] [file size test.db-wal]
|
||||
list [expr [file size test.db]/1024] [file size test.db-wal]
|
||||
} [list 3 [wal_file_size 3 1024]]
|
||||
do_test wal-11.3 {
|
||||
execsql { INSERT INTO t1 VALUES( blob(900) ) }
|
||||
list [file_page_count test.db] [file size test.db-wal]
|
||||
list [expr [file size test.db]/1024] [file size test.db-wal]
|
||||
} [list 3 [wal_file_size 4 1024]]
|
||||
|
||||
do_test wal-11.4 {
|
||||
@@ -704,7 +700,7 @@ do_test wal-11.4 {
|
||||
INSERT INTO t1 SELECT blob(900) FROM t1; -- 8
|
||||
INSERT INTO t1 SELECT blob(900) FROM t1; -- 16
|
||||
}
|
||||
list [file_page_count test.db] [file size test.db-wal]
|
||||
list [expr [file size test.db]/1024] [file size test.db-wal]
|
||||
} [list 3 [wal_file_size 32 1024]]
|
||||
do_test wal-11.5 {
|
||||
execsql {
|
||||
@@ -714,7 +710,7 @@ do_test wal-11.5 {
|
||||
} {16 ok}
|
||||
do_test wal-11.6 {
|
||||
execsql COMMIT
|
||||
list [file_page_count test.db] [file size test.db-wal]
|
||||
list [expr [file size test.db]/1024] [file size test.db-wal]
|
||||
} [list 3 [wal_file_size 41 1024]]
|
||||
do_test wal-11.7 {
|
||||
execsql {
|
||||
@@ -724,15 +720,16 @@ do_test wal-11.7 {
|
||||
} {16 ok}
|
||||
do_test wal-11.8 {
|
||||
execsql { PRAGMA wal_checkpoint }
|
||||
list [file_page_count test.db] [file size test.db-wal]
|
||||
list [expr [file size test.db]/1024] [file size test.db-wal]
|
||||
} [list 37 [wal_file_size 41 1024]]
|
||||
do_test wal-11.9 {
|
||||
db close
|
||||
list [file_page_count test.db] [log_deleted test.db-wal]
|
||||
list [expr [file size test.db]/1024] [log_deleted test.db-wal]
|
||||
} {37 1}
|
||||
sqlite3_wal db test.db
|
||||
set nWal 39
|
||||
if {[permutation]=="nommap"} {set nWal 37}
|
||||
ifcapable !mmap {set nWal 37}
|
||||
do_test wal-11.10 {
|
||||
execsql {
|
||||
PRAGMA cache_size = 10;
|
||||
@@ -740,7 +737,7 @@ do_test wal-11.10 {
|
||||
INSERT INTO t1 SELECT blob(900) FROM t1; -- 32
|
||||
SELECT count(*) FROM t1;
|
||||
}
|
||||
list [file_page_count test.db] [file size test.db-wal]
|
||||
list [expr [file size test.db]/1024] [file size test.db-wal]
|
||||
} [list 37 [wal_file_size $nWal 1024]]
|
||||
do_test wal-11.11 {
|
||||
execsql {
|
||||
@@ -750,7 +747,7 @@ do_test wal-11.11 {
|
||||
}
|
||||
} {32 16}
|
||||
do_test wal-11.12 {
|
||||
list [file_page_count test.db] [file size test.db-wal]
|
||||
list [expr [file size test.db]/1024] [file size test.db-wal]
|
||||
} [list 37 [wal_file_size $nWal 1024]]
|
||||
do_test wal-11.13 {
|
||||
execsql {
|
||||
@@ -760,7 +757,7 @@ do_test wal-11.13 {
|
||||
}
|
||||
} {17 ok}
|
||||
do_test wal-11.14 {
|
||||
list [file_page_count test.db] [file size test.db-wal]
|
||||
list [expr [file size test.db]/1024] [file size test.db-wal]
|
||||
} [list 37 [wal_file_size $nWal 1024]]
|
||||
|
||||
|
||||
@@ -777,7 +774,7 @@ do_test wal-12.1 {
|
||||
CREATE TABLE t2(x, y);
|
||||
INSERT INTO t1 VALUES('A', 1);
|
||||
}
|
||||
list [file_page_count test.db] [file size test.db-wal]
|
||||
list [expr [file size test.db]/1024] [file size test.db-wal]
|
||||
} [list 1 [wal_file_size 5 1024]]
|
||||
do_test wal-12.2 {
|
||||
db close
|
||||
@@ -786,11 +783,11 @@ do_test wal-12.2 {
|
||||
PRAGMA synchronous = normal;
|
||||
UPDATE t1 SET y = 0 WHERE x = 'A';
|
||||
}
|
||||
list [file_page_count test.db] [expr [file size test.db-wal]/1044]
|
||||
list [expr [file size test.db]/1024] [expr [file size test.db-wal]/1044]
|
||||
} {3 1}
|
||||
do_test wal-12.3 {
|
||||
execsql { INSERT INTO t2 VALUES('B', 1) }
|
||||
list [file_page_count test.db] [expr [file size test.db-wal]/1044]
|
||||
list [expr [file size test.db]/1024] [expr [file size test.db-wal]/1044]
|
||||
} {3 2}
|
||||
do_test wal-12.4 {
|
||||
forcecopy test.db test2.db
|
||||
@@ -855,6 +852,7 @@ do_test wal-13.1.2 {
|
||||
sqlite3 db test.db
|
||||
execsql { SELECT * FROM t2 }
|
||||
} {B 2}
|
||||
breakpoint
|
||||
do_test wal-13.1.3 {
|
||||
db close
|
||||
file exists test.db-wal
|
||||
@@ -1025,8 +1023,8 @@ do_test wal-15.4.5 {
|
||||
sqlite3_errmsg db
|
||||
} {not an error}
|
||||
do_test wal-15.4.6 {
|
||||
list [file_page_count test.db] [file_page_size test.db]
|
||||
} {2 1024}
|
||||
file size test.db
|
||||
} [expr 1024*2]
|
||||
|
||||
catch { db2 close }
|
||||
catch { db close }
|
||||
@@ -1074,21 +1072,21 @@ foreach {tn ckpt_cmd ckpt_res ckpt_main ckpt_aux} {
|
||||
INSERT INTO t1 SELECT * FROM t2;
|
||||
}
|
||||
|
||||
list [file_page_count test.db] [file size test.db-wal]
|
||||
} [list 1 [wal_file_size 10 1024]]
|
||||
list [file size test.db] [file size test.db-wal]
|
||||
} [list [expr 1*1024] [wal_file_size 10 1024]]
|
||||
do_test wal-16.$tn.3 {
|
||||
list [file_page_count test2.db] [file size test2.db-wal]
|
||||
} [list 1 [wal_file_size 13 1024]]
|
||||
list [file size test2.db] [file size test2.db-wal]
|
||||
} [list [expr 1*1024] [wal_file_size 13 1024]]
|
||||
|
||||
do_test wal-16.$tn.4 [list eval $ckpt_cmd] $ckpt_res
|
||||
|
||||
do_test wal-16.$tn.5 {
|
||||
list [file_page_count test.db] [file size test.db-wal]
|
||||
} [list [expr ($ckpt_main ? 7 : 1)] [wal_file_size 10 1024]]
|
||||
list [file size test.db] [file size test.db-wal]
|
||||
} [list [expr ($ckpt_main ? 7 : 1)*1024] [wal_file_size 10 1024]]
|
||||
|
||||
do_test wal-16.$tn.6 {
|
||||
list [file_page_count test2.db] [file size test2.db-wal]
|
||||
} [list [expr ($ckpt_aux ? 7 : 1)] [wal_file_size 13 1024]]
|
||||
list [file size test2.db] [file size test2.db-wal]
|
||||
} [list [expr ($ckpt_aux ? 7 : 1)*1024] [wal_file_size 13 1024]]
|
||||
|
||||
catch { db close }
|
||||
}
|
||||
@@ -1148,13 +1146,13 @@ foreach {tn sectorsize logsize} "
|
||||
} $logsize
|
||||
|
||||
do_test wal-17.$tn.2 {
|
||||
file_page_count test.db
|
||||
} 1
|
||||
file size test.db
|
||||
} 512
|
||||
|
||||
do_test wal-17.$tn.3 {
|
||||
db close
|
||||
file_page_count test.db
|
||||
} 171
|
||||
file size test.db
|
||||
} [expr 512*171]
|
||||
}
|
||||
sqlite3_test_control_pending_byte $old_pending_byte
|
||||
|
||||
@@ -1189,8 +1187,8 @@ do_test wal-18.0 {
|
||||
forcecopy test.db testX.db
|
||||
forcecopy test.db-wal testX.db-wal
|
||||
db close
|
||||
list [file_page_count testX.db] [file size testX.db-wal]
|
||||
} [list 3 [wal_file_size 6 1024]]
|
||||
list [file size testX.db] [file size testX.db-wal]
|
||||
} [list [expr 3*1024] [wal_file_size 6 1024]]
|
||||
|
||||
unset -nocomplain nFrame result
|
||||
foreach {nFrame result} {
|
||||
@@ -1270,7 +1268,7 @@ foreach {tn pgsz works} {
|
||||
#
|
||||
do_test wal-18.2.$tn.$pg.1 { file exists test.db-wal } 0
|
||||
do_test wal-18.2.$tn.$pg.2 { file exists test.db } 1
|
||||
do_test wal-18.2.$tn.$pg.3 { file_page_count test.db } 3
|
||||
do_test wal-18.2.$tn.$pg.3 { file size test.db } [expr 1024*3]
|
||||
|
||||
do_test wal-18.2.$tn.$pg.4 {
|
||||
|
||||
@@ -1512,12 +1510,12 @@ do_test wal-23.3 {
|
||||
db close
|
||||
set ::log [list]
|
||||
faultsim_restore_and_reopen
|
||||
execsql { SELECT * FROM t1 ; PRAGMA page_size }
|
||||
} {1 2 3 4 1024}
|
||||
execsql { SELECT * FROM t1 }
|
||||
} {1 2 3 4}
|
||||
set nPage [expr 2+$AUTOVACUUM]
|
||||
do_test wal-23.4 {
|
||||
set ::log
|
||||
} [list SQLITE_OK "Recovered $nPage frames from WAL file $walfile"]
|
||||
} [list SQLITE_NOTICE "recovered $nPage frames from WAL file $walfile"]
|
||||
|
||||
|
||||
ifcapable autovacuum {
|
||||
|
||||
+4
-3
@@ -21,7 +21,7 @@ ifcapable !wal {finish_test ; return }
|
||||
|
||||
set testprefix wal5
|
||||
|
||||
proc db_page_count {{file test.db}} { file_page_count $file }
|
||||
proc db_page_count {{file test.db}} { expr [file size $file] / 1024 }
|
||||
proc wal_page_count {{file test.db}} { wal_frame_count ${file}-wal 1024 }
|
||||
|
||||
|
||||
@@ -101,8 +101,8 @@ foreach {testprefix do_wal_checkpoint} {
|
||||
INSERT INTO t1 VALUES(2, zeroblob(1200));
|
||||
INSERT INTO t1 VALUES(3, zeroblob(1200));
|
||||
}
|
||||
list [file_page_count test.db] [file_page_size test.db]
|
||||
} {2 1024}
|
||||
expr [file size test.db] / 1024
|
||||
} {2}
|
||||
|
||||
# Have connection 2 grab a read-lock on the current snapshot.
|
||||
do_test 1.$tn.2 { sql2 { BEGIN; SELECT x FROM t1 } } {1 2 3}
|
||||
@@ -243,6 +243,7 @@ foreach {testprefix do_wal_checkpoint} {
|
||||
# start of the checkpoint, even though page 2 cannot be written.
|
||||
set nDb 2
|
||||
if {[permutation]=="no-mmap"} {set nDb 1}
|
||||
ifcapable !mmap {set nDb 1}
|
||||
do_test 2.3.$tn.8 { file_page_counts } [list $nDb 4 2 4]
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ do_execsql_test 1.2 {
|
||||
#
|
||||
# The sizes of various files are slightly different in normal and
|
||||
# auto-vacuum mode.
|
||||
do_test 1.3 { file_page_count test.db } {1}
|
||||
do_test 1.3 { file size test.db } {1024}
|
||||
do_test 1.4 { expr {[file size test.db-wal]>(1500*1024)} } {1}
|
||||
do_test 1.5 { expr {[file size test.db-shm]>32768} } {1}
|
||||
do_test 1.6 {
|
||||
|
||||
+4
-4
@@ -50,8 +50,8 @@ do_test walbak-1.0 {
|
||||
do_test walbak-1.1 {
|
||||
forcedelete bak.db bak.db-journal bak.db-wal
|
||||
db backup bak.db
|
||||
file_page_count bak.db
|
||||
} 3
|
||||
file size bak.db
|
||||
} [expr 3*1024]
|
||||
do_test walbak-1.2 {
|
||||
sqlite3 db2 bak.db
|
||||
execsql {
|
||||
@@ -73,8 +73,8 @@ do_test walbak-1.4 {
|
||||
}
|
||||
} {wal}
|
||||
do_test walbak-1.5 {
|
||||
list [file_page_count test.db] [file size test.db-wal]
|
||||
} [list 1 [wal_file_size 6 1024]]
|
||||
list [file size test.db] [file size test.db-wal]
|
||||
} [list 1024 [wal_file_size 6 1024]]
|
||||
do_test walbak-1.6 {
|
||||
execsql { PRAGMA wal_checkpoint }
|
||||
list [file size test.db] [file size test.db-wal]
|
||||
|
||||
+6
-6
@@ -176,8 +176,8 @@ foreach endian {big little} {
|
||||
forcecopy test.db-wal test2.db-wal
|
||||
db close
|
||||
|
||||
list [file_page_count test2.db] [file size test2.db-wal]
|
||||
} [list 3 [wal_file_size 6 1024]]
|
||||
list [file size test2.db] [file size test2.db-wal]
|
||||
} [list [expr 1024*3] [wal_file_size 6 1024]]
|
||||
|
||||
# Verify that the checksums are valid for all frames and that they
|
||||
# are calculated by interpreting data in native byte-order.
|
||||
@@ -213,8 +213,8 @@ foreach endian {big little} {
|
||||
PRAGMA synchronous = NORMAL;
|
||||
INSERT INTO t1 VALUES(34, 'thirtyfour');
|
||||
}
|
||||
list [file_page_count test.db] [file size test.db-wal]
|
||||
} [list 3 [wal_file_size 8 1024]]
|
||||
list [file size test.db] [file size test.db-wal]
|
||||
} [list [expr 1024*3] [wal_file_size 8 1024]]
|
||||
for {set f 1} {$f <= 8} {incr f} {
|
||||
do_test walcksum-1.$endian.5.$f {
|
||||
log_checksum_verify test.db-wal $f $endian
|
||||
@@ -237,8 +237,8 @@ foreach endian {big little} {
|
||||
PRAGMA synchronous = NORMAL;
|
||||
INSERT INTO t1 VALUES(55, 'fiftyfive');
|
||||
} db2
|
||||
list [file_page_count test.db] [file size test.db-wal]
|
||||
} [list 3 [wal_file_size 10 1024]]
|
||||
list [file size test.db] [file size test.db-wal]
|
||||
} [list [expr 1024*3] [wal_file_size 10 1024]]
|
||||
for {set f 1} {$f <= 10} {incr f} {
|
||||
do_test walcksum-1.$endian.7.$f {
|
||||
log_checksum_verify test.db-wal $f $endian
|
||||
|
||||
+39
-1
@@ -548,6 +548,44 @@ do_faultsim_test walfault-14 -prep {
|
||||
set nRow [db eval {SELECT count(*) FROM abc}]
|
||||
if {!(($nRow==2 && $testrc) || $nRow==3)} { error "Bad db content" }
|
||||
}
|
||||
finish_test
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Test fault-handling when switching out of exclusive-locking mode.
|
||||
#
|
||||
do_test walfault-14-pre {
|
||||
faultsim_delete_and_reopen
|
||||
execsql {
|
||||
PRAGMA auto_vacuum = 0;
|
||||
PRAGMA journal_mode = WAL;
|
||||
BEGIN;
|
||||
CREATE TABLE abc(a PRIMARY KEY);
|
||||
INSERT INTO abc VALUES(randomblob(1500));
|
||||
INSERT INTO abc VALUES(randomblob(1500));
|
||||
COMMIT;
|
||||
}
|
||||
faultsim_save_and_close
|
||||
} {}
|
||||
do_faultsim_test walfault-14 -prep {
|
||||
faultsim_restore_and_reopen
|
||||
breakpoint
|
||||
execsql {
|
||||
SELECT count(*) FROM abc;
|
||||
PRAGMA locking_mode = exclusive;
|
||||
BEGIN;
|
||||
INSERT INTO abc VALUES(randomblob(1500));
|
||||
COMMIT;
|
||||
}
|
||||
} -body {
|
||||
db eval {
|
||||
PRAGMA locking_mode = normal;
|
||||
BEGIN;
|
||||
INSERT INTO abc VALUES(randomblob(1500));
|
||||
COMMIT;
|
||||
}
|
||||
} -test {
|
||||
faultsim_integrity_check
|
||||
set nRow [db eval {SELECT count(*) FROM abc}]
|
||||
if {$nRow!=3 && $nRow!=4} { error "Bad db content" }
|
||||
}
|
||||
|
||||
finish_test
|
||||
|
||||
+2
-2
@@ -49,8 +49,8 @@ do_test walhook-1.2 {
|
||||
do_test walhook-1.3 {
|
||||
proc wal_hook {args} { db eval {PRAGMA wal_checkpoint}; return 0 }
|
||||
execsql { INSERT INTO t1 VALUES(2, 'two') }
|
||||
file_page_count test.db
|
||||
} 3
|
||||
file size test.db
|
||||
} [expr 3*1024]
|
||||
do_test walhook-1.4 {
|
||||
proc wal_hook {zDb nEntry} {
|
||||
execsql { PRAGMA wal_checkpoint }
|
||||
|
||||
+4
-4
@@ -42,8 +42,8 @@ do_test walmode-1.1 {
|
||||
execsql { PRAGMA journal_mode = wal }
|
||||
} {wal}
|
||||
do_test walmode-1.2 {
|
||||
file_page_count test.db
|
||||
} {1}
|
||||
file size test.db
|
||||
} {1024}
|
||||
|
||||
set expected_sync_count 3
|
||||
if {$::tcl_platform(platform)!="windows"} {
|
||||
@@ -60,8 +60,8 @@ do_test walmode-1.4 {
|
||||
} {0}
|
||||
do_test walmode-1.5 {
|
||||
execsql { CREATE TABLE t1(a, b) }
|
||||
file_page_count test.db
|
||||
} {1}
|
||||
file size test.db
|
||||
} {1024}
|
||||
do_test walmode-1.6 {
|
||||
file exists test.db-wal
|
||||
} {1}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user