Compare commits
20 Commits
session-make
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| a72a15e45a | |||
| ba1079ba2a | |||
| 170b66493d | |||
| e8da01c189 | |||
| 3eead27022 | |||
| f09c48233a | |||
| a3fd75d426 | |||
| 87f8f1ac69 | |||
| 39332fb0f7 | |||
| bcf6884afd | |||
| d49c6930b1 | |||
| 70077d1733 | |||
| ad5a9d715f | |||
| 4e80d5fcf1 | |||
| 9fe3fbbc35 | |||
| 91da707280 | |||
| 582c080289 | |||
| c88ae52d86 | |||
| 12b35ea980 | |||
| 799730bf81 |
+8
-5
@@ -198,6 +198,12 @@ DEBUG = 0
|
||||
OPTIMIZATIONS = 2
|
||||
!ENDIF
|
||||
|
||||
# Set this to non-0 to enable support for the session extension.
|
||||
#
|
||||
!IFNDEF SESSION
|
||||
SESSION = 0
|
||||
!ENDIF
|
||||
|
||||
# Set the source code file to be used by executables and libraries when
|
||||
# they need the amalgamation.
|
||||
#
|
||||
@@ -266,12 +272,9 @@ OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RTREE=1
|
||||
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1
|
||||
!ENDIF
|
||||
|
||||
# Enable support for the session extension if the SESSION=1 argument is
|
||||
# present on the nmake command-line
|
||||
# Should the session extension be enabled? If so, add compilation options
|
||||
# to enable it.
|
||||
#
|
||||
!IFNDEF SESSION
|
||||
SESSION = 0
|
||||
!ENDIF
|
||||
!IF $(SESSION)!=0
|
||||
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_SESSION=1
|
||||
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_PREUPDATE_HOOK=1
|
||||
|
||||
@@ -183,6 +183,12 @@ DEBUG = 0
|
||||
OPTIMIZATIONS = 2
|
||||
!ENDIF
|
||||
|
||||
# Set this to non-0 to enable support for the session extension.
|
||||
#
|
||||
!IFNDEF SESSION
|
||||
SESSION = 0
|
||||
!ENDIF
|
||||
|
||||
# Set the source code file to be used by executables and libraries when
|
||||
# they need the amalgamation.
|
||||
#
|
||||
@@ -251,12 +257,9 @@ OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RTREE=1
|
||||
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1
|
||||
!ENDIF
|
||||
|
||||
# Enable support for the session extension if the SESSION=1 argument is
|
||||
# present on the nmake command-line
|
||||
# Should the session extension be enabled? If so, add compilation options
|
||||
# to enable it.
|
||||
#
|
||||
!IFNDEF SESSION
|
||||
SESSION = 0
|
||||
!ENDIF
|
||||
!IF $(SESSION)!=0
|
||||
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_SESSION=1
|
||||
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_PREUPDATE_HOOK=1
|
||||
|
||||
@@ -103,7 +103,7 @@ AC_SUBST(DYNAMIC_EXTENSION_FLAGS)
|
||||
AC_ARG_ENABLE(fts5, [AS_HELP_STRING(
|
||||
[--enable-fts5], [include fts5 support [default=no]])],
|
||||
[], [enable_fts5=no])
|
||||
if test x"$enable_fts5" == "xyes"; then
|
||||
if test x"$enable_fts5" = "xyes"; then
|
||||
AC_SEARCH_LIBS(log, m)
|
||||
FTS5_FLAGS=-DSQLITE_ENABLE_FTS5
|
||||
fi
|
||||
@@ -116,7 +116,7 @@ AC_SUBST(FTS5_FLAGS)
|
||||
AC_ARG_ENABLE(json1, [AS_HELP_STRING(
|
||||
[--enable-json1], [include json1 support [default=no]])],
|
||||
[], [enable_json1=no])
|
||||
if test x"$enable_json1" == "xyes"; then
|
||||
if test x"$enable_json1" = "xyes"; then
|
||||
JSON1_FLAGS=-DSQLITE_ENABLE_JSON1
|
||||
fi
|
||||
AC_SUBST(JSON1_FLAGS)
|
||||
@@ -128,7 +128,7 @@ AC_SUBST(JSON1_FLAGS)
|
||||
AC_ARG_ENABLE(session, [AS_HELP_STRING(
|
||||
[--enable-session], [enable the session extension [default=no]])],
|
||||
[], [enable_session=no])
|
||||
if test x"$enable_session" == "xyes"; then
|
||||
if test x"$enable_session" = "xyes"; then
|
||||
SESSION_FLAGS="-DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK"
|
||||
fi
|
||||
AC_SUBST(SESSION_FLAGS)
|
||||
@@ -141,7 +141,7 @@ AC_ARG_ENABLE(static-shell, [AS_HELP_STRING(
|
||||
[--enable-static-shell],
|
||||
[statically link libsqlite3 into shell tool [default=yes]])],
|
||||
[], [enable_static_shell=yes])
|
||||
if test x"$enable_static_shell" == "xyes"; then
|
||||
if test x"$enable_static_shell" = "xyes"; then
|
||||
EXTRA_SHELL_OBJ=sqlite3-sqlite3.$OBJEXT
|
||||
else
|
||||
EXTRA_SHELL_OBJ=libsqlite3.la
|
||||
|
||||
+7
-5
@@ -143,11 +143,13 @@ struct Fts5PhraseIter {
|
||||
** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid
|
||||
**
|
||||
** with $p set to a phrase equivalent to the phrase iPhrase of the
|
||||
** current query is executed. For each row visited, the callback function
|
||||
** passed as the fourth argument is invoked. The context and API objects
|
||||
** passed to the callback function may be used to access the properties of
|
||||
** each matched row. Invoking Api.xUserData() returns a copy of the pointer
|
||||
** passed as the third argument to pUserData.
|
||||
** current query is executed. Any column filter that applies to
|
||||
** phrase iPhrase of the current query is included in $p. For each
|
||||
** row visited, the callback function passed as the fourth argument
|
||||
** is invoked. The context and API objects passed to the callback
|
||||
** function may be used to access the properties of each matched row.
|
||||
** Invoking Api.xUserData() returns a copy of the pointer passed as
|
||||
** the third argument to pUserData.
|
||||
**
|
||||
** If the callback function returns any value other than SQLITE_OK, the
|
||||
** query is abandoned and the xQueryPhrase function returns immediately.
|
||||
|
||||
@@ -1655,6 +1655,17 @@ int sqlite3Fts5ExprClonePhrase(
|
||||
pNew->pRoot->pNear = (Fts5ExprNearset*)sqlite3Fts5MallocZero(&rc,
|
||||
sizeof(Fts5ExprNearset) + sizeof(Fts5ExprPhrase*));
|
||||
}
|
||||
if( rc==SQLITE_OK ){
|
||||
Fts5Colset *pColsetOrig = pOrig->pNode->pNear->pColset;
|
||||
if( pColsetOrig ){
|
||||
int nByte = sizeof(Fts5Colset) + pColsetOrig->nCol * sizeof(int);
|
||||
Fts5Colset *pColset = (Fts5Colset*)sqlite3Fts5MallocZero(&rc, nByte);
|
||||
if( pColset ){
|
||||
memcpy(pColset, pColsetOrig, nByte);
|
||||
}
|
||||
pNew->pRoot->pNear->pColset = pColset;
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0; rc==SQLITE_OK && i<pOrig->nTerm; i++){
|
||||
int tflags = 0;
|
||||
|
||||
@@ -246,5 +246,37 @@ foreach {tn lRow res} {
|
||||
} $res
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Test the built-in bm25() demo.
|
||||
#
|
||||
reset_db
|
||||
do_execsql_test 9.1 {
|
||||
CREATE VIRTUAL TABLE t1 USING fts5(a, b);
|
||||
INSERT INTO t1 VALUES('a', NULL); -- 1
|
||||
INSERT INTO t1 VALUES('a', NULL); -- 2
|
||||
INSERT INTO t1 VALUES('a', NULL); -- 3
|
||||
INSERT INTO t1 VALUES('a', NULL); -- 4
|
||||
INSERT INTO t1 VALUES('a', NULL); -- 5
|
||||
INSERT INTO t1 VALUES('a', NULL); -- 6
|
||||
INSERT INTO t1 VALUES('a', NULL); -- 7
|
||||
INSERT INTO t1 VALUES('a', NULL); -- 8
|
||||
INSERT INTO t1 VALUES(NULL, 'a a b'); -- 9
|
||||
INSERT INTO t1 VALUES(NULL, 'b b a'); -- 10
|
||||
}
|
||||
|
||||
do_execsql_test 9.2 {
|
||||
SELECT rowid FROM t1('a AND b') ORDER BY rank;
|
||||
} {
|
||||
10 9
|
||||
}
|
||||
|
||||
do_execsql_test 9.3 {
|
||||
SELECT rowid FROM t1('b:a AND b:b') ORDER BY rank;
|
||||
} {
|
||||
9 10
|
||||
}
|
||||
|
||||
|
||||
|
||||
finish_test
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
#ifndef __SQLITESESSION_H_
|
||||
#if !defined(__SQLITESESSION_H_) && defined(SQLITE_ENABLE_SESSION)
|
||||
#define __SQLITESESSION_H_ 1
|
||||
|
||||
/*
|
||||
@@ -1274,4 +1274,4 @@ int sqlite3changegroup_output_strm(sqlite3_changegroup*,
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SQLITE_ENABLE_SESSION && SQLITE_ENABLE_PREUPDATE_HOOK */
|
||||
#endif /* !defined(__SQLITESESSION_H_) && defined(SQLITE_ENABLE_SESSION) */
|
||||
|
||||
@@ -388,8 +388,7 @@ TESTSRC2 = \
|
||||
$(TOP)/ext/fts3/fts3_write.c \
|
||||
$(TOP)/ext/async/sqlite3async.c \
|
||||
$(TOP)/ext/session/sqlite3session.c \
|
||||
$(TOP)/ext/session/test_session.c \
|
||||
$(FTS5_SRC)
|
||||
$(TOP)/ext/session/test_session.c
|
||||
|
||||
# Header files used by all library source files.
|
||||
#
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
C Turn\sthe\ssession\sextension\soff\sby\sdefault.\s\sEnable\susing\s--enable-session\son\nconfigure\sscripts,\sor\susing\sthe\sSESSION=1\sargument\sto\snmake\son\sWindows.
|
||||
D 2016-05-03T13:14:18.288
|
||||
C Omit\sthe\sunnecessary\sWHERE_REOPEN_IDX\sflag\sin\sthe\sWHERE\sinterface.
|
||||
D 2016-05-09T19:58:56.729
|
||||
F Makefile.in 9eda6e1c90d05c199c3ec8a7069b0682ad307657
|
||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||
F Makefile.msc a7f34be67d16284e4208370365a9728094861194
|
||||
F Makefile.msc db82b35aef27f412fef14d8534afc022138bcdfd
|
||||
F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7
|
||||
F VERSION 5d234da9b5dae329fab75ff75884cfe0a9cb3fda
|
||||
F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
|
||||
@@ -11,10 +11,10 @@ F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90
|
||||
F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2
|
||||
F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903
|
||||
F autoconf/Makefile.am 1a47d071e3d5435f8f7ebff7eb6703848bbd65d4
|
||||
F autoconf/Makefile.msc ac014aab0b8314d6baa30cbd1dd4ce983f306b5d
|
||||
F autoconf/Makefile.msc 0eca137c12542bd76c253a2d24380f29ade59b95
|
||||
F autoconf/README.first 6c4f34fe115ff55d4e8dbfa3cecf04a0188292f7
|
||||
F autoconf/README.txt 4f04b0819303aabaa35fff5f7b257fb0c1ef95f1
|
||||
F autoconf/configure.ac e2299fe80eb256dafdc68cf250e37ea1a0a6ec71
|
||||
F autoconf/configure.ac ad7001cdde3d6ae6053bc0b66009869d7c5012a8
|
||||
F autoconf/tea/Makefile.in b438a7020446c8a8156e8d97c8914a04833da6fd
|
||||
F autoconf/tea/README 3e9a3c060f29a44344ab50aec506f4db903fb873
|
||||
F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43
|
||||
@@ -97,12 +97,12 @@ F ext/fts3/unicode/UnicodeData.txt cd07314edb62d49fde34debdaf92fa2aa69011e7
|
||||
F ext/fts3/unicode/mkunicode.tcl 2debed3f582d77b3fdd0b8830880250021571fd8
|
||||
F ext/fts3/unicode/parseunicode.tcl da577d1384810fb4e2b209bf3313074353193e95
|
||||
F ext/fts5/extract_api_docs.tcl a36e54ec777172ddd3f9a88daf593b00848368e0
|
||||
F ext/fts5/fts5.h ff9c2782e8ed890b0de2f697a8d63971939e70c7
|
||||
F ext/fts5/fts5.h b770c5e0a8d2ee071ddffc7ab722dbf3474a8abe
|
||||
F ext/fts5/fts5Int.h 3677076aecbf645a7f2a019115c6a4ec3272dd78
|
||||
F ext/fts5/fts5_aux.c daa57fb45216491814520bbb587e97bf81ced458
|
||||
F ext/fts5/fts5_buffer.c 4c1502d4c956cd092c89ce4480867f9d8bf325cd
|
||||
F ext/fts5/fts5_config.c 5af9c360e99669d29f06492c370892394aba0857
|
||||
F ext/fts5/fts5_expr.c 5ca4bafe29aa3d27683c90e836192e4aefd20a3f
|
||||
F ext/fts5/fts5_expr.c da2b33c2aac91e96641c0a7cf2bbaa36eb2667f7
|
||||
F ext/fts5/fts5_hash.c 880998e596b60f078348d48732ca4ad9a90caad2
|
||||
F ext/fts5/fts5_index.c b429e23fabb57506f71e406997cc46b89190dc97
|
||||
F ext/fts5/fts5_main.c b4a0fc5bf17f2f1f056ee76cdd7d2af08b360f55
|
||||
@@ -131,7 +131,7 @@ F ext/fts5/test/fts5ak.test fb26389985407826f6076bb9f382c67d3db6b5d9
|
||||
F ext/fts5/test/fts5al.test 18c277f5986df0a3d9071dfd7128afeb16fe9d5d
|
||||
F ext/fts5/test/fts5alter.test 6022c61467a82aa11c70822ccad22b328dcf0d04
|
||||
F ext/fts5/test/fts5auto.test 401c20e89f1114d733b94809be1e6f893e16c09e
|
||||
F ext/fts5/test/fts5aux.test 8c687c948cc98e9a94be014df7d518acc1b3b74f
|
||||
F ext/fts5/test/fts5aux.test 5dd158a1e7869e27e9762a2a452b189c728d1be3
|
||||
F ext/fts5/test/fts5auxdata.test 141a7cbffcceb1bd2799b4b29c183ff8780d586e
|
||||
F ext/fts5/test/fts5bigpl.test 04ee0d7eebbebf17c31f5a0b5c5f9494eac3a0cb
|
||||
F ext/fts5/test/fts5bigtok.test 017a9397b14e7598883a6328ead4a6539b42d59a
|
||||
@@ -294,7 +294,7 @@ F ext/session/session_common.tcl a1293167d14774b5e728836720497f40fe4ea596
|
||||
F ext/session/sessionfault.test da273f2712b6411e85e71465a1733b8501dbf6f7
|
||||
F ext/session/sessionfault2.test 04aa0bc9aa70ea43d8de82c4f648db4de1e990b0
|
||||
F ext/session/sqlite3session.c 37485891b4add26cf61495df193c419f36556a32
|
||||
F ext/session/sqlite3session.h 64e9e7f185725ef43b97f4a9a0c0df0669844f1d
|
||||
F ext/session/sqlite3session.h 69bf73cfd71e58f2ae5d2aa935b2c1a541aee555
|
||||
F ext/session/test_session.c 464f2c8bf502795d95969387eb8e93f68c513c15
|
||||
F ext/userauth/sqlite3userauth.h 19cb6f0e31316d0ee4afdfb7a85ef9da3333a220
|
||||
F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04
|
||||
@@ -302,7 +302,7 @@ F ext/userauth/userauth.c 5fa3bdb492f481bbc1709fc83c91ebd13460c69e
|
||||
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
|
||||
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
|
||||
F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60
|
||||
F main.mk a283660f75c3c4b75d8c9d12a40fa38a066eee9d
|
||||
F main.mk 86e6a8d79186ace5ff8b306093da1728d953f796
|
||||
F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83
|
||||
F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
|
||||
F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504
|
||||
@@ -324,13 +324,13 @@ F src/btmutex.c bc87dd3b062cc26edfe79918de2200ccb8d41e73
|
||||
F src/btree.c 3ae6aea66cc4e13d30162ff0d0d43c7088e34abf
|
||||
F src/btree.h a5008b9afe56e8e54ade6c436a910f112defcca9
|
||||
F src/btreeInt.h c18b7d2a3494695133e4e60ee36061d37f45d9a5
|
||||
F src/build.c 42e8ee74dfa3a4b99bfb2c201f8a66ab50688d95
|
||||
F src/build.c d65be62254ca9df36e1e1c433324f0333f80009c
|
||||
F src/callback.c 2e76147783386374bf01b227f752c81ec872d730
|
||||
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
|
||||
F src/ctime.c 60e135af364d777a9ab41c97e5e89cd224da6198
|
||||
F src/date.c 1cc9fb516ec9932c6fd4d2a0d2f8bc4480145c39
|
||||
F src/dbstat.c c845548d4346e606e2f2b7d2e714ace2b8a7dd1b
|
||||
F src/delete.c 362f89f8e6783e672c4ab06b90fca0177f9a576d
|
||||
F src/delete.c 4aba4214a377ce8ddde2d2e609777bcc8235200f
|
||||
F src/expr.c 8796c0739b2ad091e6779253f62aad6e767e2be1
|
||||
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
|
||||
F src/fkey.c 4c0bd09e602b8ae8d36d81e31e4872d0b53c87bb
|
||||
@@ -364,7 +364,7 @@ F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa
|
||||
F src/os_unix.c a9443cdab41d7f3cdf0df3a5aab62fd6e1c9b234
|
||||
F src/os_win.c 852fc2ff6084296348ed3739c548b2cf32df394e
|
||||
F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca
|
||||
F src/pager.c a8d30c49c231e9a20d05257613db922532588963
|
||||
F src/pager.c c512873311087cd22372f2b076fc869e090e8e16
|
||||
F src/pager.h 329bdf078a4e0a3b35084534d58625d21fd03681
|
||||
F src/parse.y 10eb2f3fb62341291528c7984498054731f9d31e
|
||||
F src/pcache.c b3230ecfc7f797063fbe167f2845da363e8f07f8
|
||||
@@ -373,16 +373,16 @@ F src/pcache1.c 7f51d2b541aab57596adf62db2c4bb025d34f04d
|
||||
F src/pragma.c faf42922bb7ab2f6672cb550356c1967abae3c84
|
||||
F src/pragma.h 64c78a648751b9f4f297276c4eb7507b14b4628c
|
||||
F src/prepare.c 22df6171aec1d86904ed2ad30c2348a5748aa04e
|
||||
F src/printf.c 63e6fb12bbe702dd664dc3703776c090383a5a26
|
||||
F src/printf.c a5f0ca08ddede803c241266abb46356ec748ded1
|
||||
F src/random.c ba2679f80ec82c4190062d756f22d0c358180696
|
||||
F src/resolve.c b8f7174e5f8c33c44ded3a25a973d0bb89228c20
|
||||
F src/resolve.c cca3aa77b95706df5d635a2141a4d1de60ae6598
|
||||
F src/rowset.c 49eb91c588a2bab36647368e031dc5b66928149d
|
||||
F src/select.c fd4a7ce2937497181063cfedb92058ac89491a5d
|
||||
F src/shell.c 14ff7f660530a52b117d110ba3390b7b2eb719b6
|
||||
F src/sqlite.h.in 9984129d86243424b765fcb3f147c697bd20bb54
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
F src/sqlite3ext.h 98f72cbfe00169c39089115427d06ea05fe4b4a2
|
||||
F src/sqliteInt.h f4a53f3547dab80dc7db975fa1192d9bad1f38e8
|
||||
F src/sqliteInt.h 47a90c85a42210a05387051aaaa661f5c307703d
|
||||
F src/sqliteLimit.h c0373387c287c8d0932510b5547ecde31b5da247
|
||||
F src/status.c 70912d7be68e9e2dbc4010c93d344af61d4c59ba
|
||||
F src/table.c 5226df15ab9179b9ed558d89575ea0ce37b03fc9
|
||||
@@ -439,7 +439,7 @@ F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c
|
||||
F src/tokenize.c 3b29883b0ce4a6c6f643965b66b5ca6613178e59
|
||||
F src/treeview.c e4b41a37530a191579d3c53142cc44ee2eb99373
|
||||
F src/trigger.c e14840ee0c3e549e758ec9bf3e4146e166002280
|
||||
F src/update.c 3e67ab3c0814635f355fb1f8ab010a2b9e016e7d
|
||||
F src/update.c 4f05ea8cddfa367d045e03589756c02199e8f9bd
|
||||
F src/utf.c 699001c79f28e48e9bcdf8a463da029ea660540c
|
||||
F src/util.c 810ec3f22e2d1b62e66c30fe3621ebdedd23584d
|
||||
F src/vacuum.c feb1eabb20987983d9350cad98299b21fa811f52
|
||||
@@ -457,9 +457,9 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
|
||||
F src/wal.c 4db22ed7e77bcf672b1a685d6ddeffba8d5be302
|
||||
F src/wal.h 2f7c831cf3b071fa548bf2d5cac640846a7ff19c
|
||||
F src/walker.c 0f142b5bd3ed2041fc52d773880748b212e63354
|
||||
F src/where.c 019e5b10dedcf54ef077ce23dd8fce38d614dcf4
|
||||
F src/where.c ad8ad50ccf25795f6830b6b864bbfcd060ff08dd
|
||||
F src/whereInt.h 3b1fc240e322613ba4e9dc857ca9c7c3390acc74
|
||||
F src/wherecode.c 28951741be3974701186281ced0564e9586a0db3
|
||||
F src/wherecode.c d227fca7d766a10fe4ba4d812210f5631f5a98b3
|
||||
F src/whereexpr.c eacc0e60d029a082b4fc0cc42ea98544add1319e
|
||||
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
|
||||
F test/affinity2.test a6d901b436328bd67a79b41bb0ac2663918fe3bd
|
||||
@@ -847,7 +847,7 @@ F test/insert5.test 394f96728d1258f406fe5f5aeb0aaf29487c39a6
|
||||
F test/instr.test 737bbf80685232033f3abedc6ae92f75860b5dd2
|
||||
F test/intarray.test 066b7d7ac38d25bf96f87f1b017bfc687551cdd4
|
||||
F test/interrupt.test dfe9a67a94b0b2d8f70545ba1a6cca10780d71cc
|
||||
F test/intpkey.test 153b70e32d008f4f4b2dff8daf448a6110b62a9c
|
||||
F test/intpkey.test ac71107a49a06492b69b82aafaf225400598d3c8
|
||||
F test/io.test f95bca1783b01ea7761671560d023360d2dfa4cc
|
||||
F test/ioerr.test 2a24bd6ed5a8b062e64bfe1f6cf94fb25e92210d
|
||||
F test/ioerr2.test 2593563599e2cc6b6b4fcf5878b177bdd5d8df26
|
||||
@@ -1111,6 +1111,7 @@ F test/tableapi.test 2674633fa95d80da917571ebdd759a14d9819126
|
||||
F test/tableopts.test dba698ba97251017b7c80d738c198d39ab747930
|
||||
F test/tclsqlite.test e1306001a0ca92250b691ea6d3cecaca5b6342aa
|
||||
F test/tempdb.test bd92eba8f20e16a9136e434e20b280794de3cdb6
|
||||
F test/tempdb2.test 4fc92055f2a3f7626c0f2eabbb637dc021b311d5
|
||||
F test/tempfault.test 0c0d349c9a99bf5f374655742577f8712c647900
|
||||
F test/temptable.test d2c9b87a54147161bcd1822e30c1d1cd891e5b30
|
||||
F test/temptable2.test cd396beb41117a5302fff61767c35fa4270a0d5e
|
||||
@@ -1446,7 +1447,7 @@ F tool/showlocks.c 9920bcc64f58378ff1118caead34147201f48c68
|
||||
F tool/showstat4.c bda40d6e395df7edb6e9ea630784d3d762c35b4b
|
||||
F tool/showwal.c ec79959834f7b21f1e0a2aa52bb7c056d2203977
|
||||
F tool/soak1.tcl 8d407956e1a45b485a8e072470a3e629a27037fe
|
||||
F tool/spaceanal.tcl 93c1fdc9733c525b17a2024c7df193daa002e037
|
||||
F tool/spaceanal.tcl 85d90e6674d8298e3eaf82dbcef3abc2d5317f3e
|
||||
F tool/speedtest.tcl 06c76698485ccf597b9e7dbb1ac70706eb873355
|
||||
F tool/speedtest16.c ecb6542862151c3e6509bbc00509b234562ae81e
|
||||
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
||||
@@ -1486,10 +1487,10 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P 0715ce164333e27671efbec8796f238df98cc287
|
||||
R b2e26094738bdcbd727f209d6b0330cd
|
||||
T *branch * session-make
|
||||
T *sym-session-make *
|
||||
P 14e53d0e2f62d82ae1d64a72fd9711548e3bf5ea
|
||||
R 91f64055039542194e221b2aa9a3eada
|
||||
T *branch * dev
|
||||
T *sym-dev *
|
||||
T -sym-trunk *
|
||||
U drh
|
||||
Z 7002cda7adeb2152eae684546f496804
|
||||
Z 6a1a8543c69edff1da4c7cb6389abc41
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
e462cde2a50c39cc2f8d8624aada19280b8226eb
|
||||
da94a6e0ebacad8f235dcd653a25474327f26137
|
||||
+9
-8
@@ -592,16 +592,10 @@ void sqlite3DeleteColumnNames(sqlite3 *db, Table *pTable){
|
||||
** db parameter can be used with db->pnBytesFreed to measure the memory
|
||||
** used by the Table object.
|
||||
*/
|
||||
void sqlite3DeleteTable(sqlite3 *db, Table *pTable){
|
||||
static void SQLITE_NOINLINE deleteTable(sqlite3 *db, Table *pTable){
|
||||
Index *pIndex, *pNext;
|
||||
TESTONLY( int nLookaside; ) /* Used to verify lookaside not used for schema */
|
||||
|
||||
assert( !pTable || pTable->nRef>0 );
|
||||
|
||||
/* Do not delete the table until the reference count reaches zero. */
|
||||
if( !pTable ) 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. */
|
||||
@@ -641,6 +635,13 @@ void sqlite3DeleteTable(sqlite3 *db, Table *pTable){
|
||||
/* Verify that no lookaside memory was used by schema tables */
|
||||
assert( nLookaside==0 || nLookaside==db->lookaside.nOut );
|
||||
}
|
||||
void sqlite3DeleteTable(sqlite3 *db, Table *pTable){
|
||||
/* Do not delete the table until the reference count reaches zero. */
|
||||
if( !pTable ) return;
|
||||
if( ((!db || db->pnBytesFreed==0) && (--pTable->nRef)>0) ) return;
|
||||
deleteTable(db, pTable);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Unlink the given table from the hash tables and the delete the
|
||||
@@ -2221,7 +2222,7 @@ int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){
|
||||
pTable->nCol = 0;
|
||||
nErr++;
|
||||
}
|
||||
if( pSelTab ) sqlite3DeleteTable(db, pSelTab);
|
||||
sqlite3DeleteTable(db, pSelTab);
|
||||
sqlite3SelectDelete(db, pSel);
|
||||
db->lookaside.bDisable--;
|
||||
} else {
|
||||
|
||||
+3
-3
@@ -239,7 +239,7 @@ void sqlite3DeleteFrom(
|
||||
int addrBypass = 0; /* Address of jump over the delete logic */
|
||||
int addrLoop = 0; /* Top of the delete loop */
|
||||
int addrEphOpen = 0; /* Instruction to open the Ephemeral table */
|
||||
int bComplex; /* True if there are triggers or FKs or or
|
||||
int bComplex; /* True if there are triggers or FKs or
|
||||
** subqueries in the WHERE clause */
|
||||
|
||||
#ifndef SQLITE_OMIT_TRIGGER
|
||||
@@ -373,8 +373,8 @@ void sqlite3DeleteFrom(
|
||||
}else
|
||||
#endif /* SQLITE_OMIT_TRUNCATE_OPTIMIZATION */
|
||||
{
|
||||
u16 wcf = WHERE_ONEPASS_DESIRED|WHERE_DUPLICATES_OK;
|
||||
if( pWhere && ExprHasProperty(pWhere, EP_Subquery) ) bComplex = 1;
|
||||
u16 wcf = WHERE_ONEPASS_DESIRED|WHERE_DUPLICATES_OK|WHERE_SEEK_TABLE;
|
||||
if( sNC.ncFlags & NC_VarSelect ) bComplex = 1;
|
||||
wcf |= (bComplex ? 0 : WHERE_ONEPASS_MULTIROW);
|
||||
if( HasRowid(pTab) ){
|
||||
/* For a rowid table, initialize the RowSet to an empty set */
|
||||
|
||||
+7
-1
@@ -6008,10 +6008,16 @@ int sqlite3PagerIswriteable(DbPage *pPg){
|
||||
**
|
||||
** Tests show that this optimization can quadruple the speed of large
|
||||
** DELETE operations.
|
||||
**
|
||||
** This optimization cannot be used with a temp-file, as the page may
|
||||
** have been dirty at the start of the transaction. In that case, if
|
||||
** memory pressure forces page pPg out of the cache, the data does need
|
||||
** to be written out to disk so that it may be read back in if the
|
||||
** current transaction is rolled back.
|
||||
*/
|
||||
void sqlite3PagerDontWrite(PgHdr *pPg){
|
||||
Pager *pPager = pPg->pPager;
|
||||
if( (pPg->flags&PGHDR_DIRTY) && pPager->nSavepoint==0 ){
|
||||
if( !pPager->tempFile && (pPg->flags&PGHDR_DIRTY) && pPager->nSavepoint==0 ){
|
||||
PAGERTRACE(("DONT_WRITE page %d of %d\n", pPg->pgno, PAGERID(pPager)));
|
||||
IOTRACE(("CLEAN %p %d\n", pPager, pPg->pgno))
|
||||
pPg->flags |= PGHDR_DONT_WRITE;
|
||||
|
||||
+18
-18
@@ -15,26 +15,26 @@
|
||||
** Conversion types fall into various categories as defined by the
|
||||
** following enumeration.
|
||||
*/
|
||||
#define etRADIX 1 /* Integer types. %d, %x, %o, and so forth */
|
||||
#define etFLOAT 2 /* Floating point. %f */
|
||||
#define etEXP 3 /* Exponentional notation. %e and %E */
|
||||
#define etGENERIC 4 /* Floating or exponential, depending on exponent. %g */
|
||||
#define etSIZE 5 /* Return number of characters processed so far. %n */
|
||||
#define etSTRING 6 /* Strings. %s */
|
||||
#define etDYNSTRING 7 /* Dynamically allocated strings. %z */
|
||||
#define etPERCENT 8 /* Percent symbol. %% */
|
||||
#define etCHARX 9 /* Characters. %c */
|
||||
#define etRADIX 0 /* Integer types. %d, %x, %o, and so forth */
|
||||
#define etFLOAT 1 /* Floating point. %f */
|
||||
#define etEXP 2 /* Exponentional notation. %e and %E */
|
||||
#define etGENERIC 3 /* Floating or exponential, depending on exponent. %g */
|
||||
#define etSIZE 4 /* Return number of characters processed so far. %n */
|
||||
#define etSTRING 5 /* Strings. %s */
|
||||
#define etDYNSTRING 6 /* Dynamically allocated strings. %z */
|
||||
#define etPERCENT 7 /* Percent symbol. %% */
|
||||
#define etCHARX 8 /* Characters. %c */
|
||||
/* The rest are extensions, not normally found in printf() */
|
||||
#define etSQLESCAPE 10 /* Strings with '\'' doubled. %q */
|
||||
#define etSQLESCAPE2 11 /* Strings with '\'' doubled and enclosed in '',
|
||||
#define etSQLESCAPE 9 /* Strings with '\'' doubled. %q */
|
||||
#define etSQLESCAPE2 10 /* Strings with '\'' doubled and enclosed in '',
|
||||
NULL pointers replaced by SQL NULL. %Q */
|
||||
#define etTOKEN 12 /* a pointer to a Token structure */
|
||||
#define etSRCLIST 13 /* a pointer to a SrcList */
|
||||
#define etPOINTER 14 /* The %p conversion */
|
||||
#define etSQLESCAPE3 15 /* %w -> Strings with '\"' doubled */
|
||||
#define etORDINAL 16 /* %r -> 1st, 2nd, 3rd, 4th, etc. English only */
|
||||
#define etTOKEN 11 /* a pointer to a Token structure */
|
||||
#define etSRCLIST 12 /* a pointer to a SrcList */
|
||||
#define etPOINTER 13 /* The %p conversion */
|
||||
#define etSQLESCAPE3 14 /* %w -> Strings with '\"' doubled */
|
||||
#define etORDINAL 15 /* %r -> 1st, 2nd, 3rd, 4th, etc. English only */
|
||||
|
||||
#define etINVALID 0 /* Any unrecognized conversion type */
|
||||
#define etINVALID 16 /* Any unrecognized conversion type */
|
||||
|
||||
|
||||
/*
|
||||
@@ -189,7 +189,7 @@ void sqlite3VXPrintf(
|
||||
etByte flag_long; /* True if "l" flag is present */
|
||||
etByte flag_longlong; /* True if the "ll" flag is present */
|
||||
etByte done; /* Loop termination flag */
|
||||
etByte xtype = 0; /* Conversion paradigm */
|
||||
etByte xtype = etINVALID; /* Conversion paradigm */
|
||||
u8 bArgList; /* True for SQLITE_PRINTF_SQLFUNC */
|
||||
u8 useIntern; /* Ok to use internal conversions (ex: %T) */
|
||||
char prefix; /* Prefix character. "+" or "-" or " " or '\0'. */
|
||||
|
||||
@@ -763,6 +763,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
|
||||
assert( pNC->nRef>=nRef );
|
||||
if( nRef!=pNC->nRef ){
|
||||
ExprSetProperty(pExpr, EP_VarSelect);
|
||||
pNC->ncFlags |= NC_VarSelect;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
+3
-1
@@ -2540,9 +2540,10 @@ struct SrcList {
|
||||
#define WHERE_DISTINCTBY 0x0200 /* pOrderby is really a DISTINCT clause */
|
||||
#define WHERE_WANT_DISTINCT 0x0400 /* All output needs to be distinct */
|
||||
#define WHERE_SORTBYGROUP 0x0800 /* Support sqlite3WhereIsSorted() */
|
||||
#define WHERE_REOPEN_IDX 0x1000 /* Try to use OP_ReopenIdx */
|
||||
/* 0x1000 not currently used */
|
||||
#define WHERE_ONEPASS_MULTIROW 0x2000 /* ONEPASS is ok with multiple rows */
|
||||
#define WHERE_USE_LIMIT 0x4000 /* There is a constant LIMIT clause */
|
||||
#define WHERE_SEEK_TABLE 0x8000 /* Do not defer seeks on main table */
|
||||
|
||||
/* Allowed return values from sqlite3WhereIsDistinct()
|
||||
*/
|
||||
@@ -2597,6 +2598,7 @@ struct NameContext {
|
||||
#define NC_InAggFunc 0x0008 /* True if analyzing arguments to an agg func */
|
||||
#define NC_HasAgg 0x0010 /* One or more aggregate functions seen */
|
||||
#define NC_IdxExpr 0x0020 /* True if resolving columns of CREATE INDEX */
|
||||
#define NC_VarSelect 0x0040 /* A correlated subquery has been seen */
|
||||
#define NC_MinMaxAgg 0x1000 /* min/max aggregates seen. See note above */
|
||||
|
||||
/*
|
||||
|
||||
+2
-1
@@ -352,7 +352,8 @@ void sqlite3Update(
|
||||
if( HasRowid(pTab) ){
|
||||
sqlite3VdbeAddOp3(v, OP_Null, 0, regRowSet, regOldRowid);
|
||||
pWInfo = sqlite3WhereBegin(
|
||||
pParse, pTabList, pWhere, 0, 0, WHERE_ONEPASS_DESIRED, iIdxCur
|
||||
pParse, pTabList, pWhere, 0, 0,
|
||||
WHERE_ONEPASS_DESIRED | WHERE_SEEK_TABLE, iIdxCur
|
||||
);
|
||||
if( pWInfo==0 ) goto update_cleanup;
|
||||
okOnePass = sqlite3WhereOkOnePass(pWInfo, aiCurOnePass);
|
||||
|
||||
+10
-6
@@ -261,7 +261,10 @@ static WhereTerm *whereScanNext(WhereScan *pScan){
|
||||
**
|
||||
** The scanner will be searching the WHERE clause pWC. It will look
|
||||
** for terms of the form "X <op> <expr>" where X is column iColumn of table
|
||||
** iCur. The <op> must be one of the operators described by opMask.
|
||||
** iCur. Or if pIdx!=0 then X is column iColumn of index pIdx. pIdx
|
||||
** must be one of the indexes of table iCur.
|
||||
**
|
||||
** The <op> must be one of the operators described by opMask.
|
||||
**
|
||||
** If the search is for X and the WHERE clause contains terms of the
|
||||
** form X=Y then this routine might also return terms of the form
|
||||
@@ -309,11 +312,12 @@ static WhereTerm *whereScanInit(
|
||||
|
||||
/*
|
||||
** Search for a term in the WHERE clause that is of the form "X <op> <expr>"
|
||||
** where X is a reference to the iColumn of table iCur and <op> is one of
|
||||
** the WO_xx operator codes specified by the op parameter.
|
||||
** Return a pointer to the term. Return 0 if not found.
|
||||
** where X is a reference to the iColumn of table iCur or of index pIdx
|
||||
** if pIdx!=0 and <op> is one of the WO_xx operator codes specified by
|
||||
** the op parameter. Return a pointer to the term. Return 0 if not found.
|
||||
**
|
||||
** If pIdx!=0 then search for terms matching the iColumn-th column of pIdx
|
||||
** If pIdx!=0 then it must be one of the indexes of table iCur.
|
||||
** Search for terms matching the iColumn-th column of pIdx
|
||||
** rather than the iColumn-th column of table iCur.
|
||||
**
|
||||
** The term returned might by Y=<expr> if there is another constraint in
|
||||
@@ -4475,7 +4479,7 @@ WhereInfo *sqlite3WhereBegin(
|
||||
pWInfo->aiCurOnePass[1] = iIndexCur;
|
||||
}else if( iAuxArg && (wctrlFlags & WHERE_ONETABLE_ONLY)!=0 ){
|
||||
iIndexCur = iAuxArg;
|
||||
if( wctrlFlags & WHERE_REOPEN_IDX ) op = OP_ReopenIdx;
|
||||
op = OP_ReopenIdx;
|
||||
}else{
|
||||
iIndexCur = pParse->nTab++;
|
||||
}
|
||||
|
||||
+3
-3
@@ -1324,7 +1324,7 @@ Bitmask sqlite3WhereCodeOneLoopStart(
|
||||
if( omitTable ){
|
||||
/* pIdx is a covering index. No need to access the main table. */
|
||||
}else if( HasRowid(pIdx->pTable) ){
|
||||
if( pWInfo->eOnePass!=ONEPASS_OFF ){
|
||||
if( (pWInfo->wctrlFlags & WHERE_SEEK_TABLE)!=0 ){
|
||||
iRowidReg = ++pParse->nMem;
|
||||
sqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur, iRowidReg);
|
||||
sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg);
|
||||
@@ -1520,7 +1520,8 @@ Bitmask sqlite3WhereCodeOneLoopStart(
|
||||
wctrlFlags = WHERE_OMIT_OPEN_CLOSE
|
||||
| WHERE_FORCE_TABLE
|
||||
| WHERE_ONETABLE_ONLY
|
||||
| WHERE_NO_AUTOINDEX;
|
||||
| WHERE_NO_AUTOINDEX
|
||||
| (pWInfo->wctrlFlags & WHERE_SEEK_TABLE);
|
||||
for(ii=0; ii<pOrWc->nTerm; ii++){
|
||||
WhereTerm *pOrTerm = &pOrWc->a[ii];
|
||||
if( pOrTerm->leftCursor==iCur || (pOrTerm->eOperator & WO_AND)!=0 ){
|
||||
@@ -1628,7 +1629,6 @@ Bitmask sqlite3WhereCodeOneLoopStart(
|
||||
){
|
||||
assert( pSubWInfo->a[0].iIdxCur==iCovCur );
|
||||
pCov = pSubLoop->u.btree.pIndex;
|
||||
wctrlFlags |= WHERE_REOPEN_IDX;
|
||||
}else{
|
||||
pCov = 0;
|
||||
}
|
||||
|
||||
+27
-1
@@ -614,6 +614,32 @@ do_execsql_test intpkey-16.1 {
|
||||
PRAGMA table_info=t16a;
|
||||
} {0 id INTEGER 0 {} 1 1 b TEXT 0 {} 0 2 c INT 0 {} 0}
|
||||
|
||||
|
||||
# 2016-05-06 ticket https://www.sqlite.org/src/tktview/16c9801ceba4923939085
|
||||
# When the schema contains an index on the IPK and no other index
|
||||
# and a WHERE clause on a delete uses an OR where both sides referencing
|
||||
# the IPK, then it is possible that the OP_Delete will fail because there
|
||||
# deferred seek of the OP_Seek is not resolved prior to reaching the OP_Delete.
|
||||
#
|
||||
do_execsql_test intpkey-17.0 {
|
||||
CREATE TABLE t17(x INTEGER PRIMARY KEY, y TEXT);
|
||||
INSERT INTO t17(x,y) VALUES(123,'elephant'),(248,'giraffe');
|
||||
CREATE INDEX t17x ON t17(x);
|
||||
DELETE FROM t17 WHERE x=99 OR x<130;
|
||||
SELECT * FROM t17;
|
||||
} {248 giraffe}
|
||||
do_execsql_test intpkey-17.1 {
|
||||
DROP INDEX t17x;
|
||||
DELETE FROM t17;
|
||||
INSERT INTO t17(x,y) VALUES(123,'elephant'),(248,'giraffe');
|
||||
CREATE UNIQUE INDEX t17x ON t17(abs(x));
|
||||
DELETE FROM t17 WHERE abs(x) IS NULL OR abs(x)<130;
|
||||
SELECT * FROM t17;
|
||||
} {248 giraffe}
|
||||
do_execsql_test intpkey-17.2 {
|
||||
DELETE FROM t17;
|
||||
INSERT INTO t17(x,y) VALUES(123,'elephant'),(248,'giraffe');
|
||||
UPDATE t17 SET y='ostrich' WHERE abs(x)=248;
|
||||
SELECT * FROM t17 ORDER BY +x;
|
||||
} {123 elephant 248 ostrich}
|
||||
|
||||
finish_test
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
# 2016 March 3
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
set testprefix tempdb2
|
||||
|
||||
db close
|
||||
sqlite3 db ""
|
||||
|
||||
proc int2str {i} { string range [string repeat "$i." 450] 0 899 }
|
||||
db func int2str int2str
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# 1.1: Write a big transaction to the db. One so large that it forces
|
||||
# the file to be created and the cache flushed to disk on COMMIT.
|
||||
#
|
||||
# 1.2: Write a small transaction - one small enough that it remains in
|
||||
# memory on COMMIT. All the pages of table [t1] are now dirty.
|
||||
#
|
||||
# 1.3: Delete the contents of [t1]. This moves all of its leaves to the
|
||||
# free-list and causes the btree layer to call PagerDontWrite() on
|
||||
# each of them.
|
||||
#
|
||||
# Then do a big update on table [t2]. So big that the former leaves
|
||||
# of [t1] are forced out of the cache. Then roll back the transaction.
|
||||
# If the PagerDontWrite() calls are honoured and the data is not written
|
||||
# to disk, the update made in test 1.2 will be lost at this point. Or, if
|
||||
# they are ignored (as they should be for temp databases), the update
|
||||
# will be safely written out to disk before the cache entries are
|
||||
# discarded.
|
||||
#
|
||||
do_execsql_test 1.1 {
|
||||
PRAGMA page_size=1024;
|
||||
PRAGMA cache_size=50;
|
||||
|
||||
BEGIN;
|
||||
CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
|
||||
INSERT INTO t1 VALUES(1, int2str(1));
|
||||
INSERT INTO t1 VALUES(2, int2str(1));
|
||||
INSERT INTO t1 VALUES(3, int2str(1));
|
||||
|
||||
CREATE TABLE t2(a INTEGER PRIMARY KEY, b);
|
||||
WITH c(x) AS ( VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<100 )
|
||||
INSERT INTO t2 SELECT x, int2str(x) FROM c;
|
||||
COMMIT;
|
||||
|
||||
PRAGMA lock_status;
|
||||
} {main unlocked temp closed}
|
||||
|
||||
do_execsql_test 1.2 {
|
||||
UPDATE t1 SET b=int2str(2);
|
||||
SELECT b=int2str(2) FROM t1
|
||||
} {1 1 1}
|
||||
|
||||
do_execsql_test 1.3 {
|
||||
BEGIN;
|
||||
DELETE FROM t1;
|
||||
UPDATE t2 SET b=int2str(a+1);
|
||||
ROLLBACK;
|
||||
}
|
||||
|
||||
do_execsql_test 1.4 {
|
||||
SELECT b=int2str(2) FROM t1
|
||||
} {1 1 1}
|
||||
|
||||
finish_test
|
||||
|
||||
+13
-8
@@ -152,6 +152,7 @@ set tabledef {CREATE TABLE space_used(
|
||||
name clob, -- Name of a table or index in the database file
|
||||
tblname clob, -- Name of associated table
|
||||
is_index boolean, -- TRUE if it is an index, false for a table
|
||||
is_without_rowid boolean, -- TRUE if WITHOUT ROWID table
|
||||
nentry int, -- Number of entries in the BTree
|
||||
leaf_entries int, -- Number of leaf entries
|
||||
depth int, -- Depth of the b-tree
|
||||
@@ -184,7 +185,7 @@ set sql { SELECT name, tbl_name FROM sqlite_master WHERE rootpage>0 }
|
||||
foreach {name tblname} [concat sqlite_master sqlite_master [db eval $sql]] {
|
||||
|
||||
set is_index [expr {$name!=$tblname}]
|
||||
set idx_btree [expr {$is_index || [is_without_rowid $name]}]
|
||||
set is_without_rowid [is_without_rowid $name]
|
||||
db eval {
|
||||
SELECT
|
||||
sum(ncell) AS nentry,
|
||||
@@ -235,6 +236,7 @@ foreach {name tblname} [concat sqlite_master sqlite_master [db eval $sql]] {
|
||||
$name,
|
||||
$tblname,
|
||||
$is_index,
|
||||
$is_without_rowid,
|
||||
$nentry,
|
||||
$leaf_entries,
|
||||
$depth,
|
||||
@@ -330,12 +332,15 @@ proc subreport {title where showFrag} {
|
||||
# following query returns exactly one row (because it is an aggregate).
|
||||
#
|
||||
# The results of the query are stored directly by SQLite into local
|
||||
# variables (i.e. $nentry, $nleaf etc.).
|
||||
# variables (i.e. $nentry, $payload etc.).
|
||||
#
|
||||
mem eval "
|
||||
SELECT
|
||||
int(sum(nentry)) AS nentry,
|
||||
int(sum(leaf_entries)) AS nleaf,
|
||||
int(sum(
|
||||
CASE WHEN (is_without_rowid OR is_index) THEN nentry
|
||||
ELSE leaf_entries
|
||||
END
|
||||
)) AS nentry,
|
||||
int(sum(payload)) AS payload,
|
||||
int(sum(ovfl_payload)) AS ovfl_payload,
|
||||
max(mx_payload) AS mx_payload,
|
||||
@@ -375,8 +380,8 @@ proc subreport {title where showFrag} {
|
||||
set storage [expr {$total_pages*$pageSize}]
|
||||
set payload_percent [percent $payload $storage {of storage consumed}]
|
||||
set total_unused [expr {$ovfl_unused+$int_unused+$leaf_unused}]
|
||||
set avg_payload [divide $payload $nleaf]
|
||||
set avg_unused [divide $total_unused $nleaf]
|
||||
set avg_payload [divide $payload $nentry]
|
||||
set avg_unused [divide $total_unused $nentry]
|
||||
if {$int_pages>0} {
|
||||
# TODO: Is this formula correct?
|
||||
set nTab [mem eval "
|
||||
@@ -390,12 +395,12 @@ proc subreport {title where showFrag} {
|
||||
"]
|
||||
set avg_fanout [format %.2f $avg_fanout]
|
||||
}
|
||||
set ovfl_cnt_percent [percent $ovfl_cnt $nleaf {of all entries}]
|
||||
set ovfl_cnt_percent [percent $ovfl_cnt $nentry {of all entries}]
|
||||
|
||||
# Print out the sub-report statistics.
|
||||
#
|
||||
statline {Percentage of total database} $total_pages_percent
|
||||
statline {Number of entries} $nleaf
|
||||
statline {Number of entries} $nentry
|
||||
statline {Bytes of storage consumed} $storage
|
||||
if {$compressed_size!=$storage} {
|
||||
set compressed_size [expr {$compressed_size+$compressOverhead*$total_pages}]
|
||||
|
||||
Reference in New Issue
Block a user