Compare commits
31 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6c92a7711e | |||
| 05883a3409 | |||
| cd8fb7cfd5 | |||
| fcb9f4f3ca | |||
| 5fea985851 | |||
| f960a64d29 | |||
| 2efcf2aac2 | |||
| 1c8badeb26 | |||
| e726622579 | |||
| 1f2d968622 | |||
| b5a2d55ee6 | |||
| 9d69464adc | |||
| d092ed4355 | |||
| 7b3aa08e22 | |||
| 7cea7f95c7 | |||
| c68275032e | |||
| 73d340adff | |||
| 24cf1e546c | |||
| 7e8c6f1c2e | |||
| 275fe3adf1 | |||
| 3da29a112a | |||
| f74d35be8c | |||
| b52e9c89df | |||
| f9705d4b66 | |||
| a7298ac191 | |||
| 3548db7c13 | |||
| fccda8a162 | |||
| 1421d980c5 | |||
| b95e1193d5 | |||
| cc7aa1f6f3 | |||
| 52b33f8047 |
+1
-1
@@ -1002,7 +1002,7 @@ test: $(TESTPROGS) fuzztest
|
||||
# because valgrind is so much slower than a native machine.
|
||||
#
|
||||
valgrindtest: $(TESTPROGS) fuzzcheck$(TEXE)
|
||||
valgrind -v ./fuzzcheck$(TEXE) $(FUZZDATA)
|
||||
valgrind -v ./fuzzcheck$(TEXE) --cell-size-check --quiet $(FUZZDATA)
|
||||
OMIT_MISUSE=1 valgrind -v ./testfixture$(TEXE) $(TOP)/test/permutations.test valgrind
|
||||
|
||||
# A very fast test that checks basic sanity. The name comes from
|
||||
|
||||
@@ -178,7 +178,7 @@ complex code. So there is a lot of complexity in the SQLite implementation.
|
||||
|
||||
Key files:
|
||||
|
||||
* **sqlite3.h** - This file defines the public interface to the SQLite
|
||||
* **sqlite.h.in** - This file defines the public interface to the SQLite
|
||||
library. Readers will need to be familiar with this interface before
|
||||
trying to understand how the library works internally.
|
||||
|
||||
@@ -186,7 +186,7 @@ Key files:
|
||||
used internally by SQLite.
|
||||
|
||||
* **parse.y** - This file describes the LALR(1) grammer that SQLite uses
|
||||
to parse SQL statements, and the actions that are taken at each stop
|
||||
to parse SQL statements, and the actions that are taken at each step
|
||||
in the parsing process.
|
||||
|
||||
* **vdbe.c** - This file implements the virtual machine that runs
|
||||
@@ -210,6 +210,17 @@ Key files:
|
||||
between SQLite and the underlying operating system using the run-time
|
||||
pluggable VFS interface.
|
||||
|
||||
* **shell.c** - This file is not part of the core SQLite library. This
|
||||
is the file that, when linked against sqlite3.a, generates the
|
||||
"sqlite3.exe" command-line shell.
|
||||
|
||||
* **tclsqlite.c** - This file implements the Tcl bindings for SQLite. It
|
||||
is not part of the core SQLite library. But as most of the tests in this
|
||||
repository are written in Tcl, the Tcl language bindings are important.
|
||||
|
||||
There are many other source files. Each has a suscinct header comment that
|
||||
describes its purpose and role within the larger system.
|
||||
|
||||
|
||||
## Contacts
|
||||
|
||||
|
||||
@@ -10715,6 +10715,20 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
# On ubuntu 14.10, $auto_path on tclsh is not quite correct.
|
||||
# So try again after applying corrections.
|
||||
if test x"${ac_cv_c_tclconfig}" = x ; then
|
||||
if test x"$cross_compiling" = xno; then
|
||||
for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD} | sed 's,/tcltk/tcl,/tcl,g'`
|
||||
do
|
||||
if test -f "$i/tclConfig.sh" ; then
|
||||
ac_cv_c_tclconfig="$i"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
# then check for a private Tcl installation
|
||||
if test x"${ac_cv_c_tclconfig}" = x ; then
|
||||
for i in \
|
||||
|
||||
@@ -320,6 +320,20 @@ if test "${use_tcl}" = "yes" ; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# On ubuntu 14.10, $auto_path on tclsh is not quite correct.
|
||||
# So try again after applying corrections.
|
||||
if test x"${ac_cv_c_tclconfig}" = x ; then
|
||||
if test x"$cross_compiling" = xno; then
|
||||
for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD} | sed 's,/tcltk/tcl,/tcl,g'`
|
||||
do
|
||||
if test -f "$i/tclConfig.sh" ; then
|
||||
ac_cv_c_tclconfig="$i"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
# then check for a private Tcl installation
|
||||
if test x"${ac_cv_c_tclconfig}" = x ; then
|
||||
for i in \
|
||||
|
||||
@@ -683,7 +683,7 @@ test: $(TESTPROGS) fuzztest
|
||||
# because valgrind is so much slower than a native machine.
|
||||
#
|
||||
valgrindtest: $(TESTPROGS) fuzzcheck$(EXE) $(FUZZDATA)
|
||||
valgrind -v ./fuzzcheck$(EXE) $(FUZZDATA)
|
||||
valgrind -v ./fuzzcheck$(EXE) --cell-size-check --quiet $(FUZZDATA)
|
||||
OMIT_MISUSE=1 valgrind -v ./testfixture$(EXE) $(TOP)/test/permutations.test valgrind
|
||||
|
||||
# A very fast test that checks basic sanity. The name comes from
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
C Merge\saccidental\sfork.
|
||||
D 2015-05-26T19:01:36.410
|
||||
C Add\sthe\sbuilt-in\saffinity()\sSQL\sfunction.\s\sThis\sturns\sout\sto\sbe\snot\sas\suseful\nas\soriginally\senvisioned,\sso\sabandon\sit\son\sa\sbranch.
|
||||
D 2015-06-02T16:09:58.099
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in 3feb7cbdad8898fe7a8a24355b4a753029c3ec3b
|
||||
F Makefile.in 994bab32a3a69e0c35bd148b65cde49879772964
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
F Makefile.msc d37d2c2323df3acae6e24c71a478889421c17264
|
||||
F Makefile.vxworks e1b65dea203f054e71653415bd8f96dcaed47858
|
||||
F README.md 0bfccb18927349653c09137a458b961fa8ab4cb9
|
||||
F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7
|
||||
F VERSION ce0ae95abd7121c534f6917c1c8f2b70d9acd4db
|
||||
F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
|
||||
F addopcodes.awk 9eb448a552d5c0185cf62c463f9c173cedae3811
|
||||
@@ -38,8 +38,8 @@ F autoconf/tea/win/rules.vc c511f222b80064096b705dbeb97060ee1d6b6d63
|
||||
F config.guess 226d9a188c6196f3033ffc651cbc9dcee1a42977
|
||||
F config.h.in 42b71ad3fe21c9e88fa59e8458ca1a6bc72eb0c0
|
||||
F config.sub 9ebe4c3b3dab6431ece34f16828b594fb420da55
|
||||
F configure 35cbd52af707ae22401641fe7b3672f05aea0eb1 x
|
||||
F configure.ac 0b775d383c536bbaafc1e46dd3cbb81a7ea11aeb
|
||||
F configure 17bd8dc3e35c718df68d04f53bf7dacf2b639732 x
|
||||
F configure.ac 713de38000413e469188db2cb85bed759b56f322
|
||||
F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad
|
||||
F doc/lemon.html 334dbf6621b8fb8790297ec1abf3cfa4621709d1
|
||||
F doc/pager-invariants.txt 27fed9a70ddad2088750c4a2b493b63853da2710
|
||||
@@ -171,7 +171,7 @@ F ext/userauth/userauth.c 5fa3bdb492f481bbc1709fc83c91ebd13460c69e
|
||||
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
|
||||
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
|
||||
F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60
|
||||
F main.mk 031e36b22e2be9b9fdab086fd3115fc88c2e37bd
|
||||
F main.mk 8d418497da6a152a59b00d64ae3d66f3c665974c
|
||||
F mkopcodec.awk c2ff431854d702cdd2d779c9c0d1f58fa16fa4ea
|
||||
F mkopcodeh.awk d5e22023b5238985bb54a72d33e0ac71fe4f8a32
|
||||
F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83
|
||||
@@ -185,37 +185,37 @@ F spec.template 86a4a43b99ebb3e75e6b9a735d5fd293a24e90ca
|
||||
F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
|
||||
F sqlite3.1 fc7ad8990fc8409983309bb80de8c811a7506786
|
||||
F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a
|
||||
F src/alter.c 8f6dc4a6ddc1ebc0ed5cc470c4e57ff0d1605e90
|
||||
F src/alter.c 48e14b8aea28dc58baafe3cfcb8889c086b7744a
|
||||
F src/analyze.c d23790787f80ebed58df7774744b4cf96401498b
|
||||
F src/attach.c c38ac5a520a231d5d0308fd7f2ad95191c867bae
|
||||
F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240
|
||||
F src/backup.c ff743689c4d6c5cb55ad42ed9d174b2b3e71f1e3
|
||||
F src/bitvec.c 5eb7958c3bf65210211cbcfc44eff86d0ded7c9d
|
||||
F src/btmutex.c 45a968cc85afed9b5e6cf55bf1f42f8d18107f79
|
||||
F src/btree.c 82bb9ad936fc513682a68f6d9444011266e6b459
|
||||
F src/btree.c c73a170115df068764126a85288cdec092ec180c
|
||||
F src/btree.h 969adc948e89e449220ff0ff724c94bb2a52e9f1
|
||||
F src/btreeInt.h 973a22a6fd61350b454ad614832b1f0a5e25a1e4
|
||||
F src/build.c 9552e7490b0310a8c73fcf3a0c36e7624789d8df
|
||||
F src/build.c 73da2b9e9311abc4fcb4e36f76c7800c2d2504a4
|
||||
F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0
|
||||
F src/complete.c a5cf5b4b56390cfb7b8636e8f7ddef90258dd575
|
||||
F src/ctime.c 5a0b735dc95604766f5dac73973658eef782ee8b
|
||||
F src/date.c e4d50b3283696836ec1036b695ead9a19e37a5ac
|
||||
F src/dbstat.c f402e77e25089c6003d0c60b3233b9b3947d599a
|
||||
F src/delete.c 37964e6c1d73ff49cbea9ff690c9605fb15f600e
|
||||
F src/expr.c 3fb2ab3ab69d15b4b75ae53fceb4e317f64cb306
|
||||
F src/expr.c 5abe19af1c41dd8b334318611c6614cc21155b88
|
||||
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
|
||||
F src/fkey.c c9b63a217d86582c22121699a47f22f524608869
|
||||
F src/func.c 5b8b8e77a0fb644eaf8947d413804622e32692b6
|
||||
F src/func.c c215efa308b831f7ea147c7a6a03080c870caf8a
|
||||
F src/global.c 4f77cadbc5427d00139ba43d0f3979804cbb700e
|
||||
F src/hash.c 4263fbc955f26c2e8cdc0cf214bc42435aa4e4f5
|
||||
F src/hash.h c8f3c31722cf3277d03713909761e152a5b81094
|
||||
F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08
|
||||
F src/insert.c 35b7816918406ec49fbcc6c7fa7ab622597f662e
|
||||
F src/insert.c d6e1623a97ce33e9af2f1a0c1f0085a2f63327ef
|
||||
F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d
|
||||
F src/legacy.c ba1863ea58c4c840335a84ec276fc2b25e22bc4e
|
||||
F src/lempar.c 7274c97d24bb46631e504332ccd3bd1b37841770
|
||||
F src/loadext.c 29255bbe1cfb2ce9bbff2526a5ecfddcb49b9271
|
||||
F src/main.c bf14bc6a321965e528d8ab30087e9440335f2e4b
|
||||
F src/main.c 3a610587018485d9a12e38899dd8b8129b04d836
|
||||
F src/malloc.c 908c780fdddd472163c2d1b1820ae4081f01ad20
|
||||
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
|
||||
F src/mem1.c abe6ee469b6c5a35c7f22bfeb9c9bac664a1c987
|
||||
@@ -235,27 +235,27 @@ F src/os.h 3e57a24e2794a94d3cf2342c6d9a884888cd96bf
|
||||
F src/os_common.h abdb9a191a367793268fe553d25bab894e986a0e
|
||||
F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa
|
||||
F src/os_unix.c 23eb5f56fac54d8fe0cb204291f3b3b2d94f23fc
|
||||
F src/os_win.c 97f7828a9554d753665b6fcf7540e31c2b3d6a6e
|
||||
F src/os_win.c 27cc135e2d0b8b1e2e4944db1e2669a6a18fa0f8
|
||||
F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca
|
||||
F src/pager.c 9bc918a009285f96ec6dac62dd764c7063552455
|
||||
F src/pager.h c3476e7c89cdf1c6914e50a11f3714e30b4e0a77
|
||||
F src/parse.y af55d4fb5e588705112e9788364ca3af09651fcf
|
||||
F src/parse.y 6d60dda8f8d418b6dc034f1fbccd816c459983a8
|
||||
F src/pcache.c 10539fb959849ad6efff80050541cab3d25089d4
|
||||
F src/pcache.h b44658c9c932d203510279439d891a2a83e12ba8
|
||||
F src/pcache1.c 69d137620a305f814398bd29a0c998038c0695e9
|
||||
F src/pragma.c c1f4d012ea9f6b1ce52d341b2cd0ad72d560afd7
|
||||
F src/pragma.h 09c89bca58e9a44de2116cc8272b8d454657129f
|
||||
F src/pragma.h b8632d7cdda7b25323fa580e3e558a4f0d4502cc
|
||||
F src/prepare.c 82e5db1013846a819f198336fed72c44c974e7b1
|
||||
F src/printf.c 13ce37e5574f9b0682fa86dbcf9faf76b9d82a15
|
||||
F src/random.c ba2679f80ec82c4190062d756f22d0c358180696
|
||||
F src/resolve.c 99eabf7eff0bfa65b75939b46caa82e2b2133f28
|
||||
F src/resolve.c 84c571794e3ee5806274d95158a4c0177c6c4708
|
||||
F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e
|
||||
F src/select.c 9d9f6975bb538cafc5d4ae4a45565f15f5d296ff
|
||||
F src/select.c 7bb5c6334128877a30d4644fb948098a3ec41bbc
|
||||
F src/shell.c 07dda7cd692911d2f22269953418d049f2e2c0ee
|
||||
F src/sqlite.h.in 4d0ecd8e1e0272d9a2742b39602f5e4fad8d3246
|
||||
F src/sqlite.h.in d165beeceb6b40af60f352a4d4e37e02d9af7df0
|
||||
F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad
|
||||
F src/sqlite3ext.h 2ebeb634e751a61a6f0eebfa0f4669f46a42f6cd
|
||||
F src/sqliteInt.h 26484793b2f8017960b30ae2d0cbc7512eff5b17
|
||||
F src/sqliteInt.h 98c49cbd565f08f2e516399734e497340ca9549c
|
||||
F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46
|
||||
F src/status.c f266ad8a2892d659b74f0f50cb6a88b6e7c12179
|
||||
F src/table.c 51b46b2a62d1b3a959633d593b89bab5e2c9155e
|
||||
@@ -306,19 +306,19 @@ F src/test_vfs.c 3b65d42e18b262805716bd96178c81da8f2d9283
|
||||
F src/test_vfstrace.c bab9594adc976cbe696ff3970728830b4c5ed698
|
||||
F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
|
||||
F src/threads.c 6bbcc9fe50c917864d48287b4792d46d6e873481
|
||||
F src/tokenize.c 27d60b6bf4a92d17c329a11ff9fe94081b2a8510
|
||||
F src/tokenize.c baa0e550dfa76a8d781732a7bfb1f0aa094942f2
|
||||
F src/trigger.c 322f23aad694e8f31d384dcfa386d52a48d3c52f
|
||||
F src/update.c 487747b328b7216bb7f6af0695d6937d5c9e605f
|
||||
F src/utf.c fc6b889ba0779b7722634cdeaa25f1930d93820c
|
||||
F src/util.c a6431c92803b975b7322724a7b433e538d243539
|
||||
F src/vacuum.c 2ddd5cad2a7b9cef7f9e431b8c7771634c6b1701
|
||||
F src/vdbe.c 6aee8a041742413ab3113e6682bc7ad1628a2bbe
|
||||
F src/vdbe.c 0a6a1df5c31415a0e974e74e7bd412616889453d
|
||||
F src/vdbe.h 7e538ecf47dccb307ea2d087c3ddc2dd8d70e79d
|
||||
F src/vdbeInt.h f0ccddac48583d5f762dc554a9f79e85ea8807e0
|
||||
F src/vdbeapi.c 6a0d7757987018ff6b1b81bc5293219cd26bb299
|
||||
F src/vdbeaux.c efe1667d31e8648dbe04a441e5aa9b62dbee2f03
|
||||
F src/vdbeaux.c 46f9bc4b32866082eb87a36b461e487a0bbdbe8e
|
||||
F src/vdbeblob.c 4f2e8e075d238392df98c5e03a64342465b03f90
|
||||
F src/vdbemem.c 21f9169289a804308f6cdde55e9417fb8336997f
|
||||
F src/vdbemem.c 67b302dc6df64b4d6785881c5d22bd4f9b17739d
|
||||
F src/vdbesort.c f5009e7a35e3065635d8918b9a31f498a499976b
|
||||
F src/vdbetrace.c 8befe829faff6d9e6f6e4dee5a7d3f85cc85f1a0
|
||||
F src/vtab.c c535e80259ebe616467181a83a4263555b97c694
|
||||
@@ -326,9 +326,10 @@ F src/vxworks.h c18586c8edc1bddbc15c004fa16aeb1e1342b4fb
|
||||
F src/wal.c ce2cb2d06faab54d1bce3e739bec79e063dd9113
|
||||
F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
|
||||
F src/walker.c c253b95b4ee44b21c406e2a1052636c31ea27804
|
||||
F src/where.c e71eae3b1383249c3b5d136d6b71ca8d28fb8d61
|
||||
F src/where.c dcdfee81d35ae9261a4c5bda6289ed5fa6d7e1ae
|
||||
F src/whereInt.h a6f5a762bc1b4b1c76e1cea79976b437ac35a435
|
||||
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
|
||||
F test/affinity1.test 3f68d94550f47bac467f916844d939c94882b557
|
||||
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
||||
F test/aggnested.test b35b4cd69fc913f90d39a575e171e1116c3a4bb7
|
||||
F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87
|
||||
@@ -373,6 +374,7 @@ F test/autoindex1.test 14b63a9f1e405fe6d5bfc8c8d00249c2ebaf13ea
|
||||
F test/autoindex2.test af7e595c6864cc6ef5fc38d5db579a3e34940cb8
|
||||
F test/autoindex3.test a3be0d1a53a7d2edff208a5e442312957047e972
|
||||
F test/autoindex4.test 49d3cd791a9baa16fb461d7ea3de80d019a819cf
|
||||
F test/autoindex5.test 6f487290ce2a667c24517191651bfb8c7d86b6dc
|
||||
F test/autovacuum.test 941892505d2c0f410a0cb5970dfa1c7c4e5f6e74
|
||||
F test/autovacuum_ioerr2.test 8a367b224183ad801e0e24dcb7d1501f45f244b4
|
||||
F test/avtrans.test 0252654f4295ddda3b2cce0e894812259e655a85
|
||||
@@ -651,10 +653,10 @@ F test/fuzz2.test 76dc35b32b6d6f965259508508abce75a6c4d7e1
|
||||
F test/fuzz3.test efd384b896c647b61a2c1848ba70d42aad60a7b3
|
||||
F test/fuzz_common.tcl a87dfbb88c2a6b08a38e9a070dabd129e617b45b
|
||||
F test/fuzz_malloc.test 328f70aaca63adf29b4c6f06505ed0cf57ca7c26
|
||||
F test/fuzzcheck.c 348c2ac1ef3fde2eb7d312d5bf6fbf7ff42033b3
|
||||
F test/fuzzcheck.c a60f926e3fa86c8d33908406d75eec868c22b9ca
|
||||
F test/fuzzdata1.db b60254eeb6bc11474071b883059662a73c48da7f
|
||||
F test/fuzzdata2.db f03a420d3b822cc82e4f894ca957618fbe9c4973
|
||||
F test/fuzzdata3.db 57ae47d2a1c837fb8ddc10ce4ab56a04ad044cb4
|
||||
F test/fuzzdata3.db 3632e598ff8574228aadf09897bd040d3c5f5ffb
|
||||
F test/fuzzer1.test d4c52aaf3ef923da293a2653cfab33d02f718a36
|
||||
F test/fuzzerfault.test 8792cd77fd5bce765b05d0c8e01b9edcf8af8536
|
||||
F test/genesis.tcl 1e2e2e8e5cc4058549a154ff1892fe5c9de19f98
|
||||
@@ -819,7 +821,7 @@ F test/pagesize.test 5769fc62d8c890a83a503f67d47508dfdc543305
|
||||
F test/pcache.test b09104b03160aca0d968d99e8cd2c5b1921a993d
|
||||
F test/pcache2.test a83efe2dec0d392f814bfc998def1d1833942025
|
||||
F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff
|
||||
F test/permutations.test 0e2dc2aab7b1043bd2b4404f51651c31da007e52
|
||||
F test/permutations.test 32e2b82e0dfbe5c6b6b38a5c1f4cac194298ad4e
|
||||
F test/pragma.test be7195f0aa72bdb8a512133e9640ac40f15b57a2
|
||||
F test/pragma2.test f624a496a95ee878e81e59961eade66d5c00c028
|
||||
F test/pragma3.test 6f849ccffeee7e496d2f2b5e74152306c0b8757c
|
||||
@@ -838,11 +840,12 @@ F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df
|
||||
F test/rdonly.test 64e2696c322e3538df0b1ed624e21f9a23ed9ff8
|
||||
F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8
|
||||
F test/reindex.test 44edd3966b474468b823d481eafef0c305022254
|
||||
F test/releasetest.tcl e340abab899d4b8bdd87ff434e10a83ebe38c5ac
|
||||
F test/releasetest.tcl 3e906a8bbd047b8e1f035984fbdc96df4caaea47
|
||||
F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb
|
||||
F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea
|
||||
F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14
|
||||
F test/rollbackfault.test 6a004f71087cc399296cffbb5429ea6da655ae65
|
||||
F test/rowallock.test f7f834125f11ff62f6e1ae7d0b07fd9228f2d5a2
|
||||
F test/rowhash.test 0bc1d31415e4575d10cacf31e1a66b5cc0f8be81
|
||||
F test/rowid.test 742b5741584a8a44fd83e856cc2896688401d645
|
||||
F test/rtree.test 0c8d9dd458d6824e59683c19ab2ffa9ef946f798
|
||||
@@ -1212,10 +1215,10 @@ F test/wild001.test bca33f499866f04c24510d74baf1e578d4e44b1c
|
||||
F test/win32heap.test ea19770974795cff26e11575e12d422dbd16893c
|
||||
F test/win32lock.test fbf107c91d8f5512be5a5b87c4c42ab9fdd54972
|
||||
F test/win32longpath.test 169c75a3b2e43481f4a62122510210c67b08f26d
|
||||
F test/with1.test a86bf7f9288ba759a25ee57221d3bffaca36032a
|
||||
F test/with1.test e99845d4f4bf7863b61f104de554c61739d65764
|
||||
F test/with2.test ee227a663586aa09771cafd4fa269c5217eaf775
|
||||
F test/withM.test e97f2a8c506ab3ea9eab94e6f6072f6cc924c991
|
||||
F test/without_rowid1.test 4cda656cb4a452296e0d8d8623513f4be80c6d86
|
||||
F test/without_rowid1.test 1a7b9bd51b899928d327052df9741d2fe8dbe701
|
||||
F test/without_rowid2.test af260339f79d13cb220288b67cd287fbcf81ad99
|
||||
F test/without_rowid3.test 1081aabf60a1e1123b7f9a8f6ae19954351843b0
|
||||
F test/without_rowid4.test 4e08bcbaee0399f35d58b5581881e7a6243d458a
|
||||
@@ -1241,7 +1244,7 @@ F tool/logest.c eef612f8adf4d0993dafed0416064cf50d5d33c6
|
||||
F tool/mkautoconfamal.sh d1a2da0e15b2ed33d60af35c7e9d483f13a8eb9f
|
||||
F tool/mkkeywordhash.c dfff09dbbfaf950e89af294f48f902181b144670
|
||||
F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e
|
||||
F tool/mkpragmatab.tcl 94f196c9961e0ca3513e29f57125a3197808be2d
|
||||
F tool/mkpragmatab.tcl 40c287d3f929ece67da6e9e7c49885789960accf
|
||||
F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
|
||||
F tool/mksqlite3c-noext.tcl 69bae8ce4aa52d2ff82d4a8a856bf283ec035b2e
|
||||
F tool/mksqlite3c.tcl fdeab4c1eed90b7ab741ec12a7bc5c2fb60188bd
|
||||
@@ -1279,7 +1282,10 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
P 075003930da98419f671b7833a5850693529fb62 76770c9e061e2eb106d7ea402eef888b98ba9d0e
|
||||
R 3d82c0fa4f6ee04379bd9745bde5d911
|
||||
U dan
|
||||
Z 537a6ddf41a5c2e06d41f2aa9a07cb1e
|
||||
P bce3f04186cd2d69414a5a98b5b77dc8f060554a
|
||||
R 98be638f0f819b9a8a15b45777fdc534
|
||||
T *branch * affinity-func
|
||||
T *sym-affinity-func *
|
||||
T -sym-blob-affinity-rename *
|
||||
U drh
|
||||
Z 13640b2e248aab3cf67f2fff3528da6a
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
e85628e34ac684b8a23f49eee71e4d6546e0ef64
|
||||
80889306bf57b886a248b880bc90197b8975a666
|
||||
+1
-1
@@ -692,7 +692,7 @@ void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){
|
||||
if( pDflt ){
|
||||
sqlite3_value *pVal = 0;
|
||||
int rc;
|
||||
rc = sqlite3ValueFromExpr(db, pDflt, SQLITE_UTF8, SQLITE_AFF_NONE, &pVal);
|
||||
rc = sqlite3ValueFromExpr(db, pDflt, SQLITE_UTF8, SQLITE_AFF_BLOB, &pVal);
|
||||
assert( rc==SQLITE_OK || rc==SQLITE_NOMEM );
|
||||
if( rc!=SQLITE_OK ){
|
||||
db->mallocFailed = 1;
|
||||
|
||||
+80
-46
@@ -1196,26 +1196,18 @@ static int defragmentPage(MemPage *pPage){
|
||||
pc = get2byte(pAddr);
|
||||
testcase( pc==iCellFirst );
|
||||
testcase( pc==iCellLast );
|
||||
#if !defined(SQLITE_ENABLE_OVERSIZE_CELL_CHECK)
|
||||
/* These conditions have already been verified in btreeInitPage()
|
||||
** if SQLITE_ENABLE_OVERSIZE_CELL_CHECK is defined
|
||||
** if PRAGMA cell_size_check=ON.
|
||||
*/
|
||||
if( pc<iCellFirst || pc>iCellLast ){
|
||||
return SQLITE_CORRUPT_BKPT;
|
||||
}
|
||||
#endif
|
||||
assert( pc>=iCellFirst && pc<=iCellLast );
|
||||
size = cellSizePtr(pPage, &src[pc]);
|
||||
cbrk -= size;
|
||||
#if defined(SQLITE_ENABLE_OVERSIZE_CELL_CHECK)
|
||||
if( cbrk<iCellFirst ){
|
||||
return SQLITE_CORRUPT_BKPT;
|
||||
}
|
||||
#else
|
||||
if( cbrk<iCellFirst || pc+size>usableSize ){
|
||||
return SQLITE_CORRUPT_BKPT;
|
||||
}
|
||||
#endif
|
||||
assert( cbrk+size<=usableSize && cbrk>=iCellFirst );
|
||||
testcase( cbrk+size==usableSize );
|
||||
testcase( pc+size==usableSize );
|
||||
@@ -1343,7 +1335,11 @@ static int allocateSpace(MemPage *pPage, int nByte, int *pIdx){
|
||||
** However, that integer is too large to be stored in a 2-byte unsigned
|
||||
** integer, so a value of 0 is used in its place. */
|
||||
top = get2byteNotZero(&data[hdr+5]);
|
||||
if( gap>top || (u32)top>pPage->pBt->usableSize ) return SQLITE_CORRUPT_BKPT;
|
||||
if( gap>top || NEVER((u32)top>pPage->pBt->usableSize) ){
|
||||
/* The NEVER() is because a oversize "top" value will be blocked from
|
||||
** reaching this point by btreeInitPage() or btreeGetUnusedPage() */
|
||||
return SQLITE_CORRUPT_BKPT;
|
||||
}
|
||||
|
||||
/* If there is enough space between gap and top for one more cell pointer
|
||||
** array entry offset, and if the freelist is not empty, then search the
|
||||
@@ -1556,6 +1552,7 @@ static int decodeFlags(MemPage *pPage, int flagByte){
|
||||
static int btreeInitPage(MemPage *pPage){
|
||||
|
||||
assert( pPage->pBt!=0 );
|
||||
assert( pPage->pBt->db!=0 );
|
||||
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
|
||||
assert( pPage->pgno==sqlite3PagerPagenumber(pPage->pDbPage) );
|
||||
assert( pPage == sqlite3PagerGetExtra(pPage->pDbPage) );
|
||||
@@ -1614,8 +1611,7 @@ static int btreeInitPage(MemPage *pPage){
|
||||
*/
|
||||
iCellFirst = cellOffset + 2*pPage->nCell;
|
||||
iCellLast = usableSize - 4;
|
||||
#if defined(SQLITE_ENABLE_OVERSIZE_CELL_CHECK)
|
||||
{
|
||||
if( pBt->db->flags & SQLITE_CellSizeCk ){
|
||||
int i; /* Index into the cell pointer array */
|
||||
int sz; /* Size of a cell */
|
||||
|
||||
@@ -1635,7 +1631,6 @@ static int btreeInitPage(MemPage *pPage){
|
||||
}
|
||||
if( !pPage->leaf ) iCellLast++;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Compute the total free space on the page
|
||||
** EVIDENCE-OF: R-23588-34450 The two-byte integer at offset 1 gives the
|
||||
@@ -1732,10 +1727,10 @@ static MemPage *btreePageFromDbPage(DbPage *pDbPage, Pgno pgno, BtShared *pBt){
|
||||
|
||||
/*
|
||||
** Get a page from the pager. Initialize the MemPage.pBt and
|
||||
** MemPage.aData elements if needed.
|
||||
** MemPage.aData elements if needed. See also: btreeGetUnusedPage().
|
||||
**
|
||||
** If the noContent flag is set, it means that we do not care about
|
||||
** the content of the page at this time. So do not go to the disk
|
||||
** If the PAGER_GET_NOCONTENT flag is set, it means that we do not care
|
||||
** about the content of the page at this time. So do not go to the disk
|
||||
** to fetch the content. Just fill in the content with zeros for now.
|
||||
** If in the future we call sqlite3PagerWrite() on this page, that
|
||||
** means we have started to be concerned about content and the disk
|
||||
@@ -1837,6 +1832,36 @@ static void releasePage(MemPage *pPage){
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Get an unused page.
|
||||
**
|
||||
** This works just like btreeGetPage() with the addition:
|
||||
**
|
||||
** * If the page is already in use for some other purpose, immediately
|
||||
** release it and return an SQLITE_CURRUPT error.
|
||||
** * Make sure the isInit flag is clear
|
||||
*/
|
||||
static int btreeGetUnusedPage(
|
||||
BtShared *pBt, /* The btree */
|
||||
Pgno pgno, /* Number of the page to fetch */
|
||||
MemPage **ppPage, /* Return the page in this parameter */
|
||||
int flags /* PAGER_GET_NOCONTENT or PAGER_GET_READONLY */
|
||||
){
|
||||
int rc = btreeGetPage(pBt, pgno, ppPage, flags);
|
||||
if( rc==SQLITE_OK ){
|
||||
if( sqlite3PagerPageRefcount((*ppPage)->pDbPage)>1 ){
|
||||
releasePage(*ppPage);
|
||||
*ppPage = 0;
|
||||
return SQLITE_CORRUPT_BKPT;
|
||||
}
|
||||
(*ppPage)->isInit = 0;
|
||||
}else{
|
||||
*ppPage = 0;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** During a rollback, when the pager reloads information into the cache
|
||||
** so that the cache is restored to its original state at the start of
|
||||
@@ -4922,7 +4947,7 @@ int sqlite3BtreeMovetoUnpacked(
|
||||
}
|
||||
}else{
|
||||
for(;;){
|
||||
int nCell;
|
||||
int nCell; /* Size of the pCell cell in bytes */
|
||||
pCell = findCell(pPage, idx) + pPage->childPtrSize;
|
||||
|
||||
/* The maximum supported page-size is 65536 bytes. This means that
|
||||
@@ -4951,12 +4976,25 @@ int sqlite3BtreeMovetoUnpacked(
|
||||
/* The record flows over onto one or more overflow pages. In
|
||||
** this case the whole cell needs to be parsed, a buffer allocated
|
||||
** and accessPayload() used to retrieve the record into the
|
||||
** buffer before VdbeRecordCompare() can be called. */
|
||||
** buffer before VdbeRecordCompare() can be called.
|
||||
**
|
||||
** If the record is corrupt, the xRecordCompare routine may read
|
||||
** up to two varints past the end of the buffer. An extra 18
|
||||
** bytes of padding is allocated at the end of the buffer in
|
||||
** case this happens. */
|
||||
void *pCellKey;
|
||||
u8 * const pCellBody = pCell - pPage->childPtrSize;
|
||||
btreeParseCellPtr(pPage, pCellBody, &pCur->info);
|
||||
nCell = (int)pCur->info.nKey;
|
||||
pCellKey = sqlite3Malloc( nCell );
|
||||
testcase( nCell<0 ); /* True if key size is 2^32 or more */
|
||||
testcase( nCell==0 ); /* Invalid key size: 0x80 0x80 0x00 */
|
||||
testcase( nCell==1 ); /* Invalid key size: 0x80 0x80 0x01 */
|
||||
testcase( nCell==2 ); /* Minimum legal index key size */
|
||||
if( nCell<2 ){
|
||||
rc = SQLITE_CORRUPT_BKPT;
|
||||
goto moveto_finish;
|
||||
}
|
||||
pCellKey = sqlite3Malloc( nCell+18 );
|
||||
if( pCellKey==0 ){
|
||||
rc = SQLITE_NOMEM;
|
||||
goto moveto_finish;
|
||||
@@ -5249,8 +5287,7 @@ int sqlite3BtreePrevious(BtCursor *pCur, int *pRes){
|
||||
** sqlite3PagerUnref() on the new page when it is done.
|
||||
**
|
||||
** SQLITE_OK is returned on success. Any other return value indicates
|
||||
** an error. *ppPage and *pPgno are undefined in the event of an error.
|
||||
** Do not invoke sqlite3PagerUnref() on *ppPage if an error is returned.
|
||||
** an error. *ppPage is set to NULL in the event of an error.
|
||||
**
|
||||
** If the "nearby" parameter is not 0, then an effort is made to
|
||||
** locate a page close to the page number "nearby". This can be used in an
|
||||
@@ -5344,7 +5381,7 @@ static int allocateBtreePage(
|
||||
if( iTrunk>mxPage ){
|
||||
rc = SQLITE_CORRUPT_BKPT;
|
||||
}else{
|
||||
rc = btreeGetPage(pBt, iTrunk, &pTrunk, 0);
|
||||
rc = btreeGetUnusedPage(pBt, iTrunk, &pTrunk, 0);
|
||||
}
|
||||
if( rc ){
|
||||
pTrunk = 0;
|
||||
@@ -5409,7 +5446,7 @@ static int allocateBtreePage(
|
||||
goto end_allocate_page;
|
||||
}
|
||||
testcase( iNewTrunk==mxPage );
|
||||
rc = btreeGetPage(pBt, iNewTrunk, &pNewTrunk, 0);
|
||||
rc = btreeGetUnusedPage(pBt, iNewTrunk, &pNewTrunk, 0);
|
||||
if( rc!=SQLITE_OK ){
|
||||
goto end_allocate_page;
|
||||
}
|
||||
@@ -5489,11 +5526,12 @@ static int allocateBtreePage(
|
||||
}
|
||||
put4byte(&aData[4], k-1);
|
||||
noContent = !btreeGetHasContent(pBt, *pPgno)? PAGER_GET_NOCONTENT : 0;
|
||||
rc = btreeGetPage(pBt, *pPgno, ppPage, noContent);
|
||||
rc = btreeGetUnusedPage(pBt, *pPgno, ppPage, noContent);
|
||||
if( rc==SQLITE_OK ){
|
||||
rc = sqlite3PagerWrite((*ppPage)->pDbPage);
|
||||
if( rc!=SQLITE_OK ){
|
||||
releasePage(*ppPage);
|
||||
*ppPage = 0;
|
||||
}
|
||||
}
|
||||
searchList = 0;
|
||||
@@ -5537,7 +5575,7 @@ static int allocateBtreePage(
|
||||
MemPage *pPg = 0;
|
||||
TRACE(("ALLOCATE: %d from end of file (pointer-map page)\n", pBt->nPage));
|
||||
assert( pBt->nPage!=PENDING_BYTE_PAGE(pBt) );
|
||||
rc = btreeGetPage(pBt, pBt->nPage, &pPg, bNoContent);
|
||||
rc = btreeGetUnusedPage(pBt, pBt->nPage, &pPg, bNoContent);
|
||||
if( rc==SQLITE_OK ){
|
||||
rc = sqlite3PagerWrite(pPg->pDbPage);
|
||||
releasePage(pPg);
|
||||
@@ -5551,11 +5589,12 @@ static int allocateBtreePage(
|
||||
*pPgno = pBt->nPage;
|
||||
|
||||
assert( *pPgno!=PENDING_BYTE_PAGE(pBt) );
|
||||
rc = btreeGetPage(pBt, *pPgno, ppPage, bNoContent);
|
||||
rc = btreeGetUnusedPage(pBt, *pPgno, ppPage, bNoContent);
|
||||
if( rc ) return rc;
|
||||
rc = sqlite3PagerWrite((*ppPage)->pDbPage);
|
||||
if( rc!=SQLITE_OK ){
|
||||
releasePage(*ppPage);
|
||||
*ppPage = 0;
|
||||
}
|
||||
TRACE(("ALLOCATE: %d from end of file\n", *pPgno));
|
||||
}
|
||||
@@ -5565,17 +5604,8 @@ static int allocateBtreePage(
|
||||
end_allocate_page:
|
||||
releasePage(pTrunk);
|
||||
releasePage(pPrevTrunk);
|
||||
if( rc==SQLITE_OK ){
|
||||
if( sqlite3PagerPageRefcount((*ppPage)->pDbPage)>1 ){
|
||||
releasePage(*ppPage);
|
||||
*ppPage = 0;
|
||||
return SQLITE_CORRUPT_BKPT;
|
||||
}
|
||||
(*ppPage)->isInit = 0;
|
||||
}else{
|
||||
*ppPage = 0;
|
||||
}
|
||||
assert( rc!=SQLITE_OK || sqlite3PagerIswriteable((*ppPage)->pDbPage) );
|
||||
assert( rc!=SQLITE_OK || sqlite3PagerPageRefcount((*ppPage)->pDbPage)<=1 );
|
||||
assert( rc!=SQLITE_OK || (*ppPage)->isInit==0 );
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -6111,9 +6141,9 @@ static void insertCell(
|
||||
ins = cellOffset + 2*i;
|
||||
rc = allocateSpace(pPage, sz, &idx);
|
||||
if( rc ){ *pRC = rc; return; }
|
||||
/* The allocateSpace() routine guarantees the following two properties
|
||||
** if it returns success */
|
||||
assert( idx >= end+2 );
|
||||
/* The allocateSpace() routine guarantees the following properties
|
||||
** if it returns successfully */
|
||||
assert( idx >= 0 && (idx >= end+2 || CORRUPT_DB) );
|
||||
assert( idx+sz <= (int)pPage->pBt->usableSize );
|
||||
pPage->nCell++;
|
||||
pPage->nFree -= (u16)(2 + sz);
|
||||
@@ -6855,6 +6885,14 @@ static int balance_nonroot(
|
||||
int limit;
|
||||
MemPage *pOld = apOld[i];
|
||||
|
||||
/* Verify that all sibling pages are of the same "type" (table-leaf,
|
||||
** table-interior, index-leaf, or index-interior).
|
||||
*/
|
||||
if( pOld->aData[0]!=apOld[0]->aData[0] ){
|
||||
rc = SQLITE_CORRUPT_BKPT;
|
||||
goto balance_cleanup;
|
||||
}
|
||||
|
||||
limit = pOld->nCell+pOld->nOverflow;
|
||||
if( pOld->nOverflow>0 ){
|
||||
for(j=0; j<limit; j++){
|
||||
@@ -6896,13 +6934,13 @@ static int balance_nonroot(
|
||||
memcpy(apCell[nCell], &pOld->aData[8], 4);
|
||||
}else{
|
||||
assert( leafCorrection==4 );
|
||||
if( szCell[nCell]<4 ){
|
||||
while( szCell[nCell]<4 ){
|
||||
/* Do not allow any cells smaller than 4 bytes. If a smaller cell
|
||||
** does exist, pad it with 0x00 bytes. */
|
||||
assert( szCell[nCell]==3 || CORRUPT_DB );
|
||||
assert( apCell[nCell]==&aSpace1[iSpace1-3] || CORRUPT_DB );
|
||||
aSpace1[iSpace1++] = 0x00;
|
||||
szCell[nCell] = 4;
|
||||
szCell[nCell]++;
|
||||
}
|
||||
}
|
||||
nCell++;
|
||||
@@ -6993,10 +7031,6 @@ static int balance_nonroot(
|
||||
/*
|
||||
** Allocate k new pages. Reuse old pages where possible.
|
||||
*/
|
||||
if( apOld[0]->pgno<=1 ){
|
||||
rc = SQLITE_CORRUPT_BKPT;
|
||||
goto balance_cleanup;
|
||||
}
|
||||
pageFlags = apOld[0]->aData[0];
|
||||
for(i=0; i<k; i++){
|
||||
MemPage *pNew;
|
||||
|
||||
+11
-11
@@ -1092,10 +1092,10 @@ void sqlite3AddColumn(Parse *pParse, Token *pName){
|
||||
pCol->zName = z;
|
||||
|
||||
/* If there is no type specified, columns have the default affinity
|
||||
** 'NONE'. If there is a type specified, then sqlite3AddColumnType() will
|
||||
** 'BLOB'. If there is a type specified, then sqlite3AddColumnType() will
|
||||
** be called next to set pCol->affinity correctly.
|
||||
*/
|
||||
pCol->affinity = SQLITE_AFF_NONE;
|
||||
pCol->affinity = SQLITE_AFF_BLOB;
|
||||
pCol->szEst = 1;
|
||||
p->nCol++;
|
||||
}
|
||||
@@ -1130,7 +1130,7 @@ void sqlite3AddNotNull(Parse *pParse, int onError){
|
||||
** 'CHAR' | SQLITE_AFF_TEXT
|
||||
** 'CLOB' | SQLITE_AFF_TEXT
|
||||
** 'TEXT' | SQLITE_AFF_TEXT
|
||||
** 'BLOB' | SQLITE_AFF_NONE
|
||||
** 'BLOB' | SQLITE_AFF_BLOB
|
||||
** 'REAL' | SQLITE_AFF_REAL
|
||||
** 'FLOA' | SQLITE_AFF_REAL
|
||||
** 'DOUB' | SQLITE_AFF_REAL
|
||||
@@ -1156,7 +1156,7 @@ char sqlite3AffinityType(const char *zIn, u8 *pszEst){
|
||||
aff = SQLITE_AFF_TEXT;
|
||||
}else if( h==(('b'<<24)+('l'<<16)+('o'<<8)+'b') /* BLOB */
|
||||
&& (aff==SQLITE_AFF_NUMERIC || aff==SQLITE_AFF_REAL) ){
|
||||
aff = SQLITE_AFF_NONE;
|
||||
aff = SQLITE_AFF_BLOB;
|
||||
if( zIn[0]=='(' ) zChar = zIn;
|
||||
#ifndef SQLITE_OMIT_FLOATING_POINT
|
||||
}else if( h==(('r'<<24)+('e'<<16)+('a'<<8)+'l') /* REAL */
|
||||
@@ -1548,7 +1548,7 @@ static char *createTableStmt(sqlite3 *db, Table *p){
|
||||
zStmt[k++] = '(';
|
||||
for(pCol=p->aCol, i=0; i<p->nCol; i++, pCol++){
|
||||
static const char * const azType[] = {
|
||||
/* SQLITE_AFF_NONE */ "",
|
||||
/* SQLITE_AFF_BLOB */ "",
|
||||
/* SQLITE_AFF_TEXT */ " TEXT",
|
||||
/* SQLITE_AFF_NUMERIC */ " NUM",
|
||||
/* SQLITE_AFF_INTEGER */ " INT",
|
||||
@@ -1561,17 +1561,17 @@ static char *createTableStmt(sqlite3 *db, Table *p){
|
||||
k += sqlite3Strlen30(&zStmt[k]);
|
||||
zSep = zSep2;
|
||||
identPut(zStmt, &k, pCol->zName);
|
||||
assert( pCol->affinity-SQLITE_AFF_NONE >= 0 );
|
||||
assert( pCol->affinity-SQLITE_AFF_NONE < ArraySize(azType) );
|
||||
testcase( pCol->affinity==SQLITE_AFF_NONE );
|
||||
assert( pCol->affinity-SQLITE_AFF_BLOB >= 0 );
|
||||
assert( pCol->affinity-SQLITE_AFF_BLOB < ArraySize(azType) );
|
||||
testcase( pCol->affinity==SQLITE_AFF_BLOB );
|
||||
testcase( pCol->affinity==SQLITE_AFF_TEXT );
|
||||
testcase( pCol->affinity==SQLITE_AFF_NUMERIC );
|
||||
testcase( pCol->affinity==SQLITE_AFF_INTEGER );
|
||||
testcase( pCol->affinity==SQLITE_AFF_REAL );
|
||||
|
||||
zType = azType[pCol->affinity - SQLITE_AFF_NONE];
|
||||
zType = azType[pCol->affinity - SQLITE_AFF_BLOB];
|
||||
len = sqlite3Strlen30(zType);
|
||||
assert( pCol->affinity==SQLITE_AFF_NONE
|
||||
assert( pCol->affinity==SQLITE_AFF_BLOB
|
||||
|| pCol->affinity==sqlite3AffinityType(zType, 0) );
|
||||
memcpy(&zStmt[k], zType, len);
|
||||
k += len;
|
||||
@@ -1844,7 +1844,7 @@ void sqlite3EndTable(
|
||||
if( (p->tabFlags & TF_HasPrimaryKey)==0 ){
|
||||
sqlite3ErrorMsg(pParse, "PRIMARY KEY missing on table %s", p->zName);
|
||||
}else{
|
||||
p->tabFlags |= TF_WithoutRowid;
|
||||
p->tabFlags |= TF_WithoutRowid | TF_NoVisibleRowid;
|
||||
convertToWithoutRowidTable(pParse, p);
|
||||
}
|
||||
}
|
||||
|
||||
+24
-8
@@ -191,13 +191,13 @@ char sqlite3CompareAffinity(Expr *pExpr, char aff2){
|
||||
if( sqlite3IsNumericAffinity(aff1) || sqlite3IsNumericAffinity(aff2) ){
|
||||
return SQLITE_AFF_NUMERIC;
|
||||
}else{
|
||||
return SQLITE_AFF_NONE;
|
||||
return SQLITE_AFF_BLOB;
|
||||
}
|
||||
}else if( !aff1 && !aff2 ){
|
||||
/* Neither side of the comparison is a column. Compare the
|
||||
** results directly.
|
||||
*/
|
||||
return SQLITE_AFF_NONE;
|
||||
return SQLITE_AFF_BLOB;
|
||||
}else{
|
||||
/* One side is a column, the other is not. Use the columns affinity. */
|
||||
assert( aff1==0 || aff2==0 );
|
||||
@@ -221,7 +221,7 @@ static char comparisonAffinity(Expr *pExpr){
|
||||
}else if( ExprHasProperty(pExpr, EP_xIsSelect) ){
|
||||
aff = sqlite3CompareAffinity(pExpr->x.pSelect->pEList->a[0].pExpr, aff);
|
||||
}else if( !aff ){
|
||||
aff = SQLITE_AFF_NONE;
|
||||
aff = SQLITE_AFF_BLOB;
|
||||
}
|
||||
return aff;
|
||||
}
|
||||
@@ -235,7 +235,7 @@ static char comparisonAffinity(Expr *pExpr){
|
||||
int sqlite3IndexAffinityOk(Expr *pExpr, char idx_affinity){
|
||||
char aff = comparisonAffinity(pExpr);
|
||||
switch( aff ){
|
||||
case SQLITE_AFF_NONE:
|
||||
case SQLITE_AFF_BLOB:
|
||||
return 1;
|
||||
case SQLITE_AFF_TEXT:
|
||||
return idx_affinity==SQLITE_AFF_TEXT;
|
||||
@@ -1268,7 +1268,7 @@ u32 sqlite3ExprListFlags(const ExprList *pList){
|
||||
**
|
||||
** sqlite3ExprIsConstant() pWalker->eCode==1
|
||||
** sqlite3ExprIsConstantNotJoin() pWalker->eCode==2
|
||||
** sqlite3ExprRefOneTableOnly() pWalker->eCode==3
|
||||
** sqlite3ExprIsTableConstant() pWalker->eCode==3
|
||||
** sqlite3ExprIsConstantOrFunction() pWalker->eCode==4 or 5
|
||||
**
|
||||
** In all cases, the callbacks set Walker.eCode=0 and abort if the expression
|
||||
@@ -1376,7 +1376,7 @@ int sqlite3ExprIsConstantNotJoin(Expr *p){
|
||||
}
|
||||
|
||||
/*
|
||||
** Walk an expression tree. Return non-zero if the expression constant
|
||||
** Walk an expression tree. Return non-zero if the expression is constant
|
||||
** for any single row of the table with cursor iCur. In other words, the
|
||||
** expression must not refer to any non-deterministic function nor any
|
||||
** table other than iCur.
|
||||
@@ -1482,7 +1482,7 @@ int sqlite3ExprCanBeNull(const Expr *p){
|
||||
*/
|
||||
int sqlite3ExprNeedsNoAffinityChange(const Expr *p, char aff){
|
||||
u8 op;
|
||||
if( aff==SQLITE_AFF_NONE ) return 1;
|
||||
if( aff==SQLITE_AFF_BLOB ) return 1;
|
||||
while( p->op==TK_UPLUS || p->op==TK_UMINUS ){ p = p->pLeft; }
|
||||
op = p->op;
|
||||
if( op==TK_REGISTER ) op = p->op2;
|
||||
@@ -1933,7 +1933,7 @@ int sqlite3CodeSubselect(
|
||||
int r1, r2, r3;
|
||||
|
||||
if( !affinity ){
|
||||
affinity = SQLITE_AFF_NONE;
|
||||
affinity = SQLITE_AFF_BLOB;
|
||||
}
|
||||
if( pKeyInfo ){
|
||||
assert( sqlite3KeyInfoIsWriteable(pKeyInfo) );
|
||||
@@ -2874,6 +2874,22 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){
|
||||
break;
|
||||
}
|
||||
|
||||
/* The AFFINITY() function returns the type affinity of its argument.
|
||||
** The type affinity is a compile-time value, so we might as well
|
||||
** code it directly.
|
||||
*/
|
||||
if( pDef->funcFlags & SQLITE_FUNC_AFFINITY ){
|
||||
int aff;
|
||||
static const char *const azAffName[] = {
|
||||
"", "BLOB", "TEXT", "NUMERIC", "INTEGER", "REAL"
|
||||
};
|
||||
assert( nFarg==1 );
|
||||
aff = sqlite3ExprAffinity(pFarg->a[0].pExpr);
|
||||
if( aff ) aff -= SQLITE_AFF_BLOB - 1;
|
||||
sqlite3VdbeAddOp4(v, OP_String8, 0, target, 0, azAffName[aff], 0);
|
||||
break;
|
||||
}
|
||||
|
||||
for(i=0; i<nFarg; i++){
|
||||
if( i<32 && sqlite3ExprIsConstant(pFarg->a[i].pExpr) ){
|
||||
testcase( i==31 );
|
||||
|
||||
@@ -1717,6 +1717,7 @@ void sqlite3RegisterGlobalFunctions(void){
|
||||
AGGREGATE2(max, 1, 1, 1, minmaxStep, minMaxFinalize,
|
||||
SQLITE_FUNC_MINMAX ),
|
||||
FUNCTION2(typeof, 1, 0, 0, typeofFunc, SQLITE_FUNC_TYPEOF),
|
||||
FUNCTION2(affinity, 1, 0, 0, noopFunc, SQLITE_FUNC_AFFINITY),
|
||||
FUNCTION2(length, 1, 0, 0, lengthFunc, SQLITE_FUNC_LENGTH),
|
||||
FUNCTION(instr, 2, 0, 0, instrFunc ),
|
||||
FUNCTION(substr, 2, 0, 0, substrFunc ),
|
||||
|
||||
+5
-5
@@ -56,7 +56,7 @@ void sqlite3OpenTable(
|
||||
**
|
||||
** Character Column affinity
|
||||
** ------------------------------
|
||||
** 'A' NONE
|
||||
** 'A' BLOB
|
||||
** 'B' TEXT
|
||||
** 'C' NUMERIC
|
||||
** 'D' INTEGER
|
||||
@@ -99,9 +99,9 @@ const char *sqlite3IndexAffinityStr(Vdbe *v, Index *pIdx){
|
||||
|
||||
/*
|
||||
** Compute the affinity string for table pTab, if it has not already been
|
||||
** computed. As an optimization, omit trailing SQLITE_AFF_NONE affinities.
|
||||
** computed. As an optimization, omit trailing SQLITE_AFF_BLOB affinities.
|
||||
**
|
||||
** If the affinity exists (if it is no entirely SQLITE_AFF_NONE values) and
|
||||
** If the affinity exists (if it is no entirely SQLITE_AFF_BLOB values) and
|
||||
** if iReg>0 then code an OP_Affinity opcode that will set the affinities
|
||||
** for register iReg and following. Or if affinities exists and iReg==0,
|
||||
** then just set the P4 operand of the previous opcode (which should be
|
||||
@@ -111,7 +111,7 @@ const char *sqlite3IndexAffinityStr(Vdbe *v, Index *pIdx){
|
||||
**
|
||||
** Character Column affinity
|
||||
** ------------------------------
|
||||
** 'A' NONE
|
||||
** 'A' BLOB
|
||||
** 'B' TEXT
|
||||
** 'C' NUMERIC
|
||||
** 'D' INTEGER
|
||||
@@ -133,7 +133,7 @@ void sqlite3TableAffinity(Vdbe *v, Table *pTab, int iReg){
|
||||
}
|
||||
do{
|
||||
zColAff[i--] = 0;
|
||||
}while( i>=0 && zColAff[i]==SQLITE_AFF_NONE );
|
||||
}while( i>=0 && zColAff[i]==SQLITE_AFF_BLOB );
|
||||
pTab->zColAff = zColAff;
|
||||
}
|
||||
i = sqlite3Strlen30(zColAff);
|
||||
|
||||
@@ -2758,6 +2758,9 @@ static int openDatabase(
|
||||
#endif
|
||||
#if defined(SQLITE_REVERSE_UNORDERED_SELECTS)
|
||||
| SQLITE_ReverseOrder
|
||||
#endif
|
||||
#if defined(SQLITE_ENABLE_OVERSIZE_CELL_CHECK)
|
||||
| SQLITE_CellSizeCk
|
||||
#endif
|
||||
;
|
||||
sqlite3HashInit(&db->aCollSeq);
|
||||
|
||||
@@ -3015,6 +3015,12 @@ static int winLock(sqlite3_file *id, int locktype){
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
/* Do not allow any kind of write-lock on a read-only database
|
||||
*/
|
||||
if( (pFile->ctrlFlags & WINFILE_RDONLY)!=0 && locktype>=RESERVED_LOCK ){
|
||||
return SQLITE_IOERR_LOCK;
|
||||
}
|
||||
|
||||
/* Make sure the locking sequence is correct
|
||||
*/
|
||||
assert( pFile->locktype!=NO_LOCK || locktype==SHARED_LOCK );
|
||||
|
||||
+3
-3
@@ -166,7 +166,7 @@ create_table_args ::= AS select(S). {
|
||||
table_options(A) ::= . {A = 0;}
|
||||
table_options(A) ::= WITHOUT nm(X). {
|
||||
if( X.n==5 && sqlite3_strnicmp(X.z,"rowid",5)==0 ){
|
||||
A = TF_WithoutRowid;
|
||||
A = TF_WithoutRowid | TF_NoVisibleRowid;
|
||||
}else{
|
||||
A = 0;
|
||||
sqlite3ErrorMsg(pParse, "unknown table option: %.*s", X.n, X.z);
|
||||
@@ -527,7 +527,7 @@ values(A) ::= values(X) COMMA LP exprlist(Y) RP. {
|
||||
//
|
||||
%type distinct {u16}
|
||||
distinct(A) ::= DISTINCT. {A = SF_Distinct;}
|
||||
distinct(A) ::= ALL. {A = 0;}
|
||||
distinct(A) ::= ALL. {A = SF_All;}
|
||||
distinct(A) ::= . {A = 0;}
|
||||
|
||||
// selcollist is a list of expressions that are to become the return
|
||||
@@ -890,7 +890,7 @@ expr(A) ::= id(X) LP distinct(D) exprlist(Y) RP(E). {
|
||||
}
|
||||
A.pExpr = sqlite3ExprFunction(pParse, Y, &X);
|
||||
spanSet(&A,&X,&E);
|
||||
if( D && A.pExpr ){
|
||||
if( D==SF_Distinct && A.pExpr ){
|
||||
A.pExpr->flags |= EP_Distinct;
|
||||
}
|
||||
}
|
||||
|
||||
+5
-1
@@ -99,6 +99,10 @@ static const struct sPragmaNames {
|
||||
/* ePragTyp: */ PragTyp_CASE_SENSITIVE_LIKE,
|
||||
/* ePragFlag: */ 0,
|
||||
/* iArg: */ 0 },
|
||||
{ /* zName: */ "cell_size_check",
|
||||
/* ePragTyp: */ PragTyp_FLAG,
|
||||
/* ePragFlag: */ 0,
|
||||
/* iArg: */ SQLITE_CellSizeCk },
|
||||
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
{ /* zName: */ "checkpoint_fullfsync",
|
||||
/* ePragTyp: */ PragTyp_FLAG,
|
||||
@@ -456,4 +460,4 @@ static const struct sPragmaNames {
|
||||
/* iArg: */ SQLITE_WriteSchema|SQLITE_RecoveryMode },
|
||||
#endif
|
||||
};
|
||||
/* Number of pragmas: 59 on by default, 72 total. */
|
||||
/* Number of pragmas: 60 on by default, 73 total. */
|
||||
|
||||
+2
-2
@@ -358,7 +358,7 @@ static int lookupName(
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( iCol>=pTab->nCol && sqlite3IsRowid(zCol) && HasRowid(pTab) ){
|
||||
if( iCol>=pTab->nCol && sqlite3IsRowid(zCol) && VisibleRowid(pTab) ){
|
||||
/* IMP: R-51414-32910 */
|
||||
/* IMP: R-44911-55124 */
|
||||
iCol = -1;
|
||||
@@ -388,7 +388,7 @@ static int lookupName(
|
||||
** Perhaps the name is a reference to the ROWID
|
||||
*/
|
||||
if( cnt==0 && cntTab==1 && pMatch && sqlite3IsRowid(zCol)
|
||||
&& HasRowid(pMatch->pTab) ){
|
||||
&& VisibleRowid(pMatch->pTab) ){
|
||||
cnt = 1;
|
||||
pExpr->iColumn = -1; /* IMP: R-44911-55124 */
|
||||
pExpr->affinity = SQLITE_AFF_INTEGER;
|
||||
|
||||
+3
-2
@@ -1709,7 +1709,7 @@ static void selectAddColumnTypeAndCollation(
|
||||
}
|
||||
szAll += pCol->szEst;
|
||||
pCol->affinity = sqlite3ExprAffinity(p);
|
||||
if( pCol->affinity==0 ) pCol->affinity = SQLITE_AFF_NONE;
|
||||
if( pCol->affinity==0 ) pCol->affinity = SQLITE_AFF_BLOB;
|
||||
pColl = sqlite3ExprCollSeq(pParse, p);
|
||||
if( pColl && pCol->zColl==0 ){
|
||||
pCol->zColl = sqlite3DbStrDup(db, pColl->zName);
|
||||
@@ -3991,7 +3991,7 @@ static int withExpand(
|
||||
pTab->zName = sqlite3DbStrDup(db, pCte->zName);
|
||||
pTab->iPKey = -1;
|
||||
pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) );
|
||||
pTab->tabFlags |= TF_Ephemeral;
|
||||
pTab->tabFlags |= TF_Ephemeral | TF_NoVisibleRowid;
|
||||
pFrom->pSelect = sqlite3SelectDup(db, pCte->pSelect, 0);
|
||||
if( db->mallocFailed ) return SQLITE_NOMEM;
|
||||
assert( pFrom->pSelect );
|
||||
@@ -4817,6 +4817,7 @@ int sqlite3Select(
|
||||
}
|
||||
i = -1;
|
||||
}else if( pTabList->nSrc==1
|
||||
&& (p->selFlags & SF_All)==0
|
||||
&& OptimizationEnabled(db, SQLITE_SubqCoroutine)
|
||||
){
|
||||
/* Implement a co-routine that will return a single row of the result
|
||||
|
||||
+1
-1
@@ -956,7 +956,7 @@ struct sqlite3_io_methods {
|
||||
** pointed to by the pArg argument. This capability is used during testing
|
||||
** and only needs to be supported when SQLITE_TEST is defined.
|
||||
**
|
||||
* <li>[[SQLITE_FCNTL_WAL_BLOCK]]
|
||||
** <li>[[SQLITE_FCNTL_WAL_BLOCK]]
|
||||
** The [SQLITE_FCNTL_WAL_BLOCK] is a signal to the VFS layer that it might
|
||||
** be advantageous to block on the next WAL lock if the lock is not immediately
|
||||
** available. The WAL subsystem issues this signal during rare
|
||||
|
||||
+33
-28
@@ -1253,6 +1253,7 @@ struct sqlite3 {
|
||||
#define SQLITE_QueryOnly 0x02000000 /* Disable database changes */
|
||||
#define SQLITE_VdbeEQP 0x04000000 /* Debug EXPLAIN QUERY PLAN */
|
||||
#define SQLITE_Vacuum 0x08000000 /* Currently in a VACUUM */
|
||||
#define SQLITE_CellSizeCk 0x10000000 /* Check btree cell sizes on load */
|
||||
|
||||
|
||||
/*
|
||||
@@ -1347,18 +1348,19 @@ struct FuncDestructor {
|
||||
** values must correspond to OPFLAG_LENGTHARG and OPFLAG_TYPEOFARG. There
|
||||
** are assert() statements in the code to verify this.
|
||||
*/
|
||||
#define SQLITE_FUNC_ENCMASK 0x003 /* SQLITE_UTF8, SQLITE_UTF16BE or UTF16LE */
|
||||
#define SQLITE_FUNC_LIKE 0x004 /* Candidate for the LIKE optimization */
|
||||
#define SQLITE_FUNC_CASE 0x008 /* Case-sensitive LIKE-type function */
|
||||
#define SQLITE_FUNC_EPHEM 0x010 /* Ephemeral. Delete with VDBE */
|
||||
#define SQLITE_FUNC_NEEDCOLL 0x020 /* sqlite3GetFuncCollSeq() might be called */
|
||||
#define SQLITE_FUNC_LENGTH 0x040 /* Built-in length() function */
|
||||
#define SQLITE_FUNC_TYPEOF 0x080 /* Built-in typeof() function */
|
||||
#define SQLITE_FUNC_COUNT 0x100 /* Built-in count(*) aggregate */
|
||||
#define SQLITE_FUNC_COALESCE 0x200 /* Built-in coalesce() or ifnull() */
|
||||
#define SQLITE_FUNC_UNLIKELY 0x400 /* Built-in unlikely() function */
|
||||
#define SQLITE_FUNC_CONSTANT 0x800 /* Constant inputs give a constant output */
|
||||
#define SQLITE_FUNC_MINMAX 0x1000 /* True for min() and max() aggregates */
|
||||
#define SQLITE_FUNC_ENCMASK 0x0003 /* SQLITE_UTF8, SQLITE_UTF16BE or UTF16LE */
|
||||
#define SQLITE_FUNC_LIKE 0x0004 /* Candidate for the LIKE optimization */
|
||||
#define SQLITE_FUNC_CASE 0x0008 /* Case-sensitive LIKE-type function */
|
||||
#define SQLITE_FUNC_EPHEM 0x0010 /* Ephemeral. Delete with VDBE */
|
||||
#define SQLITE_FUNC_NEEDCOLL 0x0020 /* sqlite3GetFuncCollSeq might be called */
|
||||
#define SQLITE_FUNC_LENGTH 0x0040 /* Built-in length() function */
|
||||
#define SQLITE_FUNC_TYPEOF 0x0080 /* Built-in typeof() function */
|
||||
#define SQLITE_FUNC_COUNT 0x0100 /* Built-in count(*) aggregate */
|
||||
#define SQLITE_FUNC_COALESCE 0x0200 /* Built-in coalesce() or ifnull() */
|
||||
#define SQLITE_FUNC_UNLIKELY 0x0400 /* Built-in unlikely() function */
|
||||
#define SQLITE_FUNC_CONSTANT 0x0800 /* Constant inputs give a constant output */
|
||||
#define SQLITE_FUNC_MINMAX 0x1000 /* True for min() and max() aggregates */
|
||||
#define SQLITE_FUNC_AFFINITY 0x2000 /* Built-in affinity() function */
|
||||
|
||||
/*
|
||||
** The following three macros, FUNCTION(), LIKEFUNC() and AGGREGATE() are
|
||||
@@ -1500,9 +1502,9 @@ struct CollSeq {
|
||||
** used as the P4 operand, they will be more readable.
|
||||
**
|
||||
** Note also that the numeric types are grouped together so that testing
|
||||
** for a numeric type is a single comparison. And the NONE type is first.
|
||||
** for a numeric type is a single comparison. And the BLOB type is first.
|
||||
*/
|
||||
#define SQLITE_AFF_NONE 'A'
|
||||
#define SQLITE_AFF_BLOB 'A'
|
||||
#define SQLITE_AFF_TEXT 'B'
|
||||
#define SQLITE_AFF_NUMERIC 'C'
|
||||
#define SQLITE_AFF_INTEGER 'D'
|
||||
@@ -1634,8 +1636,9 @@ struct Table {
|
||||
#define TF_HasPrimaryKey 0x04 /* Table has a primary key */
|
||||
#define TF_Autoincrement 0x08 /* Integer primary key is autoincrement */
|
||||
#define TF_Virtual 0x10 /* Is a virtual table */
|
||||
#define TF_WithoutRowid 0x20 /* No rowid used. PRIMARY KEY is the key */
|
||||
#define TF_OOOHidden 0x40 /* Out-of-Order hidden columns */
|
||||
#define TF_WithoutRowid 0x20 /* No rowid. PRIMARY KEY is the key */
|
||||
#define TF_NoVisibleRowid 0x40 /* No user-visible "rowid" column */
|
||||
#define TF_OOOHidden 0x80 /* Out-of-Order hidden columns */
|
||||
|
||||
|
||||
/*
|
||||
@@ -1653,6 +1656,7 @@ struct Table {
|
||||
|
||||
/* Does the table have a rowid */
|
||||
#define HasRowid(X) (((X)->tabFlags & TF_WithoutRowid)==0)
|
||||
#define VisibleRowid(X) (((X)->tabFlags & TF_NoVisibleRowid)==0)
|
||||
|
||||
/*
|
||||
** Each foreign key constraint is an instance of the following structure.
|
||||
@@ -2393,19 +2397,20 @@ struct Select {
|
||||
** "Select Flag".
|
||||
*/
|
||||
#define SF_Distinct 0x0001 /* Output should be DISTINCT */
|
||||
#define SF_Resolved 0x0002 /* Identifiers have been resolved */
|
||||
#define SF_Aggregate 0x0004 /* Contains aggregate functions */
|
||||
#define SF_UsesEphemeral 0x0008 /* Uses the OpenEphemeral opcode */
|
||||
#define SF_Expanded 0x0010 /* sqlite3SelectExpand() called on this */
|
||||
#define SF_HasTypeInfo 0x0020 /* FROM subqueries have Table metadata */
|
||||
#define SF_Compound 0x0040 /* Part of a compound query */
|
||||
#define SF_Values 0x0080 /* Synthesized from VALUES clause */
|
||||
#define SF_MultiValue 0x0100 /* Single VALUES term with multiple rows */
|
||||
#define SF_NestedFrom 0x0200 /* Part of a parenthesized FROM clause */
|
||||
#define SF_MaybeConvert 0x0400 /* Need convertCompoundSelectToSubquery() */
|
||||
#define SF_Recursive 0x0800 /* The recursive part of a recursive CTE */
|
||||
#define SF_All 0x0002 /* Includes the ALL keyword */
|
||||
#define SF_Resolved 0x0004 /* Identifiers have been resolved */
|
||||
#define SF_Aggregate 0x0008 /* Contains aggregate functions */
|
||||
#define SF_UsesEphemeral 0x0010 /* Uses the OpenEphemeral opcode */
|
||||
#define SF_Expanded 0x0020 /* sqlite3SelectExpand() called on this */
|
||||
#define SF_HasTypeInfo 0x0040 /* FROM subqueries have Table metadata */
|
||||
#define SF_Compound 0x0080 /* Part of a compound query */
|
||||
#define SF_Values 0x0100 /* Synthesized from VALUES clause */
|
||||
#define SF_MultiValue 0x0200 /* Single VALUES term with multiple rows */
|
||||
#define SF_NestedFrom 0x0400 /* Part of a parenthesized FROM clause */
|
||||
#define SF_MaybeConvert 0x0800 /* Need convertCompoundSelectToSubquery() */
|
||||
#define SF_MinMaxAgg 0x1000 /* Aggregate containing min() or max() */
|
||||
#define SF_Converted 0x2000 /* By convertCompoundSelectToSubquery() */
|
||||
#define SF_Recursive 0x2000 /* The recursive part of a recursive CTE */
|
||||
#define SF_Converted 0x4000 /* By convertCompoundSelectToSubquery() */
|
||||
|
||||
|
||||
/*
|
||||
|
||||
+2
-1
@@ -450,7 +450,8 @@ int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){
|
||||
}
|
||||
abort_parse:
|
||||
assert( nErr==0 );
|
||||
if( pParse->rc==SQLITE_OK && db->mallocFailed==0 && zSql[i]==0 ){
|
||||
if( pParse->rc==SQLITE_OK && db->mallocFailed==0 ){
|
||||
assert( zSql[i]==0 );
|
||||
if( lastTokenParsed!=TK_SEMI ){
|
||||
sqlite3Parser(pEngine, TK_SEMI, pParse->sLastToken, pParse);
|
||||
pParse->zTail = &zSql[i];
|
||||
|
||||
+4
-4
@@ -270,7 +270,7 @@ static void applyNumericAffinity(Mem *pRec, int bTryForInt){
|
||||
** SQLITE_AFF_TEXT:
|
||||
** Convert pRec to a text representation.
|
||||
**
|
||||
** SQLITE_AFF_NONE:
|
||||
** SQLITE_AFF_BLOB:
|
||||
** No-op. pRec is unchanged.
|
||||
*/
|
||||
static void applyAffinity(
|
||||
@@ -1780,9 +1780,9 @@ case OP_RealAffinity: { /* in1 */
|
||||
** A NULL value is not changed by this routine. It remains NULL.
|
||||
*/
|
||||
case OP_Cast: { /* in1 */
|
||||
assert( pOp->p2>=SQLITE_AFF_NONE && pOp->p2<=SQLITE_AFF_REAL );
|
||||
assert( pOp->p2>=SQLITE_AFF_BLOB && pOp->p2<=SQLITE_AFF_REAL );
|
||||
testcase( pOp->p2==SQLITE_AFF_TEXT );
|
||||
testcase( pOp->p2==SQLITE_AFF_NONE );
|
||||
testcase( pOp->p2==SQLITE_AFF_BLOB );
|
||||
testcase( pOp->p2==SQLITE_AFF_NUMERIC );
|
||||
testcase( pOp->p2==SQLITE_AFF_INTEGER );
|
||||
testcase( pOp->p2==SQLITE_AFF_REAL );
|
||||
@@ -2593,7 +2593,7 @@ case OP_Affinity: {
|
||||
** The mapping from character to affinity is given by the SQLITE_AFF_
|
||||
** macros defined in sqliteInt.h.
|
||||
**
|
||||
** If P4 is NULL then all index fields have the affinity NONE.
|
||||
** If P4 is NULL then all index fields have the affinity BLOB.
|
||||
*/
|
||||
case OP_MakeRecord: {
|
||||
u8 *zNewRecord; /* A buffer to hold the data for the new record */
|
||||
|
||||
+6
-2
@@ -3651,7 +3651,7 @@ int sqlite3VdbeRecordCompareWithSkip(
|
||||
if( pRhs->flags & MEM_Int ){
|
||||
serial_type = aKey1[idx1];
|
||||
testcase( serial_type==12 );
|
||||
if( serial_type>=12 ){
|
||||
if( serial_type>=10 ){
|
||||
rc = +1;
|
||||
}else if( serial_type==0 ){
|
||||
rc = -1;
|
||||
@@ -3677,7 +3677,11 @@ int sqlite3VdbeRecordCompareWithSkip(
|
||||
/* RHS is real */
|
||||
else if( pRhs->flags & MEM_Real ){
|
||||
serial_type = aKey1[idx1];
|
||||
if( serial_type>=12 ){
|
||||
if( serial_type>=10 ){
|
||||
/* Serial types 12 or greater are strings and blobs (greater than
|
||||
** numbers). Types 10 and 11 are currently "reserved for future
|
||||
** use", so it doesn't really matter what the results of comparing
|
||||
** them to numberic values are. */
|
||||
rc = +1;
|
||||
}else if( serial_type==0 ){
|
||||
rc = -1;
|
||||
|
||||
+2
-2
@@ -588,7 +588,7 @@ int sqlite3VdbeMemNumerify(Mem *pMem){
|
||||
void sqlite3VdbeMemCast(Mem *pMem, u8 aff, u8 encoding){
|
||||
if( pMem->flags & MEM_Null ) return;
|
||||
switch( aff ){
|
||||
case SQLITE_AFF_NONE: { /* Really a cast to BLOB */
|
||||
case SQLITE_AFF_BLOB: { /* Really a cast to BLOB */
|
||||
if( (pMem->flags & MEM_Blob)==0 ){
|
||||
sqlite3ValueApplyAffinity(pMem, SQLITE_AFF_TEXT, encoding);
|
||||
assert( pMem->flags & MEM_Str || pMem->db->mallocFailed );
|
||||
@@ -1311,7 +1311,7 @@ static int valueFromExpr(
|
||||
if( zVal==0 ) goto no_mem;
|
||||
sqlite3ValueSetStr(pVal, -1, zVal, SQLITE_UTF8, SQLITE_DYNAMIC);
|
||||
}
|
||||
if( (op==TK_INTEGER || op==TK_FLOAT ) && affinity==SQLITE_AFF_NONE ){
|
||||
if( (op==TK_INTEGER || op==TK_FLOAT ) && affinity==SQLITE_AFF_BLOB ){
|
||||
sqlite3ValueApplyAffinity(pVal, SQLITE_AFF_NUMERIC, SQLITE_UTF8);
|
||||
}else{
|
||||
sqlite3ValueApplyAffinity(pVal, affinity, SQLITE_UTF8);
|
||||
|
||||
+75
-44
@@ -680,7 +680,7 @@ static int isLikeOrGlob(
|
||||
if( op==TK_VARIABLE ){
|
||||
Vdbe *pReprepare = pParse->pReprepare;
|
||||
int iCol = pRight->iColumn;
|
||||
pVal = sqlite3VdbeGetBoundValue(pReprepare, iCol, SQLITE_AFF_NONE);
|
||||
pVal = sqlite3VdbeGetBoundValue(pReprepare, iCol, SQLITE_AFF_BLOB);
|
||||
if( pVal && sqlite3_value_type(pVal)==SQLITE_TEXT ){
|
||||
z = (char *)sqlite3_value_text(pVal);
|
||||
}
|
||||
@@ -1660,6 +1660,36 @@ static LogEst estLog(LogEst N){
|
||||
return N<=10 ? 0 : sqlite3LogEst(N) - 33;
|
||||
}
|
||||
|
||||
/*
|
||||
** Convert OP_Column opcodes to OP_Copy in previously generated code.
|
||||
**
|
||||
** This routine runs over generated VDBE code and translates OP_Column
|
||||
** opcodes into OP_Copy, and OP_Rowid into OP_Null, when the table is being
|
||||
** accessed via co-routine instead of via table lookup.
|
||||
*/
|
||||
static void translateColumnToCopy(
|
||||
Vdbe *v, /* The VDBE containing code to translate */
|
||||
int iStart, /* Translate from this opcode to the end */
|
||||
int iTabCur, /* OP_Column/OP_Rowid references to this table */
|
||||
int iRegister /* The first column is in this register */
|
||||
){
|
||||
VdbeOp *pOp = sqlite3VdbeGetOp(v, iStart);
|
||||
int iEnd = sqlite3VdbeCurrentAddr(v);
|
||||
for(; iStart<iEnd; iStart++, pOp++){
|
||||
if( pOp->p1!=iTabCur ) continue;
|
||||
if( pOp->opcode==OP_Column ){
|
||||
pOp->opcode = OP_Copy;
|
||||
pOp->p1 = pOp->p2 + iRegister;
|
||||
pOp->p2 = pOp->p3;
|
||||
pOp->p3 = 0;
|
||||
}else if( pOp->opcode==OP_Rowid ){
|
||||
pOp->opcode = OP_Null;
|
||||
pOp->p1 = 0;
|
||||
pOp->p3 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Two routines for printing the content of an sqlite3_index_info
|
||||
** structure. Used for testing and debugging only. If neither
|
||||
@@ -1762,6 +1792,7 @@ static void constructAutomaticIndex(
|
||||
u8 sentWarning = 0; /* True if a warnning has been issued */
|
||||
Expr *pPartial = 0; /* Partial Index Expression */
|
||||
int iContinue = 0; /* Jump here to skip excluded rows */
|
||||
struct SrcList_item *pTabItem; /* FROM clause term being indexed */
|
||||
|
||||
/* Generate code to skip over the creation and initialization of the
|
||||
** transient index on 2nd and subsequent iterations of the loop. */
|
||||
@@ -1887,7 +1918,16 @@ static void constructAutomaticIndex(
|
||||
|
||||
/* Fill the automatic index with content */
|
||||
sqlite3ExprCachePush(pParse);
|
||||
addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, pLevel->iTabCur); VdbeCoverage(v);
|
||||
pTabItem = &pWC->pWInfo->pTabList->a[pLevel->iFrom];
|
||||
if( pTabItem->viaCoroutine ){
|
||||
int regYield = pTabItem->regReturn;
|
||||
sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pTabItem->addrFillSub);
|
||||
addrTop = sqlite3VdbeAddOp1(v, OP_Yield, regYield);
|
||||
VdbeCoverage(v);
|
||||
VdbeComment((v, "next row of \"%s\"", pTabItem->pTab->zName));
|
||||
}else{
|
||||
addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, pLevel->iTabCur); VdbeCoverage(v);
|
||||
}
|
||||
if( pPartial ){
|
||||
iContinue = sqlite3VdbeMakeLabel(v);
|
||||
sqlite3ExprIfFalse(pParse, pPartial, iContinue, SQLITE_JUMPIFNULL);
|
||||
@@ -1898,7 +1938,13 @@ static void constructAutomaticIndex(
|
||||
sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord);
|
||||
sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
|
||||
if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue);
|
||||
sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v);
|
||||
if( pTabItem->viaCoroutine ){
|
||||
translateColumnToCopy(v, addrTop, pLevel->iTabCur, pTabItem->regResult);
|
||||
sqlite3VdbeAddOp2(v, OP_Goto, 0, addrTop);
|
||||
pTabItem->viaCoroutine = 0;
|
||||
}else{
|
||||
sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v);
|
||||
}
|
||||
sqlite3VdbeChangeP5(v, SQLITE_STMTSTATUS_AUTOINDEX);
|
||||
sqlite3VdbeJumpHere(v, addrTop);
|
||||
sqlite3ReleaseTempReg(pParse, regRecord);
|
||||
@@ -2778,9 +2824,9 @@ static void disableTerm(WhereLevel *pLevel, WhereTerm *pTerm){
|
||||
** Code an OP_Affinity opcode to apply the column affinity string zAff
|
||||
** to the n registers starting at base.
|
||||
**
|
||||
** As an optimization, SQLITE_AFF_NONE entries (which are no-ops) at the
|
||||
** As an optimization, SQLITE_AFF_BLOB entries (which are no-ops) at the
|
||||
** beginning and end of zAff are ignored. If all entries in zAff are
|
||||
** SQLITE_AFF_NONE, then no code gets generated.
|
||||
** SQLITE_AFF_BLOB, then no code gets generated.
|
||||
**
|
||||
** This routine makes its own copy of zAff so that the caller is free
|
||||
** to modify zAff after this routine returns.
|
||||
@@ -2793,15 +2839,15 @@ static void codeApplyAffinity(Parse *pParse, int base, int n, char *zAff){
|
||||
}
|
||||
assert( v!=0 );
|
||||
|
||||
/* Adjust base and n to skip over SQLITE_AFF_NONE entries at the beginning
|
||||
/* Adjust base and n to skip over SQLITE_AFF_BLOB entries at the beginning
|
||||
** and end of the affinity string.
|
||||
*/
|
||||
while( n>0 && zAff[0]==SQLITE_AFF_NONE ){
|
||||
while( n>0 && zAff[0]==SQLITE_AFF_BLOB ){
|
||||
n--;
|
||||
base++;
|
||||
zAff++;
|
||||
}
|
||||
while( n>1 && zAff[n-1]==SQLITE_AFF_NONE ){
|
||||
while( n>1 && zAff[n-1]==SQLITE_AFF_BLOB ){
|
||||
n--;
|
||||
}
|
||||
|
||||
@@ -2931,17 +2977,17 @@ static int codeEqualityTerm(
|
||||
** Before returning, *pzAff is set to point to a buffer containing a
|
||||
** copy of the column affinity string of the index allocated using
|
||||
** sqlite3DbMalloc(). Except, entries in the copy of the string associated
|
||||
** with equality constraints that use NONE affinity are set to
|
||||
** SQLITE_AFF_NONE. This is to deal with SQL such as the following:
|
||||
** with equality constraints that use BLOB or NONE affinity are set to
|
||||
** SQLITE_AFF_BLOB. This is to deal with SQL such as the following:
|
||||
**
|
||||
** CREATE TABLE t1(a TEXT PRIMARY KEY, b);
|
||||
** SELECT ... FROM t1 AS t2, t1 WHERE t1.a = t2.b;
|
||||
**
|
||||
** In the example above, the index on t1(a) has TEXT affinity. But since
|
||||
** the right hand side of the equality constraint (t2.b) has NONE affinity,
|
||||
** the right hand side of the equality constraint (t2.b) has BLOB/NONE affinity,
|
||||
** no conversion should be attempted before using a t2.b value as part of
|
||||
** a key to search the index. Hence the first byte in the returned affinity
|
||||
** string in this example would be set to SQLITE_AFF_NONE.
|
||||
** string in this example would be set to SQLITE_AFF_BLOB.
|
||||
*/
|
||||
static int codeAllEqualityTerms(
|
||||
Parse *pParse, /* Parsing context */
|
||||
@@ -3028,11 +3074,11 @@ static int codeAllEqualityTerms(
|
||||
VdbeCoverage(v);
|
||||
}
|
||||
if( zAff ){
|
||||
if( sqlite3CompareAffinity(pRight, zAff[j])==SQLITE_AFF_NONE ){
|
||||
zAff[j] = SQLITE_AFF_NONE;
|
||||
if( sqlite3CompareAffinity(pRight, zAff[j])==SQLITE_AFF_BLOB ){
|
||||
zAff[j] = SQLITE_AFF_BLOB;
|
||||
}
|
||||
if( sqlite3ExprNeedsNoAffinityChange(pRight, zAff[j]) ){
|
||||
zAff[j] = SQLITE_AFF_NONE;
|
||||
zAff[j] = SQLITE_AFF_BLOB;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3679,14 +3725,14 @@ static Bitmask codeOneLoopStart(
|
||||
VdbeCoverage(v);
|
||||
}
|
||||
if( zStartAff ){
|
||||
if( sqlite3CompareAffinity(pRight, zStartAff[nEq])==SQLITE_AFF_NONE){
|
||||
if( sqlite3CompareAffinity(pRight, zStartAff[nEq])==SQLITE_AFF_BLOB){
|
||||
/* Since the comparison is to be performed with no conversions
|
||||
** applied to the operands, set the affinity to apply to pRight to
|
||||
** SQLITE_AFF_NONE. */
|
||||
zStartAff[nEq] = SQLITE_AFF_NONE;
|
||||
** SQLITE_AFF_BLOB. */
|
||||
zStartAff[nEq] = SQLITE_AFF_BLOB;
|
||||
}
|
||||
if( sqlite3ExprNeedsNoAffinityChange(pRight, zStartAff[nEq]) ){
|
||||
zStartAff[nEq] = SQLITE_AFF_NONE;
|
||||
zStartAff[nEq] = SQLITE_AFF_BLOB;
|
||||
}
|
||||
}
|
||||
nConstraint++;
|
||||
@@ -3724,7 +3770,7 @@ static Bitmask codeOneLoopStart(
|
||||
sqlite3VdbeAddOp2(v, OP_IsNull, regBase+nEq, addrNxt);
|
||||
VdbeCoverage(v);
|
||||
}
|
||||
if( sqlite3CompareAffinity(pRight, cEndAff)!=SQLITE_AFF_NONE
|
||||
if( sqlite3CompareAffinity(pRight, cEndAff)!=SQLITE_AFF_BLOB
|
||||
&& !sqlite3ExprNeedsNoAffinityChange(pRight, cEndAff)
|
||||
){
|
||||
codeApplyAffinity(pParse, regBase+nEq, 1, &cEndAff);
|
||||
@@ -5174,15 +5220,14 @@ static int whereLoopAddBtree(
|
||||
|
||||
#ifndef SQLITE_OMIT_AUTOMATIC_INDEX
|
||||
/* Automatic indexes */
|
||||
if( !pBuilder->pOrSet
|
||||
if( !pBuilder->pOrSet /* Not part of an OR optimization */
|
||||
&& (pWInfo->wctrlFlags & WHERE_NO_AUTOINDEX)==0
|
||||
&& (pWInfo->pParse->db->flags & SQLITE_AutoIndex)!=0
|
||||
&& pSrc->pIndex==0
|
||||
&& !pSrc->viaCoroutine
|
||||
&& !pSrc->notIndexed
|
||||
&& HasRowid(pTab)
|
||||
&& !pSrc->isCorrelated
|
||||
&& !pSrc->isRecursive
|
||||
&& pSrc->pIndex==0 /* Has no INDEXED BY clause */
|
||||
&& !pSrc->notIndexed /* Has no NOT INDEXED clause */
|
||||
&& HasRowid(pTab) /* Is not a WITHOUT ROWID table. (FIXME: Why not?) */
|
||||
&& !pSrc->isCorrelated /* Not a correlated subquery */
|
||||
&& !pSrc->isRecursive /* Not a recursive common table expression. */
|
||||
){
|
||||
/* Generate auto-index WhereLoops */
|
||||
WhereTerm *pTerm;
|
||||
@@ -7017,26 +7062,12 @@ void sqlite3WhereEnd(WhereInfo *pWInfo){
|
||||
pLoop = pLevel->pWLoop;
|
||||
|
||||
/* For a co-routine, change all OP_Column references to the table of
|
||||
** the co-routine into OP_SCopy of result contained in a register.
|
||||
** the co-routine into OP_Copy of result contained in a register.
|
||||
** OP_Rowid becomes OP_Null.
|
||||
*/
|
||||
if( pTabItem->viaCoroutine && !db->mallocFailed ){
|
||||
last = sqlite3VdbeCurrentAddr(v);
|
||||
k = pLevel->addrBody;
|
||||
pOp = sqlite3VdbeGetOp(v, k);
|
||||
for(; k<last; k++, pOp++){
|
||||
if( pOp->p1!=pLevel->iTabCur ) continue;
|
||||
if( pOp->opcode==OP_Column ){
|
||||
pOp->opcode = OP_Copy;
|
||||
pOp->p1 = pOp->p2 + pTabItem->regResult;
|
||||
pOp->p2 = pOp->p3;
|
||||
pOp->p3 = 0;
|
||||
}else if( pOp->opcode==OP_Rowid ){
|
||||
pOp->opcode = OP_Null;
|
||||
pOp->p1 = 0;
|
||||
pOp->p3 = 0;
|
||||
}
|
||||
}
|
||||
translateColumnToCopy(v, pLevel->addrBody, pLevel->iTabCur,
|
||||
pTabItem->regResult);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
# 2015-06-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 implements regression tests for SQLite library. The
|
||||
# focus of this file is type affinity and the affinity() built-in
|
||||
# function.
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
set ::testprefix affinity1
|
||||
|
||||
do_execsql_test 100 {
|
||||
CREATE TABLE t1(
|
||||
c01 INT,
|
||||
c02 INTEGER,
|
||||
c03 TINYINT,
|
||||
c04 SMALLINT,
|
||||
c05 MEDIUMINT,
|
||||
c06 BIGINT,
|
||||
c07 UNSIGNED BIG INT,
|
||||
c08 INT2,
|
||||
c09 INT4,
|
||||
c10 CHARACTER(20),
|
||||
c11 VARCHAR(255),
|
||||
c12 VARYING CHARACTER(255),
|
||||
c13 NCHAR(55),
|
||||
c14 NATIVE CHARACTER(70),
|
||||
c15 NVARCHAR(100),
|
||||
c16 TEXT,
|
||||
c17 CLOB,
|
||||
c20 BLOB,
|
||||
c21,
|
||||
c30 REAL,
|
||||
c31 DOUBLE,
|
||||
c32 DOUBLE PRECISION,
|
||||
c33 FLOAT,
|
||||
c40 NUMERIC,
|
||||
c41 DECIMAL(10,5),
|
||||
c42 BOOLEAN,
|
||||
c43 DATE,
|
||||
c44 DATETIME,
|
||||
c50 FLOATING POINT,
|
||||
c60 STRING
|
||||
);
|
||||
INSERT INTO t1 DEFAULT VALUES;
|
||||
} {}
|
||||
do_execsql_test 201 {
|
||||
SELECT affinity(c01), affinity(c01+1), affinity(+c01) FROM t1;
|
||||
} {INTEGER {} {}}
|
||||
do_execsql_test 202 {SELECT affinity(c02) FROM t1} {INTEGER}
|
||||
do_execsql_test 203 {SELECT affinity(c03) FROM t1} {INTEGER}
|
||||
do_execsql_test 204 {SELECT affinity(c04) FROM t1} {INTEGER}
|
||||
do_execsql_test 205 {SELECT affinity(c05) FROM t1} {INTEGER}
|
||||
do_execsql_test 206 {SELECT affinity(c06) FROM t1} {INTEGER}
|
||||
do_execsql_test 207 {SELECT affinity(c07) FROM t1} {INTEGER}
|
||||
do_execsql_test 208 {SELECT affinity(c08) FROM t1} {INTEGER}
|
||||
do_execsql_test 209 {SELECT affinity(c09) FROM t1} {INTEGER}
|
||||
do_execsql_test 210 {SELECT affinity(c10) FROM t1} {TEXT}
|
||||
do_execsql_test 211 {SELECT affinity(c11) FROM t1} {TEXT}
|
||||
do_execsql_test 212 {SELECT affinity(c12) FROM t1} {TEXT}
|
||||
do_execsql_test 213 {SELECT affinity(c13) FROM t1} {TEXT}
|
||||
do_execsql_test 214 {SELECT affinity(c14) FROM t1} {TEXT}
|
||||
do_execsql_test 215 {SELECT affinity(c15) FROM t1} {TEXT}
|
||||
do_execsql_test 216 {SELECT affinity(c16) FROM t1} {TEXT}
|
||||
do_execsql_test 220 {SELECT affinity(c20) FROM t1} {BLOB}
|
||||
do_execsql_test 221 {SELECT affinity(c21) FROM t1} {BLOB}
|
||||
do_execsql_test 230 {SELECT affinity(c30) FROM t1} {REAL}
|
||||
do_execsql_test 231 {SELECT affinity(c31) FROM t1} {REAL}
|
||||
do_execsql_test 232 {SELECT affinity(c32) FROM t1} {REAL}
|
||||
do_execsql_test 233 {SELECT affinity(c33) FROM t1} {REAL}
|
||||
do_execsql_test 240 {SELECT affinity(c40) FROM t1} {NUMERIC}
|
||||
do_execsql_test 241 {SELECT affinity(c41) FROM t1} {NUMERIC}
|
||||
do_execsql_test 242 {SELECT affinity(c42) FROM t1} {NUMERIC}
|
||||
do_execsql_test 243 {SELECT affinity(c43) FROM t1} {NUMERIC}
|
||||
do_execsql_test 244 {SELECT affinity(c44) FROM t1} {NUMERIC}
|
||||
do_execsql_test 250 {SELECT affinity(c50) FROM t1} {INTEGER}
|
||||
do_execsql_test 260 {SELECT affinity(c60) FROM t1} {NUMERIC}
|
||||
|
||||
|
||||
finish_test
|
||||
@@ -0,0 +1,108 @@
|
||||
# 2014-10-24
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#*************************************************************************
|
||||
#
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this script is testing automatic index creation logic,
|
||||
# and specifically ensuring that automatic indexes can be used with
|
||||
# co-routine subqueries.
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
|
||||
# Schema is from the Debian security database
|
||||
#
|
||||
do_execsql_test autoindex5-1.0 {
|
||||
CREATE TABLE source_package_status
|
||||
(bug_name TEXT NOT NULL,
|
||||
package INTEGER NOT NULL,
|
||||
vulnerable INTEGER NOT NULL,
|
||||
urgency TEXT NOT NULL,
|
||||
PRIMARY KEY (bug_name, package));
|
||||
CREATE INDEX source_package_status_package
|
||||
ON source_package_status(package);
|
||||
|
||||
CREATE TABLE source_packages
|
||||
(name TEXT NOT NULL,
|
||||
release TEXT NOT NULL,
|
||||
subrelease TEXT NOT NULL,
|
||||
archive TEXT NOT NULL,
|
||||
version TEXT NOT NULL,
|
||||
version_id INTEGER NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (name, release, subrelease, archive));
|
||||
|
||||
CREATE TABLE bugs
|
||||
(name TEXT NOT NULL PRIMARY KEY,
|
||||
cve_status TEXT NOT NULL
|
||||
CHECK (cve_status IN
|
||||
('', 'CANDIDATE', 'ASSIGNED', 'RESERVED', 'REJECTED')),
|
||||
not_for_us INTEGER NOT NULL CHECK (not_for_us IN (0, 1)),
|
||||
description TEXT NOT NULL,
|
||||
release_date TEXT NOT NULL,
|
||||
source_file TEXT NOT NULL,
|
||||
source_line INTEGER NOT NULL);
|
||||
|
||||
CREATE TABLE package_notes
|
||||
(id INTEGER NOT NULL PRIMARY KEY,
|
||||
bug_name TEXT NOT NULL,
|
||||
package TEXT NOT NULL,
|
||||
fixed_version TEXT
|
||||
CHECK (fixed_version IS NULL OR fixed_version <> ''),
|
||||
fixed_version_id INTEGER NOT NULL DEFAULT 0,
|
||||
release TEXT NOT NULL,
|
||||
package_kind TEXT NOT NULL DEFAULT 'unknown',
|
||||
urgency TEXT NOT NULL,
|
||||
bug_origin TEXT NOT NULL DEFAULT '');
|
||||
CREATE INDEX package_notes_package
|
||||
ON package_notes(package);
|
||||
CREATE UNIQUE INDEX package_notes_bug
|
||||
ON package_notes(bug_name, package, release);
|
||||
|
||||
CREATE TABLE debian_bugs
|
||||
(bug INTEGER NOT NULL,
|
||||
note INTEGER NOT NULL,
|
||||
PRIMARY KEY (bug, note));
|
||||
|
||||
|
||||
CREATE VIEW debian_cve AS
|
||||
SELECT DISTINCT debian_bugs.bug, st.bug_name
|
||||
FROM package_notes, debian_bugs, source_package_status AS st
|
||||
WHERE package_notes.bug_name = st.bug_name
|
||||
AND debian_bugs.note = package_notes.id
|
||||
ORDER BY debian_bugs.bug;
|
||||
} {}
|
||||
|
||||
# The following query should use an automatic index for the view
|
||||
# in FROM clause of the subquery of the second result column.
|
||||
#
|
||||
do_execsql_test autoindex5-1.1 {
|
||||
EXPLAIN QUERY PLAN
|
||||
SELECT
|
||||
st.bug_name,
|
||||
(SELECT ALL debian_cve.bug FROM debian_cve
|
||||
WHERE debian_cve.bug_name = st.bug_name
|
||||
ORDER BY debian_cve.bug),
|
||||
sp.release
|
||||
FROM
|
||||
source_package_status AS st,
|
||||
source_packages AS sp,
|
||||
bugs
|
||||
WHERE
|
||||
sp.rowid = st.package
|
||||
AND st.bug_name = bugs.name
|
||||
AND ( st.bug_name LIKE 'CVE-%' OR st.bug_name LIKE 'TEMP-%' )
|
||||
AND ( sp.release = 'sid' OR sp.release = 'stretch' OR sp.release = 'jessie'
|
||||
OR sp.release = 'wheezy' OR sp.release = 'squeeze' )
|
||||
ORDER BY sp.name, st.bug_name, sp.release, sp.subrelease;
|
||||
} {/SEARCH SUBQUERY 2 USING AUTOMATIC COVERING INDEX .bug_name=/}
|
||||
|
||||
|
||||
finish_test
|
||||
@@ -596,6 +596,7 @@ static void showHelp(void){
|
||||
"Read databases and SQL scripts from SOURCE-DB and execute each script against\n"
|
||||
"each database, checking for crashes and memory leaks.\n"
|
||||
"Options:\n"
|
||||
" --cell-size-check Set the PRAGMA cell_size_check=ON\n"
|
||||
" --dbid N Use only the database where dbid=N\n"
|
||||
" --help Show this help text\n"
|
||||
" -q Reduced output\n"
|
||||
@@ -634,6 +635,7 @@ int main(int argc, char **argv){
|
||||
int nTest = 0; /* Total number of tests performed */
|
||||
char *zDbName = ""; /* Appreviated name of a source database */
|
||||
const char *zFailCode = 0; /* Value of the TEST_FAILURE environment variable */
|
||||
int cellSzCkFlag = 0; /* --cell-size-check */
|
||||
|
||||
iBegin = timeOfDay();
|
||||
g.zArgv0 = argv[0];
|
||||
@@ -643,6 +645,9 @@ int main(int argc, char **argv){
|
||||
if( z[0]=='-' ){
|
||||
z++;
|
||||
if( z[0]=='-' ) z++;
|
||||
if( strcmp(z,"cell-size-check")==0 ){
|
||||
cellSzCkFlag = 1;
|
||||
}else
|
||||
if( strcmp(z,"dbid")==0 ){
|
||||
if( i>=argc-1 ) fatalError("missing arguments on %s", argv[i]);
|
||||
onlyDbid = atoi(argv[++i]);
|
||||
@@ -825,6 +830,7 @@ int main(int argc, char **argv){
|
||||
}
|
||||
rc = sqlite3_open_v2("main.db", &db, openFlags, zVfs);
|
||||
if( rc ) fatalError("cannot open inmem database");
|
||||
if( cellSzCkFlag ) runSql(db, "PRAGMA cell_size_check=ON", runFlags);
|
||||
runSql(db, (char*)pSql->a, runFlags);
|
||||
sqlite3_close(db);
|
||||
if( sqlite3_memory_used()>0 ) fatalError("memory leak");
|
||||
@@ -869,5 +875,6 @@ int main(int argc, char **argv){
|
||||
nTest, (int)(iElapse/1000), (int)(iElapse%1000),
|
||||
sqlite3_libversion(), sqlite3_sourceid());
|
||||
}
|
||||
free(azSrcDb);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -705,7 +705,7 @@ test_suite "inmemory_journal" -description {
|
||||
zerodamage.test
|
||||
|
||||
# WAL mode is different.
|
||||
wal* tkt-2d1a5c67d.test backcompat.test e_wal*
|
||||
wal* tkt-2d1a5c67d.test backcompat.test e_wal* rowallock.test
|
||||
}]
|
||||
|
||||
ifcapable mem3 {
|
||||
|
||||
@@ -225,7 +225,7 @@ array set ::Platforms [strip_comments {
|
||||
"No-lookaside" test
|
||||
"Devkit" test
|
||||
"Sanitize" {QUICKTEST_OMIT=func4.test,nan.test test}
|
||||
"Fast-One" fuzzoomtest
|
||||
"Fast-One" fuzztest
|
||||
"Valgrind" valgrindtest
|
||||
"Default" "threadtest fulltest"
|
||||
"Device-One" fulltest
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
|
||||
# 2015-05-28
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing locks on read-only WAL-mode databases.
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
source $testdir/lock_common.tcl
|
||||
set testprefix rowallock
|
||||
|
||||
do_multiclient_test tn {
|
||||
code2 { db2 close }
|
||||
code3 { db3 close }
|
||||
|
||||
do_execsql_test 1.$tn.1 {
|
||||
PRAGMA page_size = 4096;
|
||||
CREATE TABLE t1(a, b);
|
||||
CREATE TABLE t2(a, b);
|
||||
INSERT INTO t1 VALUES(1, 2), (3, 4);
|
||||
PRAGMA journal_mode = wal;
|
||||
} {wal}
|
||||
|
||||
code1 {
|
||||
db close
|
||||
sqlite3 db test.db -readonly 1
|
||||
}
|
||||
|
||||
do_execsql_test 1.$tn.2 {
|
||||
PRAGMA mmap_size = 1000000;
|
||||
} {1000000}
|
||||
do_execsql_test 1.$tn.2.1 {
|
||||
SELECT * FROM t1;
|
||||
} {1 2 3 4}
|
||||
|
||||
do_catchsql_test 1.$tn.3 {
|
||||
INSERT INTO t1 VALUES(5, 6);
|
||||
} {1 {attempt to write a readonly database}}
|
||||
|
||||
do_test 1.$tn.4 {
|
||||
code2 { sqlite3 db2 test.db }
|
||||
sql2 { INSERT INTO t1 VALUES(5, 6); }
|
||||
code2 { db2 close }
|
||||
file exists test.db-wal
|
||||
} {1}
|
||||
|
||||
do_test 1.$tn.5 {
|
||||
sql1 { SELECT * FROM t2 }
|
||||
code1 { db close }
|
||||
file exists test.db-wal
|
||||
} {1}
|
||||
}
|
||||
|
||||
finish_test
|
||||
@@ -849,4 +849,13 @@ do_execsql_test 14.1 {
|
||||
WITH x AS (SELECT * FROM t) SELECT 0 EXCEPT SELECT 0 ORDER BY 1 COLLATE binary;
|
||||
} {}
|
||||
|
||||
# 2015-05-27: Do not allow rowid usage within a CTE
|
||||
#
|
||||
do_catchsql_test 15.1 {
|
||||
WITH RECURSIVE
|
||||
d(x) AS (VALUES(1) UNION ALL SELECT rowid+1 FROM d WHERE rowid<10)
|
||||
SELECT x FROM d;
|
||||
} {1 {no such column: rowid}}
|
||||
|
||||
|
||||
finish_test
|
||||
|
||||
@@ -308,6 +308,25 @@ do_execsql_test 6.1 {
|
||||
ok t48 sqlite_autoindex_t48_2
|
||||
}
|
||||
|
||||
# 2015-05-28: CHECK constraints can refer to the rowid in a
|
||||
# rowid table, but not in a WITHOUT ROWID table.
|
||||
#
|
||||
do_execsql_test 7.1 {
|
||||
CREATE TABLE t70a(
|
||||
a INT CHECK( rowid!=33 ),
|
||||
b TEXT PRIMARY KEY
|
||||
);
|
||||
INSERT INTO t70a(a,b) VALUES(99,'hello');
|
||||
} {}
|
||||
do_catchsql_test 7.2 {
|
||||
INSERT INTO t70a(rowid,a,b) VALUES(33,99,'xyzzy');
|
||||
} {1 {CHECK constraint failed: t70a}}
|
||||
do_catchsql_test 7.3 {
|
||||
CREATE TABLE t70b(
|
||||
a INT CHECK( rowid!=33 ),
|
||||
b TEXT PRIMARY KEY
|
||||
) WITHOUT ROWID;
|
||||
} {1 {no such column: rowid}}
|
||||
|
||||
|
||||
finish_test
|
||||
|
||||
@@ -136,6 +136,10 @@ set pragma_def {
|
||||
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
|
||||
IF: !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
|
||||
|
||||
NAME: cell_size_check
|
||||
TYPE: FLAG
|
||||
ARG: SQLITE_CellSizeCk
|
||||
|
||||
NAME: default_cache_size
|
||||
FLAG: NeedSchema
|
||||
IF: !defined(SQLITE_OMIT_PAGER_PRAGMAS) && !defined(SQLITE_OMIT_DEPRECATED)
|
||||
|
||||
Reference in New Issue
Block a user