1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Version 3.7.12.1

FossilOrigin-Name: d07b7b67d1b3bf65cfe8d96d45a7f1d387bea7ce
This commit is contained in:
drh
2012-05-22 13:01:39 +00:00
17 changed files with 2209 additions and 123 deletions

View File

@@ -1 +1 @@
3.7.12 3.7.12.1

18
configure vendored
View File

@@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.62 for sqlite 3.7.12. # Generated by GNU Autoconf 2.62 for sqlite 3.7.12.1.
# #
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
@@ -743,8 +743,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package. # Identity of this package.
PACKAGE_NAME='sqlite' PACKAGE_NAME='sqlite'
PACKAGE_TARNAME='sqlite' PACKAGE_TARNAME='sqlite'
PACKAGE_VERSION='3.7.12' PACKAGE_VERSION='3.7.12.1'
PACKAGE_STRING='sqlite 3.7.12' PACKAGE_STRING='sqlite 3.7.12.1'
PACKAGE_BUGREPORT='' PACKAGE_BUGREPORT=''
# Factoring default headers for most tests. # Factoring default headers for most tests.
@@ -1485,7 +1485,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing. # 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. # This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF cat <<_ACEOF
\`configure' configures sqlite 3.7.12 to adapt to many kinds of systems. \`configure' configures sqlite 3.7.12.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1550,7 +1550,7 @@ fi
if test -n "$ac_init_help"; then if test -n "$ac_init_help"; then
case $ac_init_help in case $ac_init_help in
short | recursive ) echo "Configuration of sqlite 3.7.12:";; short | recursive ) echo "Configuration of sqlite 3.7.12.1:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
@@ -1666,7 +1666,7 @@ fi
test -n "$ac_init_help" && exit $ac_status test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then if $ac_init_version; then
cat <<\_ACEOF cat <<\_ACEOF
sqlite configure 3.7.12 sqlite configure 3.7.12.1
generated by GNU Autoconf 2.62 generated by GNU Autoconf 2.62
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1680,7 +1680,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
It was created by sqlite $as_me 3.7.12, which was It was created by sqlite $as_me 3.7.12.1, which was
generated by GNU Autoconf 2.62. Invocation command line was generated by GNU Autoconf 2.62. Invocation command line was
$ $0 $@ $ $0 $@
@@ -14032,7 +14032,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their # report actual input values of CONFIG_FILES etc. instead of their
# values after options handling. # values after options handling.
ac_log=" ac_log="
This file was extended by sqlite $as_me 3.7.12, which was This file was extended by sqlite $as_me 3.7.12.1, which was
generated by GNU Autoconf 2.62. Invocation command line was generated by GNU Autoconf 2.62. Invocation command line was
CONFIG_FILES = $CONFIG_FILES CONFIG_FILES = $CONFIG_FILES
@@ -14085,7 +14085,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\ ac_cs_version="\\
sqlite config.status 3.7.12 sqlite config.status 3.7.12.1
configured by $0, generated by GNU Autoconf 2.62, configured by $0, generated by GNU Autoconf 2.62,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"

View File

@@ -1,12 +1,12 @@
C Version\s3.7.12 C Version\s3.7.12.1
D 2012-05-14T01:58:36.626 D 2012-05-22T13:01:39.761
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 2f37e468503dbe79d35c9f6dffcf3fae1ae9ec20 F Makefile.in 2f37e468503dbe79d35c9f6dffcf3fae1ae9ec20
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F Makefile.msc efc373edae0f99cb3b04672ccefea8162664d40b F Makefile.msc efc373edae0f99cb3b04672ccefea8162664d40b
F Makefile.vxworks 3b7fe7a0571fdadc61363ebc1b23732d2d6363ca F Makefile.vxworks 3b7fe7a0571fdadc61363ebc1b23732d2d6363ca
F README cd04a36fbc7ea56932a4052d7d0b7f09f27c33d6 F README cd04a36fbc7ea56932a4052d7d0b7f09f27c33d6
F VERSION f9313d88cb77df8617059a88eb382291321ef6bc F VERSION 1e25ebddd2ed5811c10bdabe914cd46d2dc38af8
F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
F addopcodes.awk 17dc593f791f874d2c23a0f9360850ded0286531 F addopcodes.awk 17dc593f791f874d2c23a0f9360850ded0286531
F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2
@@ -15,7 +15,7 @@ F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2
F config.guess 226d9a188c6196f3033ffc651cbc9dcee1a42977 F config.guess 226d9a188c6196f3033ffc651cbc9dcee1a42977
F config.h.in 0921066a13130082764ab4ab6456f7b5bebe56de F config.h.in 0921066a13130082764ab4ab6456f7b5bebe56de
F config.sub 9ebe4c3b3dab6431ece34f16828b594fb420da55 F config.sub 9ebe4c3b3dab6431ece34f16828b594fb420da55
F configure eb9e5e7f4c1601b5acf674a724e1a778481d2835 x F configure faa04198b719ec9cb2166aa0b163558e9b8ddd77 x
F configure.ac 9ee886c21c095b3272137b1553ae416c8b8c8557 F configure.ac 9ee886c21c095b3272137b1553ae416c8b8c8557
F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad
F doc/lemon.html 3091574143dd3415669b6745843ff8d011d33549 F doc/lemon.html 3091574143dd3415669b6745843ff8d011d33549
@@ -133,13 +133,13 @@ F src/btmutex.c 976f45a12e37293e32cae0281b15a21d48a8aaa7
F src/btree.c df800f10896bc2ddaa1125c532d6e7a7b9efc532 F src/btree.c df800f10896bc2ddaa1125c532d6e7a7b9efc532
F src/btree.h 48a013f8964f12d944d90e4700df47b72dd6d923 F src/btree.h 48a013f8964f12d944d90e4700df47b72dd6d923
F src/btreeInt.h 38a639c0542c29fe8331a221c4aed0cb8686249e F src/btreeInt.h 38a639c0542c29fe8331a221c4aed0cb8686249e
F src/build.c 987c6933ea170e443dc6a79d52f8d2506206b12b F src/build.c 2bb2163bb1e69f59e9f36a9413079ead42fa1d2c
F src/callback.c 0cb4228cdcd827dcc5def98fb099edcc9142dbcd F src/callback.c 0cb4228cdcd827dcc5def98fb099edcc9142dbcd
F src/complete.c dc1d136c0feee03c2f7550bafc0d29075e36deac F src/complete.c dc1d136c0feee03c2f7550bafc0d29075e36deac
F src/ctime.c a9c26822515f81ec21588cbb482ca6724be02e33 F src/ctime.c a9c26822515f81ec21588cbb482ca6724be02e33
F src/date.c 067a81c9942c497aafd2c260e13add8a7d0c7dd4 F src/date.c 067a81c9942c497aafd2c260e13add8a7d0c7dd4
F src/delete.c 32041c65dc05a94914cf979fad7b82bc8a963fe9 F src/delete.c 32041c65dc05a94914cf979fad7b82bc8a963fe9
F src/expr.c eefabaa4a3dc67309a754eb0eab1a163ff4c2bf3 F src/expr.c 06a7733d19dc725dc46ba51afd9feadb4b85d991
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
F src/fkey.c 657212460bf5cfd3ae607d12ea62092844c227b5 F src/fkey.c 657212460bf5cfd3ae607d12ea62092844c227b5
F src/func.c c6b3c94320253a35bda43fb69cc292618e3285d6 F src/func.c c6b3c94320253a35bda43fb69cc292618e3285d6
@@ -153,7 +153,7 @@ F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f
F src/lempar.c 0ee69fca0be54cd93939df98d2aca4ca46f44416 F src/lempar.c 0ee69fca0be54cd93939df98d2aca4ca46f44416
F src/loadext.c f20382fbaeec832438a1ba7797bee3d3c8a6d51d F src/loadext.c f20382fbaeec832438a1ba7797bee3d3c8a6d51d
F src/main.c acab639c93295650b9ef056689e8092cfcf49f2a F src/main.c acab639c93295650b9ef056689e8092cfcf49f2a
F src/malloc.c 15afac5e59b6584efe072e9933aefb4230e74f97 F src/malloc.c fe085aa851b666b7c375c1ff957643dc20a04bf6
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c b3677415e69603d6a0e7c5410a1b3731d55beda1 F src/mem1.c b3677415e69603d6a0e7c5410a1b3731d55beda1
F src/mem2.c e307323e86b5da1853d7111b68fd6b84ad6f09cf F src/mem2.c e307323e86b5da1853d7111b68fd6b84ad6f09cf
@@ -180,16 +180,16 @@ F src/pcache.c f8043b433a57aba85384a531e3937a804432a346
F src/pcache.h 1b5dcc3dc8103d03e625b177023ee67764fa6b7c F src/pcache.h 1b5dcc3dc8103d03e625b177023ee67764fa6b7c
F src/pcache1.c b30b1c35908346ecc43d8d9d17f2ddf6817f8f60 F src/pcache1.c b30b1c35908346ecc43d8d9d17f2ddf6817f8f60
F src/pragma.c e708b3bb5704605816f617e0b1d63a5488060715 F src/pragma.c e708b3bb5704605816f617e0b1d63a5488060715
F src/prepare.c ec4989f7f480544bdc4192fe663470d2a2d7d61e F src/prepare.c 9a00a9612ebf80203fbb41f8a29ab8cb27a05f40
F src/printf.c 7ffb4ebb8b341f67e049695ba031da717b3d2699 F src/printf.c 7ffb4ebb8b341f67e049695ba031da717b3d2699
F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50 F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50
F src/resolve.c 748e75299faff345f34f0e5bd02a2bac8aa69fcd F src/resolve.c b3c70ab28cac60de33684c9aa9e5138dcf71d6dd
F src/rowset.c f6a49f3e9579428024662f6e2931832511f831a1 F src/rowset.c f6a49f3e9579428024662f6e2931832511f831a1
F src/select.c d7b9018b7dd2e821183d69477ab55c39b8272335 F src/select.c f6c4833c4d8e94714761d99013d74f381e084f1d
F src/shell.c 04399b2f9942bd02ed5ffee3b84bcdb39c52a1e6 F src/shell.c c16f72e34f611f060546709564c121a67cb2b31b
F src/sqlite.h.in e8b2634aa58853522d559e0291dd3e9ab9e622b2 F src/sqlite.h.in e8b2634aa58853522d559e0291dd3e9ab9e622b2
F src/sqlite3ext.h 6904f4aadf976f95241311fbffb00823075d9477 F src/sqlite3ext.h 6904f4aadf976f95241311fbffb00823075d9477
F src/sqliteInt.h 572c5e6aca50256bdbc34919ece5f660dabf25cc F src/sqliteInt.h d13f48a1067fc637f86f77ee6b4ad9f98c7c10c6
F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
F src/status.c 35939e7e03abf1b7577ce311f48f682c40de3208 F src/status.c 35939e7e03abf1b7577ce311f48f682c40de3208
F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
@@ -225,7 +225,7 @@ F src/test_mutex.c a6bd7b9cf6e19d989e31392b06ac8d189f0d573e
F src/test_onefile.c 0396f220561f3b4eedc450cef26d40c593c69a25 F src/test_onefile.c 0396f220561f3b4eedc450cef26d40c593c69a25
F src/test_osinst.c 90a845c8183013d80eccb1f29e8805608516edba F src/test_osinst.c 90a845c8183013d80eccb1f29e8805608516edba
F src/test_pcache.c a5cd24730cb43c5b18629043314548c9169abb00 F src/test_pcache.c a5cd24730cb43c5b18629043314548c9169abb00
F src/test_quota.c 9d6be9cd3bb132df2b964193b6a4ec850f50a210 F src/test_quota.c 47cb7b606160ce8f603a7d47143dd1f74de09058
F src/test_quota.h ee5da2ae7f84d1c8e0e0e2ab33f01d69f10259b5 F src/test_quota.h ee5da2ae7f84d1c8e0e0e2ab33f01d69f10259b5
F src/test_rtree.c aba603c949766c4193f1068b91c787f57274e0d9 F src/test_rtree.c aba603c949766c4193f1068b91c787f57274e0d9
F src/test_schema.c 8c06ef9ddb240c7a0fcd31bc221a6a2aade58bf0 F src/test_schema.c 8c06ef9ddb240c7a0fcd31bc221a6a2aade58bf0
@@ -254,7 +254,7 @@ F src/vdbeaux.c dcff925ee54f73a6a729ea56e4197c91b38645c4
F src/vdbeblob.c 11248c6362389569764682eb0f59ce910f3cc381 F src/vdbeblob.c 11248c6362389569764682eb0f59ce910f3cc381
F src/vdbemem.c cb55e84b8e2c15704968ee05f0fae25883299b74 F src/vdbemem.c cb55e84b8e2c15704968ee05f0fae25883299b74
F src/vdbesort.c b25814d385895544ebc8118245c8311ded7f81c9 F src/vdbesort.c b25814d385895544ebc8118245c8311ded7f81c9
F src/vdbetrace.c d6e50e04e1ec498150e519058f617d91b8f5c843 F src/vdbetrace.c 79059ebd17b3c8545fab2a24253713e77e4ab392
F src/vtab.c ae657b1c22cff43863458e768a44f915c07bc0e4 F src/vtab.c ae657b1c22cff43863458e768a44f915c07bc0e4
F src/wal.c 7bb3ad807afc7973406c805d5157ec7a2f65e146 F src/wal.c 7bb3ad807afc7973406c805d5157ec7a2f65e146
F src/wal.h 29c197540b19044e6cd73487017e5e47a1d3dac6 F src/wal.h 29c197540b19044e6cd73487017e5e47a1d3dac6
@@ -511,6 +511,7 @@ F test/fts4merge3.test aab02a09f50fe6baaddc2e159c3eabc116d45fc7
F test/func.test 9809b7622d721904a8cc33c1ffb87f46d506ed01 F test/func.test 9809b7622d721904a8cc33c1ffb87f46d506ed01
F test/func2.test 772d66227e4e6684b86053302e2d74a2500e1e0f F test/func2.test 772d66227e4e6684b86053302e2d74a2500e1e0f
F test/func3.test 001021e5b88bd02a3b365a5c5fd8f6f49d39744a F test/func3.test 001021e5b88bd02a3b365a5c5fd8f6f49d39744a
F test/fuzz-oss1.test 4912e528ec9cf2f42134456933659d371c9e0d74
F test/fuzz.test 77fd50afc12847af50fcf1941679d90adebadde6 F test/fuzz.test 77fd50afc12847af50fcf1941679d90adebadde6
F test/fuzz2.test 207d0f9d06db3eaf47a6b7bfc835b8e2fc397167 F test/fuzz2.test 207d0f9d06db3eaf47a6b7bfc835b8e2fc397167
F test/fuzz3.test aec64345184d1662bd30e6a17851ff659d596dc5 F test/fuzz3.test aec64345184d1662bd30e6a17851ff659d596dc5
@@ -703,7 +704,7 @@ F test/shared6.test 866bb4982c45ce216c61ded5e8fde4e7e2f3ffa9
F test/shared7.test 960760bc8d03e1419e70dea69cf41db62853616e F test/shared7.test 960760bc8d03e1419e70dea69cf41db62853616e
F test/shared_err.test 91e26ec4f3fbe07951967955585137e2f18993de F test/shared_err.test 91e26ec4f3fbe07951967955585137e2f18993de
F test/sharedlock.test ffa0a3c4ac192145b310f1254f8afca4d553eabf F test/sharedlock.test ffa0a3c4ac192145b310f1254f8afca4d553eabf
F test/shell1.test cd9f846702d1d471225a988fee590a153be8192c F test/shell1.test 6e3013bc50e2b73f00d17e491f776decc82a71c8
F test/shell2.test 037d6ad16e873354195d30bb2dc4b5321788154a F test/shell2.test 037d6ad16e873354195d30bb2dc4b5321788154a
F test/shell3.test 9196c42772d575685e722c92b4b39053c6ebba59 F test/shell3.test 9196c42772d575685e722c92b4b39053c6ebba59
F test/shell4.test aa4eef8118b412d1a01477a53426ece169ea86a9 F test/shell4.test aa4eef8118b412d1a01477a53426ece169ea86a9
@@ -725,7 +726,7 @@ F test/speed4p.test 0e51908951677de5a969b723e03a27a1c45db38b
F test/sqllimits1.test b1aae27cc98eceb845e7f7adf918561256e31298 F test/sqllimits1.test b1aae27cc98eceb845e7f7adf918561256e31298
F test/stat.test 08e8185b3fd5b010c90d7ad82b9dd4ea1cbf14b0 F test/stat.test 08e8185b3fd5b010c90d7ad82b9dd4ea1cbf14b0
F test/stmt.test 25d64e3dbf9a3ce89558667d7f39d966fe2a71b9 F test/stmt.test 25d64e3dbf9a3ce89558667d7f39d966fe2a71b9
F test/subquery.test c5e0d183f1ae6251453338a465b32ae11326e0fa F test/subquery.test d4aea23ac267463d4aa604bf937c3992347b20f7
F test/subquery2.test edcad5c118f0531c2e21bf16a09bbb105252d4cd F test/subquery2.test edcad5c118f0531c2e21bf16a09bbb105252d4cd
F test/subselect.test d24fd8757daf97dafd2e889c73ea4c4272dcf4e4 F test/subselect.test d24fd8757daf97dafd2e889c73ea4c4272dcf4e4
F test/substr.test 18f57c4ca8a598805c4d64e304c418734d843c1a F test/substr.test 18f57c4ca8a598805c4d64e304c418734d843c1a
@@ -1010,7 +1011,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
F tool/warnings-clang.sh a8a0a3babda96dfb1ff51adda3cbbf3dfb7266c2 F tool/warnings-clang.sh a8a0a3babda96dfb1ff51adda3cbbf3dfb7266c2
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
P 3f4848a871a4229ff6951eefaf7673de46d2c43f 8654aa9540fe9fd210899d83d17f3f407096c004 P be71d2f6678c5dd8a165a67ef6d3f64678227260 6d326d44fd1d626aae0e8456e5fa2049f1ce0789
R c872cdf2a64405ba1f81f7e57bf6db74 R 8ca88d845e5923388befe35b00d807d4
U drh U drh
Z 680ed680161266c09375dbd2ad742a8a Z aad7c1b5110d40f9689e7d5474bdb3b3

View File

@@ -1 +1 @@
be71d2f6678c5dd8a165a67ef6d3f64678227260 d07b7b67d1b3bf65cfe8d96d45a7f1d387bea7ce

View File

@@ -502,9 +502,16 @@ static void sqliteDeleteColumnNames(sqlite3 *db, Table *pTable){
** the table data structure from the hash table. But it does destroy ** the table data structure from the hash table. But it does destroy
** memory structures of the indices and foreign keys associated with ** memory structures of the indices and foreign keys associated with
** the table. ** the table.
**
** The db parameter is optional. It is needed if the Table object
** contains lookaside memory. (Table objects in the schema do not use
** lookaside memory, but some ephemeral Table objects do.) Or the
** db parameter can be used with db->pnBytesFreed to measure the memory
** used by the Table object.
*/ */
void sqlite3DeleteTable(sqlite3 *db, Table *pTable){ void sqlite3DeleteTable(sqlite3 *db, Table *pTable){
Index *pIndex, *pNext; Index *pIndex, *pNext;
TESTONLY( int nLookaside; ) /* Used to verify lookaside not used for schema */
assert( !pTable || pTable->nRef>0 ); assert( !pTable || pTable->nRef>0 );
@@ -512,6 +519,12 @@ void sqlite3DeleteTable(sqlite3 *db, Table *pTable){
if( !pTable ) return; if( !pTable ) return;
if( ((!db || db->pnBytesFreed==0) && (--pTable->nRef)>0) ) return; if( ((!db || db->pnBytesFreed==0) && (--pTable->nRef)>0) ) return;
/* Record the number of outstanding lookaside allocations in schema Tables
** prior to doing any free() operations. Since schema Tables do not use
** lookaside, this number should not change. */
TESTONLY( nLookaside = (db && (pTable->tabFlags & TF_Ephemeral)==0) ?
db->lookaside.nOut : 0 );
/* Delete all indices associated with this table. */ /* Delete all indices associated with this table. */
for(pIndex = pTable->pIndex; pIndex; pIndex=pNext){ for(pIndex = pTable->pIndex; pIndex; pIndex=pNext){
pNext = pIndex->pNext; pNext = pIndex->pNext;
@@ -543,6 +556,9 @@ void sqlite3DeleteTable(sqlite3 *db, Table *pTable){
sqlite3VtabClear(db, pTable); sqlite3VtabClear(db, pTable);
#endif #endif
sqlite3DbFree(db, pTable); sqlite3DbFree(db, pTable);
/* Verify that no lookaside memory was used by schema tables */
assert( nLookaside==0 || nLookaside==db->lookaside.nOut );
} }
/* /*
@@ -1491,7 +1507,7 @@ void sqlite3EndTable(
sSrc.a[0].iCursor = -1; sSrc.a[0].iCursor = -1;
sNC.pParse = pParse; sNC.pParse = pParse;
sNC.pSrcList = &sSrc; sNC.pSrcList = &sSrc;
sNC.isCheck = 1; sNC.ncFlags = NC_IsCheck;
pList = p->pCheck; pList = p->pCheck;
for(i=0; i<pList->nExpr; i++){ for(i=0; i<pList->nExpr; i++){
if( sqlite3ResolveExprNames(&sNC, pList->a[i].pExpr) ){ if( sqlite3ResolveExprNames(&sNC, pList->a[i].pExpr) ){

View File

@@ -3778,7 +3778,7 @@ int sqlite3ExprCompare(Expr *pA, Expr *pB){
if( !ExprHasProperty(pB, EP_IntValue) || pA->u.iValue!=pB->u.iValue ){ if( !ExprHasProperty(pB, EP_IntValue) || pA->u.iValue!=pB->u.iValue ){
return 2; return 2;
} }
}else if( pA->op!=TK_COLUMN && pA->op!=TK_AGG_COLUMN && pA->u.zToken ){ }else if( pA->op!=TK_COLUMN && ALWAYS(pA->op!=TK_AGG_COLUMN) && pA->u.zToken){
if( ExprHasProperty(pB, EP_IntValue) || NEVER(pB->u.zToken==0) ) return 2; if( ExprHasProperty(pB, EP_IntValue) || NEVER(pB->u.zToken==0) ) return 2;
if( strcmp(pA->u.zToken,pB->u.zToken)!=0 ){ if( strcmp(pA->u.zToken,pB->u.zToken)!=0 ){
return 2; return 2;
@@ -3965,7 +3965,9 @@ static int analyzeAggregate(Walker *pWalker, Expr *pExpr){
return WRC_Prune; return WRC_Prune;
} }
case TK_AGG_FUNCTION: { case TK_AGG_FUNCTION: {
if( !sqlite3FunctionUsesOtherSrc(pExpr, pSrcList) ){ if( (pNC->ncFlags & NC_InAggFunc)==0
&& !sqlite3FunctionUsesOtherSrc(pExpr, pSrcList)
){
/* Check to see if pExpr is a duplicate of another aggregate /* Check to see if pExpr is a duplicate of another aggregate
** function that is already in the pAggInfo structure ** function that is already in the pAggInfo structure
*/ */
@@ -4002,8 +4004,8 @@ static int analyzeAggregate(Walker *pWalker, Expr *pExpr){
ExprSetIrreducible(pExpr); ExprSetIrreducible(pExpr);
pExpr->iAgg = (i16)i; pExpr->iAgg = (i16)i;
pExpr->pAggInfo = pAggInfo; pExpr->pAggInfo = pAggInfo;
return WRC_Prune;
} }
return WRC_Prune;
} }
} }
return WRC_Continue; return WRC_Continue;

View File

@@ -491,6 +491,10 @@ void sqlite3DbFree(sqlite3 *db, void *p){
} }
if( isLookaside(db, p) ){ if( isLookaside(db, p) ){
LookasideSlot *pBuf = (LookasideSlot*)p; LookasideSlot *pBuf = (LookasideSlot*)p;
#if SQLITE_DEBUG
/* Trash all content in the buffer being freed */
memset(p, 0xaa, db->lookaside.sz);
#endif
pBuf->pNext = db->lookaside.pFree; pBuf->pNext = db->lookaside.pFree;
db->lookaside.pFree = pBuf; db->lookaside.pFree = pBuf;
db->lookaside.nOut--; db->lookaside.nOut--;

View File

@@ -706,6 +706,7 @@ static int sqlite3LockAndPrepare(
} }
sqlite3BtreeLeaveAll(db); sqlite3BtreeLeaveAll(db);
sqlite3_mutex_leave(db->mutex); sqlite3_mutex_leave(db->mutex);
assert( rc==SQLITE_OK || *ppStmt==0 );
return rc; return rc;
} }

View File

@@ -311,7 +311,7 @@ static int lookupName(
assert( pExpr->x.pList==0 ); assert( pExpr->x.pList==0 );
assert( pExpr->x.pSelect==0 ); assert( pExpr->x.pSelect==0 );
pOrig = pEList->a[j].pExpr; pOrig = pEList->a[j].pExpr;
if( !pNC->allowAgg && ExprHasProperty(pOrig, EP_Agg) ){ if( (pNC->ncFlags&NC_AllowAgg)==0 && ExprHasProperty(pOrig, EP_Agg) ){
sqlite3ErrorMsg(pParse, "misuse of aliased aggregate %s", zAs); sqlite3ErrorMsg(pParse, "misuse of aliased aggregate %s", zAs);
return WRC_Abort; return WRC_Abort;
} }
@@ -556,7 +556,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
} }
} }
#endif #endif
if( is_agg && !pNC->allowAgg ){ if( is_agg && (pNC->ncFlags & NC_AllowAgg)==0 ){
sqlite3ErrorMsg(pParse, "misuse of aggregate function %.*s()", nId,zId); sqlite3ErrorMsg(pParse, "misuse of aggregate function %.*s()", nId,zId);
pNC->nErr++; pNC->nErr++;
is_agg = 0; is_agg = 0;
@@ -570,11 +570,11 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
} }
if( is_agg ){ if( is_agg ){
pExpr->op = TK_AGG_FUNCTION; pExpr->op = TK_AGG_FUNCTION;
pNC->hasAgg = 1; pNC->ncFlags |= NC_HasAgg;
} }
if( is_agg ) pNC->allowAgg = 0; if( is_agg ) pNC->ncFlags &= ~NC_AllowAgg;
sqlite3WalkExprList(pWalker, pList); sqlite3WalkExprList(pWalker, pList);
if( is_agg ) pNC->allowAgg = 1; if( is_agg ) pNC->ncFlags |= NC_AllowAgg;
/* FIX ME: Compute pExpr->affinity based on the expected return /* FIX ME: Compute pExpr->affinity based on the expected return
** type of the function ** type of the function
*/ */
@@ -589,7 +589,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
if( ExprHasProperty(pExpr, EP_xIsSelect) ){ if( ExprHasProperty(pExpr, EP_xIsSelect) ){
int nRef = pNC->nRef; int nRef = pNC->nRef;
#ifndef SQLITE_OMIT_CHECK #ifndef SQLITE_OMIT_CHECK
if( pNC->isCheck ){ if( (pNC->ncFlags & NC_IsCheck)!=0 ){
sqlite3ErrorMsg(pParse,"subqueries prohibited in CHECK constraints"); sqlite3ErrorMsg(pParse,"subqueries prohibited in CHECK constraints");
} }
#endif #endif
@@ -603,7 +603,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
} }
#ifndef SQLITE_OMIT_CHECK #ifndef SQLITE_OMIT_CHECK
case TK_VARIABLE: { case TK_VARIABLE: {
if( pNC->isCheck ){ if( (pNC->ncFlags & NC_IsCheck)!=0 ){
sqlite3ErrorMsg(pParse,"parameters prohibited in CHECK constraints"); sqlite3ErrorMsg(pParse,"parameters prohibited in CHECK constraints");
} }
break; break;
@@ -685,7 +685,7 @@ static int resolveOrderByTermToExprList(
nc.pParse = pParse; nc.pParse = pParse;
nc.pSrcList = pSelect->pSrc; nc.pSrcList = pSelect->pSrc;
nc.pEList = pEList; nc.pEList = pEList;
nc.allowAgg = 1; nc.ncFlags = NC_AllowAgg;
nc.nErr = 0; nc.nErr = 0;
db = pParse->db; db = pParse->db;
savedSuppErr = db->suppressErr; savedSuppErr = db->suppressErr;
@@ -987,7 +987,7 @@ static int resolveSelectStep(Walker *pWalker, Select *p){
/* Set up the local name-context to pass to sqlite3ResolveExprNames() to /* Set up the local name-context to pass to sqlite3ResolveExprNames() to
** resolve the result-set expression list. ** resolve the result-set expression list.
*/ */
sNC.allowAgg = 1; sNC.ncFlags = NC_AllowAgg;
sNC.pSrcList = p->pSrc; sNC.pSrcList = p->pSrc;
sNC.pNext = pOuterNC; sNC.pNext = pOuterNC;
@@ -1033,10 +1033,10 @@ static int resolveSelectStep(Walker *pWalker, Select *p){
*/ */
assert( (p->selFlags & SF_Aggregate)==0 ); assert( (p->selFlags & SF_Aggregate)==0 );
pGroupBy = p->pGroupBy; pGroupBy = p->pGroupBy;
if( pGroupBy || sNC.hasAgg ){ if( pGroupBy || (sNC.ncFlags & NC_HasAgg)!=0 ){
p->selFlags |= SF_Aggregate; p->selFlags |= SF_Aggregate;
}else{ }else{
sNC.allowAgg = 0; sNC.ncFlags &= ~NC_AllowAgg;
} }
/* If a HAVING clause is present, then there must be a GROUP BY clause. /* If a HAVING clause is present, then there must be a GROUP BY clause.
@@ -1065,7 +1065,7 @@ static int resolveSelectStep(Walker *pWalker, Select *p){
** outer queries ** outer queries
*/ */
sNC.pNext = 0; sNC.pNext = 0;
sNC.allowAgg = 1; sNC.ncFlags |= NC_AllowAgg;
/* Process the ORDER BY clause for singleton SELECT statements. /* Process the ORDER BY clause for singleton SELECT statements.
** The ORDER BY clause for compounds SELECT statements is handled ** The ORDER BY clause for compounds SELECT statements is handled
@@ -1153,7 +1153,7 @@ static int resolveSelectStep(Walker *pWalker, Select *p){
** **
** Function calls are checked to make sure that the function is ** Function calls are checked to make sure that the function is
** defined and that the correct number of arguments are specified. ** defined and that the correct number of arguments are specified.
** If the function is an aggregate function, then the pNC->hasAgg is ** If the function is an aggregate function, then the NC_HasAgg flag is
** set and the opcode is changed from TK_FUNCTION to TK_AGG_FUNCTION. ** set and the opcode is changed from TK_FUNCTION to TK_AGG_FUNCTION.
** If an expression contains aggregate functions then the EP_Agg ** If an expression contains aggregate functions then the EP_Agg
** property on the expression is set. ** property on the expression is set.
@@ -1165,7 +1165,7 @@ int sqlite3ResolveExprNames(
NameContext *pNC, /* Namespace to resolve expressions in. */ NameContext *pNC, /* Namespace to resolve expressions in. */
Expr *pExpr /* The expression to be analyzed. */ Expr *pExpr /* The expression to be analyzed. */
){ ){
int savedHasAgg; u8 savedHasAgg;
Walker w; Walker w;
if( pExpr==0 ) return 0; if( pExpr==0 ) return 0;
@@ -1178,8 +1178,8 @@ int sqlite3ResolveExprNames(
pParse->nHeight += pExpr->nHeight; pParse->nHeight += pExpr->nHeight;
} }
#endif #endif
savedHasAgg = pNC->hasAgg; savedHasAgg = pNC->ncFlags & NC_HasAgg;
pNC->hasAgg = 0; pNC->ncFlags &= ~NC_HasAgg;
w.xExprCallback = resolveExprStep; w.xExprCallback = resolveExprStep;
w.xSelectCallback = resolveSelectStep; w.xSelectCallback = resolveSelectStep;
w.pParse = pNC->pParse; w.pParse = pNC->pParse;
@@ -1191,10 +1191,10 @@ int sqlite3ResolveExprNames(
if( pNC->nErr>0 || w.pParse->nErr>0 ){ if( pNC->nErr>0 || w.pParse->nErr>0 ){
ExprSetProperty(pExpr, EP_Error); ExprSetProperty(pExpr, EP_Error);
} }
if( pNC->hasAgg ){ if( pNC->ncFlags & NC_HasAgg ){
ExprSetProperty(pExpr, EP_Agg); ExprSetProperty(pExpr, EP_Agg);
}else if( savedHasAgg ){ }else if( savedHasAgg ){
pNC->hasAgg = 1; pNC->ncFlags |= NC_HasAgg;
} }
return ExprHasProperty(pExpr, EP_Error); return ExprHasProperty(pExpr, EP_Error);
} }

View File

@@ -3149,6 +3149,7 @@ static Table *isSimpleCount(Select *p, AggInfo *pAggInfo){
if( IsVirtual(pTab) ) return 0; if( IsVirtual(pTab) ) return 0;
if( pExpr->op!=TK_AGG_FUNCTION ) return 0; if( pExpr->op!=TK_AGG_FUNCTION ) return 0;
if( pAggInfo->nFunc==0 ) return 0;
if( (pAggInfo->aFunc[0].pFunc->flags&SQLITE_FUNC_COUNT)==0 ) return 0; if( (pAggInfo->aFunc[0].pFunc->flags&SQLITE_FUNC_COUNT)==0 ) return 0;
if( pExpr->flags&EP_Distinct ) return 0; if( pExpr->flags&EP_Distinct ) return 0;
@@ -4139,7 +4140,9 @@ int sqlite3Select(
sAggInfo.nAccumulator = sAggInfo.nColumn; sAggInfo.nAccumulator = sAggInfo.nColumn;
for(i=0; i<sAggInfo.nFunc; i++){ for(i=0; i<sAggInfo.nFunc; i++){
assert( !ExprHasProperty(sAggInfo.aFunc[i].pExpr, EP_xIsSelect) ); assert( !ExprHasProperty(sAggInfo.aFunc[i].pExpr, EP_xIsSelect) );
sNC.ncFlags |= NC_InAggFunc;
sqlite3ExprAnalyzeAggList(&sNC, sAggInfo.aFunc[i].pExpr->x.pList); sqlite3ExprAnalyzeAggList(&sNC, sAggInfo.aFunc[i].pExpr->x.pList);
sNC.ncFlags &= ~NC_InAggFunc;
} }
if( db->mallocFailed ) goto select_end; if( db->mallocFailed ) goto select_end;

View File

@@ -2184,23 +2184,25 @@ static int do_meta_command(char *zLine, struct callback_data *p){
zShellStatic = azArg[1]; zShellStatic = azArg[1];
rc = sqlite3_exec(p->db, rc = sqlite3_exec(p->db,
"SELECT sql FROM " "SELECT sql FROM "
" (SELECT sql sql, type type, tbl_name tbl_name, name name" " (SELECT sql sql, type type, tbl_name tbl_name, name name, rowid x"
" FROM sqlite_master UNION ALL" " FROM sqlite_master UNION ALL"
" SELECT sql, type, tbl_name, name FROM sqlite_temp_master) " " SELECT sql, type, tbl_name, name, rowid FROM sqlite_temp_master) "
"WHERE lower(tbl_name) LIKE shellstatic()" "WHERE lower(tbl_name) LIKE shellstatic()"
" AND type!='meta' AND sql NOTNULL " " AND type!='meta' AND sql NOTNULL "
"ORDER BY substr(type,2,1), name", "ORDER BY substr(type,2,1), "
" CASE type WHEN 'view' THEN rowid ELSE name END",
callback, &data, &zErrMsg); callback, &data, &zErrMsg);
zShellStatic = 0; zShellStatic = 0;
} }
}else{ }else{
rc = sqlite3_exec(p->db, rc = sqlite3_exec(p->db,
"SELECT sql FROM " "SELECT sql FROM "
" (SELECT sql sql, type type, tbl_name tbl_name, name name" " (SELECT sql sql, type type, tbl_name tbl_name, name name, rowid x"
" FROM sqlite_master UNION ALL" " FROM sqlite_master UNION ALL"
" SELECT sql, type, tbl_name, name FROM sqlite_temp_master) " " SELECT sql, type, tbl_name, name, rowid FROM sqlite_temp_master) "
"WHERE type!='meta' AND sql NOTNULL AND name NOT LIKE 'sqlite_%'" "WHERE type!='meta' AND sql NOTNULL AND name NOT LIKE 'sqlite_%'"
"ORDER BY substr(type,2,1), name", "ORDER BY substr(type,2,1),"
" CASE type WHEN 'view' THEN rowid ELSE name END",
callback, &data, &zErrMsg callback, &data, &zErrMsg
); );
} }

View File

@@ -2014,15 +2014,21 @@ struct NameContext {
Parse *pParse; /* The parser */ Parse *pParse; /* The parser */
SrcList *pSrcList; /* One or more tables used to resolve names */ SrcList *pSrcList; /* One or more tables used to resolve names */
ExprList *pEList; /* Optional list of named expressions */ ExprList *pEList; /* Optional list of named expressions */
int nRef; /* Number of names resolved by this context */
int nErr; /* Number of errors encountered while resolving names */
u8 allowAgg; /* Aggregate functions allowed here */
u8 hasAgg; /* True if aggregates are seen */
u8 isCheck; /* True if resolving names in a CHECK constraint */
AggInfo *pAggInfo; /* Information about aggregates at this level */ AggInfo *pAggInfo; /* Information about aggregates at this level */
NameContext *pNext; /* Next outer name context. NULL for outermost */ NameContext *pNext; /* Next outer name context. NULL for outermost */
int nRef; /* Number of names resolved by this context */
int nErr; /* Number of errors encountered while resolving names */
u8 ncFlags; /* Zero or more NC_* flags defined below */
}; };
/*
** Allowed values for the NameContext, ncFlags field.
*/
#define NC_AllowAgg 0x01 /* Aggregate functions are allowed here */
#define NC_HasAgg 0x02 /* One or more aggregate functions seen */
#define NC_IsCheck 0x04 /* True if resolving names in a CHECK constraint */
#define NC_InAggFunc 0x08 /* True if analyzing arguments to an agg func */
/* /*
** An instance of the following structure contains all information ** An instance of the following structure contains all information
** needed to generate code for a single SELECT statement. ** needed to generate code for a single SELECT statement.

View File

@@ -45,6 +45,62 @@
#endif /* SQLITE_THREADSAFE==0 */ #endif /* SQLITE_THREADSAFE==0 */
/*
** Figure out if we are dealing with Unix, Windows, or some other
** operating system. After the following block of preprocess macros,
** all of SQLITE_OS_UNIX, SQLITE_OS_WIN, SQLITE_OS_OS2, and SQLITE_OS_OTHER
** will defined to either 1 or 0. One of the four will be 1. The other
** three will be 0.
*/
#if defined(SQLITE_OS_OTHER)
# if SQLITE_OS_OTHER==1
# undef SQLITE_OS_UNIX
# define SQLITE_OS_UNIX 0
# undef SQLITE_OS_WIN
# define SQLITE_OS_WIN 0
# undef SQLITE_OS_OS2
# define SQLITE_OS_OS2 0
# else
# undef SQLITE_OS_OTHER
# endif
#endif
#if !defined(SQLITE_OS_UNIX) && !defined(SQLITE_OS_OTHER)
# define SQLITE_OS_OTHER 0
# ifndef SQLITE_OS_WIN
# if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) \
|| defined(__MINGW32__) || defined(__BORLANDC__)
# define SQLITE_OS_WIN 1
# define SQLITE_OS_UNIX 0
# define SQLITE_OS_OS2 0
# elif defined(__EMX__) || defined(_OS2) || defined(OS2) \
|| defined(_OS2_) || defined(__OS2__)
# define SQLITE_OS_WIN 0
# define SQLITE_OS_UNIX 0
# define SQLITE_OS_OS2 1
# else
# define SQLITE_OS_WIN 0
# define SQLITE_OS_UNIX 1
# define SQLITE_OS_OS2 0
# endif
# else
# define SQLITE_OS_UNIX 0
# define SQLITE_OS_OS2 0
# endif
#else
# ifndef SQLITE_OS_WIN
# define SQLITE_OS_WIN 0
# endif
#endif
#if SQLITE_OS_UNIX
# include <unistd.h>
#endif
#if SQLITE_OS_WIN
# include <windows.h>
# include <io.h>
#endif
/************************ Object Definitions ******************************/ /************************ Object Definitions ******************************/
/* Forward declaration of all object types */ /* Forward declaration of all object types */
@@ -359,62 +415,6 @@ static quotaFile *quotaFindFile(
} }
return pFile; return pFile;
} }
/*
** Figure out if we are dealing with Unix, Windows, or some other
** operating system. After the following block of preprocess macros,
** all of SQLITE_OS_UNIX, SQLITE_OS_WIN, SQLITE_OS_OS2, and SQLITE_OS_OTHER
** will defined to either 1 or 0. One of the four will be 1. The other
** three will be 0.
*/
#if defined(SQLITE_OS_OTHER)
# if SQLITE_OS_OTHER==1
# undef SQLITE_OS_UNIX
# define SQLITE_OS_UNIX 0
# undef SQLITE_OS_WIN
# define SQLITE_OS_WIN 0
# undef SQLITE_OS_OS2
# define SQLITE_OS_OS2 0
# else
# undef SQLITE_OS_OTHER
# endif
#endif
#if !defined(SQLITE_OS_UNIX) && !defined(SQLITE_OS_OTHER)
# define SQLITE_OS_OTHER 0
# ifndef SQLITE_OS_WIN
# if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) \
|| defined(__MINGW32__) || defined(__BORLANDC__)
# define SQLITE_OS_WIN 1
# define SQLITE_OS_UNIX 0
# define SQLITE_OS_OS2 0
# elif defined(__EMX__) || defined(_OS2) || defined(OS2) \
|| defined(_OS2_) || defined(__OS2__)
# define SQLITE_OS_WIN 0
# define SQLITE_OS_UNIX 0
# define SQLITE_OS_OS2 1
# else
# define SQLITE_OS_WIN 0
# define SQLITE_OS_UNIX 1
# define SQLITE_OS_OS2 0
# endif
# else
# define SQLITE_OS_UNIX 0
# define SQLITE_OS_OS2 0
# endif
#else
# ifndef SQLITE_OS_WIN
# define SQLITE_OS_WIN 0
# endif
#endif
#if SQLITE_OS_UNIX
# include <unistd.h>
#endif
#if SQLITE_OS_WIN
# include <windows.h>
# include <io.h>
#endif
/* /*
** Translate UTF8 to MBCS for use in fopen() calls. Return a pointer to the ** Translate UTF8 to MBCS for use in fopen() calls. Return a pointer to the
** translated text.. Call quota_mbcs_free() to deallocate any memory ** translated text.. Call quota_mbcs_free() to deallocate any memory

View File

@@ -167,8 +167,9 @@ char *sqlite3VdbeExpandSql(
*/ */
void sqlite3ExplainBegin(Vdbe *pVdbe){ void sqlite3ExplainBegin(Vdbe *pVdbe){
if( pVdbe ){ if( pVdbe ){
Explain *p;
sqlite3BeginBenignMalloc(); sqlite3BeginBenignMalloc();
Explain *p = sqlite3_malloc( sizeof(Explain) ); p = sqlite3_malloc( sizeof(Explain) );
if( p ){ if( p ){
memset(p, 0, sizeof(*p)); memset(p, 0, sizeof(*p));
p->pVdbe = pVdbe; p->pVdbe = pVdbe;

2001
test/fuzz-oss1.test Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -174,8 +174,7 @@ do_test shell1-1.15.3 {
# -version show SQLite version # -version show SQLite version
do_test shell1-1.16.1 { do_test shell1-1.16.1 {
set x [catchcmd "-version test.db" ""] set x [catchcmd "-version test.db" ""]
regexp {0 \{3.\d.\d+ 20\d\d-[01]\d-\d\d \d\d:\d\d:\d\d [0-9a-f]+\}} $x } {/3.[0-9.]+ 20\d\d-[01]\d-\d\d \d\d:\d\d:\d\d [0-9a-f]+/}
} 1
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# Test cases shell1-2.*: Basic "dot" command token parsing. # Test cases shell1-2.*: Basic "dot" command token parsing.
@@ -284,7 +283,7 @@ do_test shell1-3.2.4 {
# .databases List names and files of attached databases # .databases List names and files of attached databases
do_test shell1-3.3.1 { do_test shell1-3.3.1 {
catchcmd "-csv test.db" ".databases" catchcmd "-csv test.db" ".databases"
} {/0 +.*main +.*test.db.*/} } "/0 +.*main +[string map {/ .} [string range [pwd] 0 10]].*/"
do_test shell1-3.3.2 { do_test shell1-3.3.2 {
# too many arguments # too many arguments
catchcmd "test.db" ".databases BAD" catchcmd "test.db" ".databases BAD"
@@ -578,6 +577,18 @@ do_test shell1-3.21.3 {
catchcmd "test.db" ".schema FOO BAD" catchcmd "test.db" ".schema FOO BAD"
} {1 {Error: unknown command or invalid arguments: "schema". Enter ".help" for help}} } {1 {Error: unknown command or invalid arguments: "schema". Enter ".help" for help}}
do_test shell1-3.21.4 {
catchcmd "test.db" {
CREATE TABLE t1(x);
CREATE VIEW v2 AS SELECT x+1 AS y FROM t1;
CREATE VIEW v1 AS SELECT y+1 FROM v2;
}
catchcmd "test.db" ".schema"
} {0 {CREATE TABLE t1(x);
CREATE VIEW v2 AS SELECT x+1 AS y FROM t1;
CREATE VIEW v1 AS SELECT y+1 FROM v2;}}
db eval {DROP VIEW v1; DROP VIEW v2; DROP TABLE t1;}
# .separator STRING Change separator used by output mode and .import # .separator STRING Change separator used by output mode and .import
do_test shell1-3.22.1 { do_test shell1-3.22.1 {
catchcmd "test.db" ".separator" catchcmd "test.db" ".separator"

View File

@@ -377,6 +377,44 @@ do_test subquery-3.4.3 {
} }
} {106 4.5 0 1 107 4.0 1 0} } {106 4.5 0 1 107 4.0 1 0}
do_test subquery-3.5.1 {
execsql {
CREATE TABLE t35a(x); INSERT INTO t35a VALUES(1),(2),(3);
CREATE TABLE t35b(y); INSERT INTO t35b VALUES(98), (99);
SELECT max((SELECT avg(y) FROM t35b)) FROM t35a;
}
} {98.5}
do_test subquery-3.5.2 {
execsql {
SELECT max((SELECT count(y) FROM t35b)) FROM t35a;
}
} {2}
do_test subquery-3.5.3 {
execsql {
SELECT max((SELECT count() FROM t35b)) FROM t35a;
}
} {2}
do_test subquery-3.5.4 {
catchsql {
SELECT max((SELECT count(x) FROM t35b)) FROM t35a;
}
} {1 {misuse of aggregate: count()}}
do_test subquery-3.5.5 {
catchsql {
SELECT max((SELECT count(x) FROM t35b)) FROM t35a;
}
} {1 {misuse of aggregate: count()}}
do_test subquery-3.5.6 {
catchsql {
SELECT max((SELECT a FROM (SELECT count(x) AS a FROM t35b))) FROM t35a;
}
} {1 {misuse of aggregate: count()}}
do_test subquery-3.5.7 {
execsql {
SELECT max((SELECT a FROM (SELECT count(y) AS a FROM t35b))) FROM t35a;
}
} {2}
#------------------------------------------------------------------ #------------------------------------------------------------------
# These tests - subquery-4.* - use the TCL statement cache to try # These tests - subquery-4.* - use the TCL statement cache to try