1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-22 20:22:44 +03:00

Merge in all trunk changes up through the 3.7.17 release.

FossilOrigin-Name: 14ab6675e5eab3761256a06dad23d2b11220788a
This commit is contained in:
drh
2013-05-20 15:14:42 +00:00
33 changed files with 695 additions and 123 deletions

View File

@@ -411,6 +411,7 @@ TESTSRC2 = \
$(TOP)/src/func.c \ $(TOP)/src/func.c \
$(TOP)/src/insert.c \ $(TOP)/src/insert.c \
$(TOP)/src/wal.c \ $(TOP)/src/wal.c \
$(TOP)/src/main.c \
$(TOP)/src/mem5.c \ $(TOP)/src/mem5.c \
$(TOP)/src/os.c \ $(TOP)/src/os.c \
$(TOP)/src/os_unix.c \ $(TOP)/src/os_unix.c \
@@ -869,8 +870,8 @@ fts3_tokenizer.lo: $(TOP)/ext/fts3/fts3_tokenizer.c $(HDR) $(EXTHDR)
fts3_tokenizer1.lo: $(TOP)/ext/fts3/fts3_tokenizer1.c $(HDR) $(EXTHDR) fts3_tokenizer1.lo: $(TOP)/ext/fts3/fts3_tokenizer1.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_tokenizer1.c $(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_tokenizer1.c
fts3_tokenizer_vtab.lo: $(TOP)/ext/fts3/fts3_tokenizer_vtab.c $(HDR) $(EXTHDR) fts3_tokenize_vtab.lo: $(TOP)/ext/fts3/fts3_tokenize_vtab.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_tokenizer_vtab.c $(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_tokenize_vtab.c
fts3_unicode.lo: $(TOP)/ext/fts3/fts3_unicode.c $(HDR) $(EXTHDR) fts3_unicode.lo: $(TOP)/ext/fts3/fts3_unicode.c $(HDR) $(EXTHDR)
$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_unicode.c $(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_unicode.c

View File

@@ -732,6 +732,7 @@ TESTSRC2 = \
$(TOP)\src\func.c \ $(TOP)\src\func.c \
$(TOP)\src\insert.c \ $(TOP)\src\insert.c \
$(TOP)\src\wal.c \ $(TOP)\src\wal.c \
$(TOP)\src\main.c \
$(TOP)\src\mem5.c \ $(TOP)\src\mem5.c \
$(TOP)\src\os.c \ $(TOP)\src\os.c \
$(TOP)\src\os_unix.c \ $(TOP)\src\os_unix.c \

View File

@@ -164,6 +164,8 @@ SQLITE_EXTENSION_INIT1
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#ifndef SQLITE_OMIT_VIRTUALTABLE
/* /*
** Forward declaration of objects used by this implementation ** Forward declaration of objects used by this implementation
*/ */
@@ -1458,6 +1460,8 @@ static sqlite3_module amatchModule = {
0 /* xRollbackTo */ 0 /* xRollbackTo */
}; };
#endif /* SQLITE_OMIT_VIRTUALTABLE */
/* /*
** Register the amatch virtual table ** Register the amatch virtual table
*/ */
@@ -1472,6 +1476,8 @@ int sqlite3_amatch_init(
int rc = SQLITE_OK; int rc = SQLITE_OK;
SQLITE_EXTENSION_INIT2(pApi); SQLITE_EXTENSION_INIT2(pApi);
(void)pzErrMsg; /* Not used */ (void)pzErrMsg; /* Not used */
#ifndef SQLITE_OMIT_VIRTUALTABLE
rc = sqlite3_create_module(db, "approximate_match", &amatchModule, 0); rc = sqlite3_create_module(db, "approximate_match", &amatchModule, 0);
#endif /* SQLITE_OMIT_VIRTUALTABLE */
return rc; return rc;
} }

View File

@@ -148,6 +148,8 @@ SQLITE_EXTENSION_INIT1
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#ifndef SQLITE_OMIT_VIRTUALTABLE
/* /*
** Forward declaration of objects used by this implementation ** Forward declaration of objects used by this implementation
*/ */
@@ -923,6 +925,8 @@ static sqlite3_module closureModule = {
0 /* xRollbackTo */ 0 /* xRollbackTo */
}; };
#endif /* SQLITE_OMIT_VIRTUALTABLE */
/* /*
** Register the closure virtual table ** Register the closure virtual table
*/ */
@@ -937,6 +941,8 @@ int sqlite3_closure_init(
int rc = SQLITE_OK; int rc = SQLITE_OK;
SQLITE_EXTENSION_INIT2(pApi); SQLITE_EXTENSION_INIT2(pApi);
(void)pzErrMsg; (void)pzErrMsg;
#ifndef SQLITE_OMIT_VIRTUALTABLE
rc = sqlite3_create_module(db, "transitive_closure", &closureModule, 0); rc = sqlite3_create_module(db, "transitive_closure", &closureModule, 0);
#endif /* SQLITE_OMIT_VIRTUALTABLE */
return rc; return rc;
} }

View File

@@ -1166,6 +1166,8 @@ int sqlite3_fuzzer_init(
){ ){
int rc = SQLITE_OK; int rc = SQLITE_OK;
SQLITE_EXTENSION_INIT2(pApi); SQLITE_EXTENSION_INIT2(pApi);
#ifndef SQLITE_OMIT_VIRTUALTABLE
rc = sqlite3_create_module(db, "fuzzer", &fuzzerModule, 0); rc = sqlite3_create_module(db, "fuzzer", &fuzzerModule, 0);
#endif
return rc; return rc;
} }

114
ext/misc/rot13.c Normal file
View File

@@ -0,0 +1,114 @@
/*
** 2013-05-15
**
** 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 SQLite extension implements a rot13() function and a rot13
** collating sequence.
*/
#include "sqlite3ext.h"
SQLITE_EXTENSION_INIT1
#include <assert.h>
#include <string.h>
/*
** Perform rot13 encoding on a single ASCII character.
*/
static unsigned char rot13(unsigned char c){
if( c>='a' && c<='z' ){
c += 13;
if( c>'z' ) c -= 26;
}else if( c>='A' && c<='Z' ){
c += 13;
if( c>'Z' ) c -= 26;
}
return c;
}
/*
** Implementation of the rot13() function.
**
** Rotate ASCII alphabetic characters by 13 character positions.
** Non-ASCII characters are unchanged. rot13(rot13(X)) should always
** equal X.
*/
static void rot13func(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
const unsigned char *zIn;
int nIn;
unsigned char *zOut;
char *zToFree = 0;
int i;
char zTemp[100];
assert( argc==1 );
if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
zIn = (const unsigned char*)sqlite3_value_text(argv[0]);
nIn = sqlite3_value_bytes(argv[0]);
if( nIn<sizeof(zTemp)-1 ){
zOut = zTemp;
}else{
zOut = zToFree = sqlite3_malloc( nIn+1 );
if( zOut==0 ){
sqlite3_result_error_nomem(context);
return;
}
}
for(i=0; i<nIn; i++) zOut[i] = rot13(zIn[i]);
zOut[i] = 0;
sqlite3_result_text(context, (char*)zOut, i, SQLITE_TRANSIENT);
sqlite3_free(zToFree);
}
/*
** Implement the rot13 collating sequence so that if
**
** x=y COLLATE rot13
**
** Then
**
** rot13(x)=rot13(y) COLLATE binary
*/
static int rot13CollFunc(
void *notUsed,
int nKey1, const void *pKey1,
int nKey2, const void *pKey2
){
const char *zA = (const char*)pKey1;
const char *zB = (const char*)pKey2;
int i, x;
for(i=0; i<nKey1 && i<nKey2; i++){
x = (int)rot13(zA[i]) - (int)rot13(zB[i]);
if( x!=0 ) return x;
}
return nKey1 - nKey2;
}
#ifdef _WIN32
__declspec(dllexport)
#endif
int sqlite3_rot_init(
sqlite3 *db,
char **pzErrMsg,
const sqlite3_api_routines *pApi
){
int rc = SQLITE_OK;
SQLITE_EXTENSION_INIT2(pApi);
(void)pzErrMsg; /* Unused parameter */
rc = sqlite3_create_function(db, "rot13", 1, SQLITE_UTF8, 0,
rot13func, 0, 0);
if( rc==SQLITE_OK ){
rc = sqlite3_create_collation(db, "rot13", SQLITE_UTF8, 0, rot13CollFunc);
}
return rc;
}

View File

@@ -29,6 +29,8 @@ SQLITE_EXTENSION_INIT1
# include <ctype.h> # include <ctype.h>
#endif #endif
#ifndef SQLITE_OMIT_VIRTUALTABLE
/* /*
** Character classes for ASCII characters: ** Character classes for ASCII characters:
** **
@@ -2821,6 +2823,8 @@ static int spellfix1Register(sqlite3 *db){
return rc; return rc;
} }
#endif /* SQLITE_OMIT_VIRTUALTABLE */
/* /*
** Extension load function. ** Extension load function.
*/ */
@@ -2833,5 +2837,8 @@ int sqlite3_spellfix_init(
const sqlite3_api_routines *pApi const sqlite3_api_routines *pApi
){ ){
SQLITE_EXTENSION_INIT2(pApi); SQLITE_EXTENSION_INIT2(pApi);
#ifndef SQLITE_OMIT_VIRTUALTABLE
return spellfix1Register(db); return spellfix1Register(db);
#endif
return SQLITE_OK;
} }

View File

@@ -293,6 +293,7 @@ TESTSRC2 = \
$(TOP)/src/func.c \ $(TOP)/src/func.c \
$(TOP)/src/insert.c \ $(TOP)/src/insert.c \
$(TOP)/src/wal.c \ $(TOP)/src/wal.c \
$(TOP)/src/main.c \
$(TOP)/src/mem5.c \ $(TOP)/src/mem5.c \
$(TOP)/src/os.c \ $(TOP)/src/os.c \
$(TOP)/src/os_unix.c \ $(TOP)/src/os_unix.c \

View File

@@ -1,9 +1,9 @@
C First\sattempt\sto\sget\sORDER\sBY\soptimization\sworking\sin\sNGQP. C Merge\sin\sall\strunk\schanges\sup\sthrough\sthe\s3.7.17\srelease.
D 2013-05-14T15:31:07.121 D 2013-05-20T15:14:42.009
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in ce81671efd6223d19d4c8c6b88ac2c4134427111 F Makefile.in f6b58b7bdf6535f0f0620c486dd59aa4662c0b4f
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F Makefile.msc 8f4ee0dab220a5276d5da61149dfd6cd5d1dd5b8 F Makefile.msc 5dc042f51187414d5886ac6d8308630d484690c4
F Makefile.vxworks db21ed42a01d5740e656b16f92cb5d8d5e5dd315 F Makefile.vxworks db21ed42a01d5740e656b16f92cb5d8d5e5dd315
F README cd04a36fbc7ea56932a4052d7d0b7f09f27c33d6 F README cd04a36fbc7ea56932a4052d7d0b7f09f27c33d6
F VERSION 05c7bd63b96f31cfdef5c766ed91307ac121f5aa F VERSION 05c7bd63b96f31cfdef5c766ed91307ac121f5aa
@@ -83,13 +83,14 @@ F ext/fts3/unicode/mkunicode.tcl 7a9bc018e2962abb79563c5a39fe581fcbf2f675
F ext/icu/README.txt d9fbbad0c2f647c3fdf715fc9fd64af53aedfc43 F ext/icu/README.txt d9fbbad0c2f647c3fdf715fc9fd64af53aedfc43
F ext/icu/icu.c eb9ae1d79046bd7871aa97ee6da51eb770134b5a F ext/icu/icu.c eb9ae1d79046bd7871aa97ee6da51eb770134b5a
F ext/icu/sqliteicu.h 728867a802baa5a96de7495e9689a8e01715ef37 F ext/icu/sqliteicu.h 728867a802baa5a96de7495e9689a8e01715ef37
F ext/misc/amatch.c 3369b2b544066e620d986f0085d039c77d1ef17f F ext/misc/amatch.c eae8454cd9dcb287b2a3ec2e65a865a4ac5f0d06
F ext/misc/closure.c fec0c8537c69843e0b7631d500a14c0527962cd6 F ext/misc/closure.c 40788c54c59190a1f52f6492a260d8894a246fe9
F ext/misc/fuzzer.c fb64a15af978ae73fa9075b9b1dfbe82b8defc6f F ext/misc/fuzzer.c 51bd96960b6b077d41d6f3cedefbcb57f29efaa2
F ext/misc/ieee754.c 2565ce373d842977efe0922dc50b8a41b3289556 F ext/misc/ieee754.c 2565ce373d842977efe0922dc50b8a41b3289556
F ext/misc/nextchar.c 1131e2b36116ffc6fe6b2e3464bfdace27978b1e F ext/misc/nextchar.c 1131e2b36116ffc6fe6b2e3464bfdace27978b1e
F ext/misc/regexp.c c25c65fe775f5d9801fb8573e36ebe73f2c0c2e0 F ext/misc/regexp.c c25c65fe775f5d9801fb8573e36ebe73f2c0c2e0
F ext/misc/spellfix.c f9d24a2b2617cee143b7841b453e4e1fd8f189cc F ext/misc/rot13.c 1ac6f95f99b575907b9b09c81a349114cf9be45a
F ext/misc/spellfix.c 6d7ce6105a4b7729f6c44ccdf1ab7e80d9707c02
F ext/misc/wholenumber.c 784b12543d60702ebdd47da936e278aa03076212 F ext/misc/wholenumber.c 784b12543d60702ebdd47da936e278aa03076212
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761 F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
F ext/rtree/rtree.c 757abea591d4ff67c0ff4e8f9776aeda86b18c14 F ext/rtree/rtree.c 757abea591d4ff67c0ff4e8f9776aeda86b18c14
@@ -113,7 +114,7 @@ F ext/rtree/viewrtree.tcl eea6224b3553599ae665b239bd827e182b466024
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
F magic.txt 3f820e18c43504b25da40ff4b4cdb66dc4c4907e F magic.txt 3f820e18c43504b25da40ff4b4cdb66dc4c4907e
F main.mk 1b25be82452366abc27cc9ab2acf3244a773d5a1 F main.mk a8ebdf910e2cc10db1f9f54ec316f637458e8001
F mkdll.sh 7d09b23c05d56532e9d44a50868eb4b12ff4f74a F mkdll.sh 7d09b23c05d56532e9d44a50868eb4b12ff4f74a
F mkextu.sh 416f9b7089d80e5590a29692c9d9280a10dbad9f F mkextu.sh 416f9b7089d80e5590a29692c9d9280a10dbad9f
F mkextw.sh 4123480947681d9b434a5e7b1ee08135abe409ac F mkextw.sh 4123480947681d9b434a5e7b1ee08135abe409ac
@@ -122,10 +123,10 @@ F mkopcodeh.awk 29b84656502eee5f444c3147f331ee686956ab0e
F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83 F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83
F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504
F mptest/crash01.test a5f31998ed48de8267d6620e8af107ec148e5f12 F mptest/crash01.test cce8e306d8596d5a2e497e27112dae1f6e5e3538
F mptest/crash02.subtest f4ef05adcd15d60e5d2bd654204f2c008b519df8 F mptest/crash02.subtest f4ef05adcd15d60e5d2bd654204f2c008b519df8
F mptest/mptest.c 499a74af4be293b7c1c7c3d40f332b67227dd739 F mptest/mptest.c 499a74af4be293b7c1c7c3d40f332b67227dd739
F mptest/multiwrite01.test 81fbc17657964889b60750bd7bbb1deffe8f4d42 F mptest/multiwrite01.test 499ad0310da8dff8e8f98d2e272fc2a8aa741b2e
F spec.template 86a4a43b99ebb3e75e6b9a735d5fd293a24e90ca F spec.template 86a4a43b99ebb3e75e6b9a735d5fd293a24e90ca
F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
F sqlite3.1 6be1ad09113570e1fc8dcaff84c9b0b337db5ffc F sqlite3.1 6be1ad09113570e1fc8dcaff84c9b0b337db5ffc
@@ -137,16 +138,16 @@ F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34
F src/backup.c b266767351ae2d847716c56fcb2a1fea7c761c03 F src/backup.c b266767351ae2d847716c56fcb2a1fea7c761c03
F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb
F src/btmutex.c 976f45a12e37293e32cae0281b15a21d48a8aaa7 F src/btmutex.c 976f45a12e37293e32cae0281b15a21d48a8aaa7
F src/btree.c 480a6d255cc4f066029daf23dd54acf152cd0e13 F src/btree.c fcfbe61a311e54224b23527bbf7586ce320e7b40
F src/btree.h 6fa8a3ff2483d0bb64a9f0105a8cedeac9e00cca F src/btree.h 6fa8a3ff2483d0bb64a9f0105a8cedeac9e00cca
F src/btreeInt.h eecc84f02375b2bb7a44abbcbbe3747dde73edb2 F src/btreeInt.h eecc84f02375b2bb7a44abbcbbe3747dde73edb2
F src/build.c 083da8466fd7e481cb8bd5264398f537507f6176 F src/build.c 92ef9483189389828966153c5950f2e5a49c1182
F src/callback.c d7e46f40c3cf53c43550b7da7a1d0479910b62cc F src/callback.c d7e46f40c3cf53c43550b7da7a1d0479910b62cc
F src/complete.c dc1d136c0feee03c2f7550bafc0d29075e36deac F src/complete.c dc1d136c0feee03c2f7550bafc0d29075e36deac
F src/ctime.c 4262c227bc91cecc61ae37ed3a40f08069cfa267 F src/ctime.c 4262c227bc91cecc61ae37ed3a40f08069cfa267
F src/date.c 067a81c9942c497aafd2c260e13add8a7d0c7dd4 F src/date.c 067a81c9942c497aafd2c260e13add8a7d0c7dd4
F src/delete.c aeabdabeeeaa0584127f291baa9617153d334778 F src/delete.c aeabdabeeeaa0584127f291baa9617153d334778
F src/expr.c 437c03d5bb4fe3a53ecab3ad0286d6c5260da7ed F src/expr.c e40d198a719aba1d2514f6e1541f9154f976ceb6
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
F src/fkey.c e16942bd5c8a868ac53287886464a5ed0e72b179 F src/fkey.c e16942bd5c8a868ac53287886464a5ed0e72b179
F src/func.c d3fdcff9274bc161152e67ed3f626841c247f4b9 F src/func.c d3fdcff9274bc161152e67ed3f626841c247f4b9
@@ -159,7 +160,7 @@ F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d
F src/legacy.c 0df0b1550b9cc1f58229644735e317ac89131f12 F src/legacy.c 0df0b1550b9cc1f58229644735e317ac89131f12
F src/lempar.c cdf0a000315332fc9b50b62f3b5e22e080a0952b F src/lempar.c cdf0a000315332fc9b50b62f3b5e22e080a0952b
F src/loadext.c c48f7f3f170e502fe0cc20748e03c6e0b5a016c2 F src/loadext.c c48f7f3f170e502fe0cc20748e03c6e0b5a016c2
F src/main.c 7531758e3167006f55cd65678d9c72a3c1a6759a F src/main.c c6419ef57392b1aa0cf6ed9c80dfc06b153fe299
F src/malloc.c fe085aa851b666b7c375c1ff957643dc20a04bf6 F src/malloc.c fe085aa851b666b7c375c1ff957643dc20a04bf6
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c 437c7c4af964895d4650f29881df63535caaa1fa F src/mem1.c 437c7c4af964895d4650f29881df63535caaa1fa
@@ -176,8 +177,8 @@ F src/notify.c 976dd0f6171d4588e89e874fcc765e92914b6d30
F src/os.c b4ad71336fd96f97776f75587cd9e8218288f5be F src/os.c b4ad71336fd96f97776f75587cd9e8218288f5be
F src/os.h 4a46270a64e9193af4a0aaa3bc2c66dc07c29b3f F src/os.h 4a46270a64e9193af4a0aaa3bc2c66dc07c29b3f
F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
F src/os_unix.c 5e0b0ca7594f6707a3ed155528a3ba3318c95e15 F src/os_unix.c 75ce49309b8352c7173ce1ef6fc9e8d1f6daab10
F src/os_win.c 4e2bf0760409aef35e298ff725054e94d834e1a3 F src/os_win.c 32b8adca3e989565713ff74098b3cb2cb25d6e59
F src/pager.c 49e23f9898113ddfe90942bdf1c1ef57955d0921 F src/pager.c 49e23f9898113ddfe90942bdf1c1ef57955d0921
F src/pager.h 5cb78b8e1adfd5451e600be7719f5a99d87ac3b1 F src/pager.h 5cb78b8e1adfd5451e600be7719f5a99d87ac3b1
F src/parse.y 9708365594eea519cdc8504dee425c0a41c79502 F src/parse.y 9708365594eea519cdc8504dee425c0a41c79502
@@ -188,7 +189,7 @@ F src/pragma.c 8779308bc1ea1901c4bc94dfe9a83d436f73f52c
F src/prepare.c 743e484233c51109666d402f470523553b41797c F src/prepare.c 743e484233c51109666d402f470523553b41797c
F src/printf.c 4a9f882f1c1787a8b494a2987765acf9d97ac21f F src/printf.c 4a9f882f1c1787a8b494a2987765acf9d97ac21f
F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50 F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50
F src/resolve.c 83cc2d942ee216bc56956c6e6fadb691c1727fa1 F src/resolve.c 89f9003e8316ee3a172795459efc2a0274e1d5a8
F src/rowset.c 64655f1a627c9c212d9ab497899e7424a34222e0 F src/rowset.c 64655f1a627c9c212d9ab497899e7424a34222e0
F src/select.c a4641882279becc200f2680f55f3e89d4e7c7f78 F src/select.c a4641882279becc200f2680f55f3e89d4e7c7f78
F src/shell.c 2109d54f67c815a100abd7dc6a6e25eddb3b97eb F src/shell.c 2109d54f67c815a100abd7dc6a6e25eddb3b97eb
@@ -200,7 +201,7 @@ F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
F src/status.c bedc37ec1a6bb9399944024d63f4c769971955a9 F src/status.c bedc37ec1a6bb9399944024d63f4c769971955a9
F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
F src/tclsqlite.c 2ecec9937e69bc17560ad886da35195daa7261b8 F src/tclsqlite.c 2ecec9937e69bc17560ad886da35195daa7261b8
F src/test1.c ab9dd4fc486a2542f57a2ca17d74fc7f28dfd05a F src/test1.c 045d45a4f7eeb5d963f8fc150339f1bad279011a
F src/test2.c 7355101c085304b90024f2261e056cdff13c6c35 F src/test2.c 7355101c085304b90024f2261e056cdff13c6c35
F src/test3.c 1c0e5d6f080b8e33c1ce8b3078e7013fdbcd560c F src/test3.c 1c0e5d6f080b8e33c1ce8b3078e7013fdbcd560c
F src/test4.c 9b32d22f5f150abe23c1830e2057c4037c45b3df F src/test4.c 9b32d22f5f150abe23c1830e2057c4037c45b3df
@@ -239,7 +240,7 @@ F src/test_server.c 2f99eb2837dfa06a4aacf24af24c6affdf66a84f
F src/test_sqllog.c c1c1bbedbcaf82b93d83e4f9dd990e62476a680e F src/test_sqllog.c c1c1bbedbcaf82b93d83e4f9dd990e62476a680e
F src/test_stat.c d1569c7a4839f13e80187e2c26b2ab4da2d03935 F src/test_stat.c d1569c7a4839f13e80187e2c26b2ab4da2d03935
F src/test_superlock.c 2b97936ca127d13962c3605dbc9a4ef269c424cd F src/test_superlock.c 2b97936ca127d13962c3605dbc9a4ef269c424cd
F src/test_syscall.c 437abc86e3b37facc8531b7d14d42fddb50f3677 F src/test_syscall.c 16dbe79fb320fadb5acd7a0a59f49e52ab2d2091
F src/test_tclvar.c f4dc67d5f780707210d6bb0eb6016a431c04c7fa F src/test_tclvar.c f4dc67d5f780707210d6bb0eb6016a431c04c7fa
F src/test_thread.c 1e133a40b50e9c035b00174035b846e7eef481cb F src/test_thread.c 1e133a40b50e9c035b00174035b846e7eef481cb
F src/test_vfs.c 8e6087a8b3dcc260282074b0efba14b76311120c F src/test_vfs.c 8e6087a8b3dcc260282074b0efba14b76311120c
@@ -259,7 +260,7 @@ F src/vdbeaux.c ecb43014bcd3019e5aa2b5561e5c3a447f007a08
F src/vdbeblob.c 5dc79627775bd9a9b494dd956e26297946417d69 F src/vdbeblob.c 5dc79627775bd9a9b494dd956e26297946417d69
F src/vdbemem.c 833005f1cbbf447289f1973dba2a0c2228c7b8ab F src/vdbemem.c 833005f1cbbf447289f1973dba2a0c2228c7b8ab
F src/vdbesort.c 4fad64071ae120c25f39dcac572d716b9cadeb7f F src/vdbesort.c 4fad64071ae120c25f39dcac572d716b9cadeb7f
F src/vdbetrace.c 3ad1b4e92b60c082a02ac563da4a2735cc7d297c F src/vdbetrace.c 18cc59cb475e6115129bfde224367d13a35a7d13
F src/vtab.c b05e5f1f4902461ba9f5fc49bb7eb7c3a0741a83 F src/vtab.c b05e5f1f4902461ba9f5fc49bb7eb7c3a0741a83
F src/wal.c 436bfceb141b9423c45119e68e444358ee0ed35d F src/wal.c 436bfceb141b9423c45119e68e444358ee0ed35d
F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
@@ -326,7 +327,7 @@ F test/boundary3.tcl 8901d6a503d0bf64251dd81cc74e5ad3add4b119
F test/boundary3.test 56ef82096b4329aca2be74fa1e2b0f762ea0eb45 F test/boundary3.test 56ef82096b4329aca2be74fa1e2b0f762ea0eb45
F test/boundary4.tcl 0bb4b1a94f4fc5ae59b79b9a2b7a140c405e2983 F test/boundary4.tcl 0bb4b1a94f4fc5ae59b79b9a2b7a140c405e2983
F test/boundary4.test 89e02fa66397b8a325d5eb102b5806f961f8ec4b F test/boundary4.test 89e02fa66397b8a325d5eb102b5806f961f8ec4b
F test/btreefault.test 06899a377f31a8c1a3048ec69831522d4e5c6045 F test/btreefault.test f52c593513bda80a506c848325c73c840590884d
F test/busy.test 76b4887f8b9160ba903c1ac22e8ff406ad6ae2f0 F test/busy.test 76b4887f8b9160ba903c1ac22e8ff406ad6ae2f0
F test/cache.test 13bc046b26210471ca6f2889aceb1ea52dc717de F test/cache.test 13bc046b26210471ca6f2889aceb1ea52dc717de
F test/capi2.test e8b18cc61090b6e5e388f54d6b125d711d1b265a F test/capi2.test e8b18cc61090b6e5e388f54d6b125d711d1b265a
@@ -337,11 +338,12 @@ F test/capi3d.test 17b57ca28be3e37e14c2ba8f787d292d84b724a1
F test/capi3e.test f7408dda65c92b9056199fdc180f893015f83dde F test/capi3e.test f7408dda65c92b9056199fdc180f893015f83dde
F test/cast.test 4c275cbdc8202d6f9c54a3596701719868ac7dc3 F test/cast.test 4c275cbdc8202d6f9c54a3596701719868ac7dc3
F test/check.test 2eb93611139a7dfaed3be80067c7dc5ceb5fb287 F test/check.test 2eb93611139a7dfaed3be80067c7dc5ceb5fb287
F test/closure01.test 6194a899cdbba561d0439c0d6cc7bcdf4fc413e7 F test/close.test e37610d60e9c9b9979a981f3f50071d7dff28616
F test/closure01.test dbb28f1ea9eeaf0a53ec5bc0fed352e479def8c7
F test/coalesce.test cee0dccb9fbd2d494b77234bccf9dc6c6786eb91 F test/coalesce.test cee0dccb9fbd2d494b77234bccf9dc6c6786eb91
F test/collate1.test fd02c4d8afc71879c4bb952586389961a21fb0ce F test/collate1.test fd02c4d8afc71879c4bb952586389961a21fb0ce
F test/collate2.test 04cebe4a033be319d6ddbb3bbc69464e01700b49 F test/collate2.test 04cebe4a033be319d6ddbb3bbc69464e01700b49
F test/collate3.test d28d2cfab2c3a3d4628ae4b2b7afc9965daa3b4c F test/collate3.test 79558a286362cb9ed603c6fa543f1cda7f563f0f
F test/collate4.test 031f7265c13308b724ba3c49f41cc04612bd92b1 F test/collate4.test 031f7265c13308b724ba3c49f41cc04612bd92b1
F test/collate5.test 65d928034d30d2d263a80f6359f7549ee1598ec6 F test/collate5.test 65d928034d30d2d263a80f6359f7549ee1598ec6
F test/collate6.test 8be65a182abaac8011a622131486dafb8076e907 F test/collate6.test 8be65a182abaac8011a622131486dafb8076e907
@@ -570,7 +572,7 @@ F test/instr.test a34e1d46a9eefb098a7167ef0e730a4a3d82fba0
F test/intarray.test 066b7d7ac38d25bf96f87f1b017bfc687551cdd4 F test/intarray.test 066b7d7ac38d25bf96f87f1b017bfc687551cdd4
F test/interrupt.test dfe9a67a94b0b2d8f70545ba1a6cca10780d71cc F test/interrupt.test dfe9a67a94b0b2d8f70545ba1a6cca10780d71cc
F test/intpkey.test 7af30f6ae852d8d1c2b70e4bf1551946742e92d8 F test/intpkey.test 7af30f6ae852d8d1c2b70e4bf1551946742e92d8
F test/io.test 0147ed5fdbce3286d6128f5f7e3b76ee8352d652 F test/io.test ecf44cc81664ad54d8253e2d88fc705b6554abe3
F test/ioerr.test 40bb2cfcab63fb6aa7424cd97812a84bc16b5fb8 F test/ioerr.test 40bb2cfcab63fb6aa7424cd97812a84bc16b5fb8
F test/ioerr2.test 9d71166f8466eda510f1af6137bdabaa82b5408d F test/ioerr2.test 9d71166f8466eda510f1af6137bdabaa82b5408d
F test/ioerr3.test d3cec5e1a11ad6d27527d0d38573fbff14c71bdd F test/ioerr3.test d3cec5e1a11ad6d27527d0d38573fbff14c71bdd
@@ -647,8 +649,8 @@ F test/misc5.test 528468b26d03303b1f047146e5eefc941b9069f5
F test/misc6.test 953cc693924d88e6117aeba16f46f0bf5abede91 F test/misc6.test 953cc693924d88e6117aeba16f46f0bf5abede91
F test/misc7.test dd82ec9250b89178b96cd28b2aca70639d21e5b3 F test/misc7.test dd82ec9250b89178b96cd28b2aca70639d21e5b3
F test/misuse.test ba4fb5d1a6101d1c171ea38b3c613d0661c83054 F test/misuse.test ba4fb5d1a6101d1c171ea38b3c613d0661c83054
F test/mmap1.test 8696aa1b0bd88961c2f16af2a3f7a69d701cea50 F test/mmap1.test 93d167b328255cbe6679fe1e1a23be1b1197d07b
F test/mmap2.test a5ba639f90b5fc487400a49e158e14e465943e98 F test/mmap2.test 9d6dd9ddb4ad2379f29cc78f38ce1e63ed418022
F test/multiplex.test e08cc7177bd6d85990ee1d71100bb6c684c02256 F test/multiplex.test e08cc7177bd6d85990ee1d71100bb6c684c02256
F test/multiplex2.test 580ca5817c7edbe4cc68fa150609c9473393003a F test/multiplex2.test 580ca5817c7edbe4cc68fa150609c9473393003a
F test/multiplex3.test d228f59eac91839a977eac19f21d053f03e4d101 F test/multiplex3.test d228f59eac91839a977eac19f21d053f03e4d101
@@ -677,7 +679,7 @@ F test/pageropt.test 6b8f6a123a5572c195ad4ae40f2987007923bbd6
F test/pagesize.test 1dd51367e752e742f58e861e65ed7390603827a0 F test/pagesize.test 1dd51367e752e742f58e861e65ed7390603827a0
F test/pcache.test 065aa286e722ab24f2e51792c1f093bf60656b16 F test/pcache.test 065aa286e722ab24f2e51792c1f093bf60656b16
F test/pcache2.test a83efe2dec0d392f814bfc998def1d1833942025 F test/pcache2.test a83efe2dec0d392f814bfc998def1d1833942025
F test/permutations.test 3d0bab9c49c1ec08b868059e30a3e1956f2162e2 F test/permutations.test d997a947ab8aabb15f763d50a030b3c11e8ef1b6
F test/pragma.test 5e7de6c32a5d764f09437d2025f07e4917b9e178 F test/pragma.test 5e7de6c32a5d764f09437d2025f07e4917b9e178
F test/pragma2.test 3a55f82b954242c642f8342b17dffc8b47472947 F test/pragma2.test 3a55f82b954242c642f8342b17dffc8b47472947
F test/printf.test ec9870c4dce8686a37818e0bf1aba6e6a1863552 F test/printf.test ec9870c4dce8686a37818e0bf1aba6e6a1863552
@@ -737,6 +739,7 @@ F test/shared6.test 866bb4982c45ce216c61ded5e8fde4e7e2f3ffa9
F test/shared7.test 960760bc8d03e1419e70dea69cf41db62853616e F test/shared7.test 960760bc8d03e1419e70dea69cf41db62853616e
F test/shared8.test b27befbefbe7f4517f1d6b7ff8f64a41ec74165d F test/shared8.test b27befbefbe7f4517f1d6b7ff8f64a41ec74165d
F test/shared9.test 5f2a8f79b4d6c7d107a01ffa1ed05ae7e6333e21 F test/shared9.test 5f2a8f79b4d6c7d107a01ffa1ed05ae7e6333e21
F test/sharedA.test 0cdf1a76dfa00e6beee66af5b534b1e8df2720f5
F test/shared_err.test 0079c05c97d88cfa03989b7c20a8b266983087aa F test/shared_err.test 0079c05c97d88cfa03989b7c20a8b266983087aa
F test/sharedlock.test ffa0a3c4ac192145b310f1254f8afca4d553eabf F test/sharedlock.test ffa0a3c4ac192145b310f1254f8afca4d553eabf
F test/shell1.test 4a2f57952719972c6f862134463f8712e953c038 F test/shell1.test 4a2f57952719972c6f862134463f8712e953c038
@@ -973,7 +976,7 @@ F test/vtabF.test fd5ad376f5a34fe0891df1f3cddb4fe7c3eb077e
F test/vtab_alter.test 9e374885248f69e251bdaacf480b04a197f125e5 F test/vtab_alter.test 9e374885248f69e251bdaacf480b04a197f125e5
F test/vtab_err.test 0d4d8eb4def1d053ac7c5050df3024fd47a3fbd8 F test/vtab_err.test 0d4d8eb4def1d053ac7c5050df3024fd47a3fbd8
F test/vtab_shared.test 82f463886e18d7f8395a4b6167c91815efe54839 F test/vtab_shared.test 82f463886e18d7f8395a4b6167c91815efe54839
F test/wal.test e6dcf26e3e5cce2adb2f2f57eda53bc2c54c580c F test/wal.test 3a6ebdf0287b38b5537c07c517b30dda9aaac317
F test/wal2.test d4b470f13c87f6d8268b004380afa04c3c67cb90 F test/wal2.test d4b470f13c87f6d8268b004380afa04c3c67cb90
F test/wal3.test b22eb662bcbc148c5f6d956eaf94b047f7afe9c0 F test/wal3.test b22eb662bcbc148c5f6d956eaf94b047f7afe9c0
F test/wal4.test 4744e155cd6299c6bd99d3eab1c82f77db9cdb3c F test/wal4.test 4744e155cd6299c6bd99d3eab1c82f77db9cdb3c
@@ -1005,7 +1008,7 @@ F test/where4.test e9b9e2f2f98f00379e6031db6a6fca29bae782a2
F test/where5.test fdf66f96d29a064b63eb543e28da4dfdccd81ad2 F test/where5.test fdf66f96d29a064b63eb543e28da4dfdccd81ad2
F test/where6.test 5da5a98cec820d488e82708301b96cb8c18a258b F test/where6.test 5da5a98cec820d488e82708301b96cb8c18a258b
F test/where7.test 5c566388f0cc318b0032ce860f4ac5548e3c265a F test/where7.test 5c566388f0cc318b0032ce860f4ac5548e3c265a
F test/where8.test d9f889e62dccddb9d790b0c84dfc7861e03a162c F test/where8.test d6a283eb7348a8967d44e2a753f117ab0d21d4f3
F test/where8m.test da346596e19d54f0aba35ebade032a7c47d79739 F test/where8m.test da346596e19d54f0aba35ebade032a7c47d79739
F test/where9.test 1b4387c6eacc9a32b28b4d837c27f857c785d0d8 F test/where9.test 1b4387c6eacc9a32b28b4d837c27f857c785d0d8
F test/whereA.test 24c234263c8fe358f079d5e57d884fb569d2da0a F test/whereA.test 24c234263c8fe358f079d5e57d884fb569d2da0a
@@ -1062,7 +1065,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
P d6946f33c7851aa7efb04b93ac2ae1ac50c26eec P 9fe20292558bb9422de91e35648cb834cbf3b306 118a3b35693b134d56ebd780123b7fd6f1497668
R fe984d1689a56a08a31662e67855ab37 R b3fec2668cd66935dfd81d00e243b60d
U drh U drh
Z 13c634b8e2044390ac483fb2d5137194 Z e02385c0316003dbdd17c2ecf0ba1968

View File

@@ -1 +1 @@
9fe20292558bb9422de91e35648cb834cbf3b306 14ab6675e5eab3761256a06dad23d2b11220788a

View File

@@ -20,7 +20,7 @@
--match 1500.0 --match 1500.0
--sleep 2 --sleep 2
UPDATE t1 SET b='x'||a||'y'; UPDATE t1 SET b='x'||a||'y';
SELECT total(length(b)) FROM t1; SELECT sum(length(b)) FROM t1;
--match 247 --match 247
SELECT a FROM t1 WHERE b='x17y'; SELECT a FROM t1 WHERE b='x17y';
--match 17 --match 17
@@ -35,7 +35,7 @@
CREATE TABLE t2(a INTEGER PRIMARY KEY, b); CREATE TABLE t2(a INTEGER PRIMARY KEY, b);
INSERT INTO t2 SELECT a, b FROM t1; INSERT INTO t2 SELECT a, b FROM t1;
UPDATE t1 SET b='x'||a||'y'; UPDATE t1 SET b='x'||a||'y';
SELECT total(length(b)) FROM t2; SELECT sum(length(b)) FROM t2;
--match 247 --match 247
SELECT a FROM t2 WHERE b='x17y'; SELECT a FROM t2 WHERE b='x17y';
--match 17 --match 17
@@ -49,7 +49,7 @@
CREATE TABLE t3(a INTEGER PRIMARY KEY, b); CREATE TABLE t3(a INTEGER PRIMARY KEY, b);
INSERT INTO t3 SELECT a, b FROM t1; INSERT INTO t3 SELECT a, b FROM t1;
UPDATE t1 SET b='x'||a||'y'; UPDATE t1 SET b='x'||a||'y';
SELECT total(length(b)) FROM t3; SELECT sum(length(b)) FROM t3;
--match 247 --match 247
SELECT a FROM t3 WHERE b='x17y'; SELECT a FROM t3 WHERE b='x17y';
--match 17 --match 17
@@ -63,7 +63,7 @@
CREATE TABLE t4(a INTEGER PRIMARY KEY, b); CREATE TABLE t4(a INTEGER PRIMARY KEY, b);
INSERT INTO t4 SELECT a, b FROM t1; INSERT INTO t4 SELECT a, b FROM t1;
UPDATE t1 SET b='x'||a||'y'; UPDATE t1 SET b='x'||a||'y';
SELECT total(length(b)) FROM t4; SELECT sum(length(b)) FROM t4;
--match 247 --match 247
SELECT a FROM t4 WHERE b='x17y'; SELECT a FROM t4 WHERE b='x17y';
--match 17 --match 17
@@ -77,7 +77,7 @@
CREATE TABLE t5(a INTEGER PRIMARY KEY, b); CREATE TABLE t5(a INTEGER PRIMARY KEY, b);
INSERT INTO t5 SELECT a, b FROM t1; INSERT INTO t5 SELECT a, b FROM t1;
UPDATE t1 SET b='x'||a||'y'; UPDATE t1 SET b='x'||a||'y';
SELECT total(length(b)) FROM t5; SELECT sum(length(b)) FROM t5;
--match 247 --match 247
SELECT a FROM t5 WHERE b='x17y'; SELECT a FROM t5 WHERE b='x17y';
--match 17 --match 17

View File

@@ -22,7 +22,7 @@
--match 1500.0 --match 1500.0
--sleep 2 --sleep 2
UPDATE t1 SET b='x'||a||'y'; UPDATE t1 SET b='x'||a||'y';
SELECT total(length(b)) FROM t1; SELECT sum(length(b)) FROM t1;
--match 247 --match 247
SELECT a FROM t1 WHERE b='x17y'; SELECT a FROM t1 WHERE b='x17y';
--match 17 --match 17
@@ -54,7 +54,7 @@
--match 1500.0 --match 1500.0
--sleep 2 --sleep 2
UPDATE t2 SET b='x'||a||'y'; UPDATE t2 SET b='x'||a||'y';
SELECT total(length(b)) FROM t2; SELECT sum(length(b)) FROM t2;
--match 247 --match 247
SELECT a FROM t2 WHERE b='x17y'; SELECT a FROM t2 WHERE b='x17y';
--match 17 --match 17
@@ -85,7 +85,7 @@
--match 1500.0 --match 1500.0
--sleep 2 --sleep 2
UPDATE t3 SET b='x'||a||'y'; UPDATE t3 SET b='x'||a||'y';
SELECT total(length(b)) FROM t3; SELECT sum(length(b)) FROM t3;
--match 247 --match 247
SELECT a FROM t3 WHERE b='x17y'; SELECT a FROM t3 WHERE b='x17y';
--match 17 --match 17
@@ -116,7 +116,7 @@
--match 1500.0 --match 1500.0
--sleep 2 --sleep 2
UPDATE t4 SET b='x'||a||'y'; UPDATE t4 SET b='x'||a||'y';
SELECT total(length(b)) FROM t4; SELECT sum(length(b)) FROM t4;
--match 247 --match 247
SELECT a FROM t4 WHERE b='x17y'; SELECT a FROM t4 WHERE b='x17y';
--match 17 --match 17
@@ -147,7 +147,7 @@
--match 1500.0 --match 1500.0
--sleep 2 --sleep 2
UPDATE t5 SET b='x'||a||'y'; UPDATE t5 SET b='x'||a||'y';
SELECT total(length(b)) FROM t5; SELECT sum(length(b)) FROM t5;
--match 247 --match 247
SELECT a FROM t5 WHERE b='x17y'; SELECT a FROM t5 WHERE b='x17y';
--match 17 --match 17
@@ -159,15 +159,15 @@
--end --end
--wait all --wait all
SELECT count(*), total(length(b)) FROM t1; SELECT count(*), sum(length(b)) FROM t1;
--match 64 247 --match 64 247
SELECT count(*), total(length(b)) FROM t2; SELECT count(*), sum(length(b)) FROM t2;
--match 64 247 --match 64 247
SELECT count(*), total(length(b)) FROM t3; SELECT count(*), sum(length(b)) FROM t3;
--match 64 247 --match 64 247
SELECT count(*), total(length(b)) FROM t4; SELECT count(*), sum(length(b)) FROM t4;
--match 64 247 --match 64 247
SELECT count(*), total(length(b)) FROM t5; SELECT count(*), sum(length(b)) FROM t5;
--match 64 247 --match 64 247
--task 1 --task 1

View File

@@ -2517,6 +2517,29 @@ page1_init_failed:
return rc; return rc;
} }
#ifndef NDEBUG
/*
** Return the number of cursors open on pBt. This is for use
** in assert() expressions, so it is only compiled if NDEBUG is not
** defined.
**
** Only write cursors are counted if wrOnly is true. If wrOnly is
** false then all cursors are counted.
**
** For the purposes of this routine, a cursor is any cursor that
** is capable of reading or writing to the databse. Cursors that
** have been tripped into the CURSOR_FAULT state are not counted.
*/
static int countValidCursors(BtShared *pBt, int wrOnly){
BtCursor *pCur;
int r = 0;
for(pCur=pBt->pCursor; pCur; pCur=pCur->pNext){
if( (wrOnly==0 || pCur->wrFlag) && pCur->eState!=CURSOR_FAULT ) r++;
}
return r;
}
#endif
/* /*
** If there are no outstanding cursors and we are not in the middle ** If there are no outstanding cursors and we are not in the middle
** of a transaction but there is a read lock on the database, then ** of a transaction but there is a read lock on the database, then
@@ -2527,7 +2550,7 @@ page1_init_failed:
*/ */
static void unlockBtreeIfUnused(BtShared *pBt){ static void unlockBtreeIfUnused(BtShared *pBt){
assert( sqlite3_mutex_held(pBt->mutex) ); assert( sqlite3_mutex_held(pBt->mutex) );
assert( pBt->pCursor==0 || pBt->inTransaction>TRANS_NONE ); assert( countValidCursors(pBt,0)==0 || pBt->inTransaction>TRANS_NONE );
if( pBt->inTransaction==TRANS_NONE && pBt->pPage1!=0 ){ if( pBt->inTransaction==TRANS_NONE && pBt->pPage1!=0 ){
assert( pBt->pPage1->aData ); assert( pBt->pPage1->aData );
assert( sqlite3PagerRefcount(pBt->pPager)==1 ); assert( sqlite3PagerRefcount(pBt->pPager)==1 );
@@ -3255,7 +3278,6 @@ static void btreeEndTransaction(Btree *p){
#ifndef SQLITE_OMIT_AUTOVACUUM #ifndef SQLITE_OMIT_AUTOVACUUM
pBt->bDoTruncate = 0; pBt->bDoTruncate = 0;
#endif #endif
btreeClearHasContent(pBt);
if( p->inTrans>TRANS_NONE && p->db->activeVdbeCnt>1 ){ if( p->inTrans>TRANS_NONE && p->db->activeVdbeCnt>1 ){
/* If there are other active statements that belong to this database /* If there are other active statements that belong to this database
** handle, downgrade to a read-only transaction. The other statements ** handle, downgrade to a read-only transaction. The other statements
@@ -3330,6 +3352,7 @@ int sqlite3BtreeCommitPhaseTwo(Btree *p, int bCleanup){
return rc; return rc;
} }
pBt->inTransaction = TRANS_READ; pBt->inTransaction = TRANS_READ;
btreeClearHasContent(pBt);
} }
btreeEndTransaction(p); btreeEndTransaction(p);
@@ -3351,27 +3374,6 @@ int sqlite3BtreeCommit(Btree *p){
return rc; return rc;
} }
#ifndef NDEBUG
/*
** Return the number of write-cursors open on this handle. This is for use
** in assert() expressions, so it is only compiled if NDEBUG is not
** defined.
**
** For the purposes of this routine, a write-cursor is any cursor that
** is capable of writing to the databse. That means the cursor was
** originally opened for writing and the cursor has not be disabled
** by having its state changed to CURSOR_FAULT.
*/
static int countWriteCursors(BtShared *pBt){
BtCursor *pCur;
int r = 0;
for(pCur=pBt->pCursor; pCur; pCur=pCur->pNext){
if( pCur->wrFlag && pCur->eState!=CURSOR_FAULT ) r++;
}
return r;
}
#endif
/* /*
** This routine sets the state to CURSOR_FAULT and the error ** This routine sets the state to CURSOR_FAULT and the error
** code to errCode for every cursor on BtShared that pBtree ** code to errCode for every cursor on BtShared that pBtree
@@ -3451,8 +3453,9 @@ int sqlite3BtreeRollback(Btree *p, int tripCode){
pBt->nPage = nPage; pBt->nPage = nPage;
releasePage(pPage1); releasePage(pPage1);
} }
assert( countWriteCursors(pBt)==0 ); assert( countValidCursors(pBt, 1)==0 );
pBt->inTransaction = TRANS_READ; pBt->inTransaction = TRANS_READ;
btreeClearHasContent(pBt);
} }
btreeEndTransaction(p); btreeEndTransaction(p);

View File

@@ -2659,10 +2659,8 @@ Index *sqlite3CreateIndex(
for(i=0; i<pList->nExpr; i++){ for(i=0; i<pList->nExpr; i++){
Expr *pExpr = pList->a[i].pExpr; Expr *pExpr = pList->a[i].pExpr;
if( pExpr ){ if( pExpr ){
CollSeq *pColl = sqlite3ExprCollSeq(pParse, pExpr); assert( pExpr->op==TK_COLLATE );
if( pColl ){ nExtra += (1 + sqlite3Strlen30(pExpr->u.zToken));
nExtra += (1 + sqlite3Strlen30(pColl->zName));
}
} }
} }
@@ -2723,7 +2721,6 @@ Index *sqlite3CreateIndex(
const char *zColName = pListItem->zName; const char *zColName = pListItem->zName;
Column *pTabCol; Column *pTabCol;
int requestedSortOrder; int requestedSortOrder;
CollSeq *pColl; /* Collating sequence */
char *zColl; /* Collation sequence name */ char *zColl; /* Collation sequence name */
for(j=0, pTabCol=pTab->aCol; j<pTab->nCol; j++, pTabCol++){ for(j=0, pTabCol=pTab->aCol; j<pTab->nCol; j++, pTabCol++){
@@ -2736,11 +2733,10 @@ Index *sqlite3CreateIndex(
goto exit_create_index; goto exit_create_index;
} }
pIndex->aiColumn[i] = j; pIndex->aiColumn[i] = j;
if( pListItem->pExpr if( pListItem->pExpr ){
&& (pColl = sqlite3ExprCollSeq(pParse, pListItem->pExpr))!=0
){
int nColl; int nColl;
zColl = pColl->zName; assert( pListItem->pExpr->op==TK_COLLATE );
zColl = pListItem->pExpr->u.zToken;
nColl = sqlite3Strlen30(zColl) + 1; nColl = sqlite3Strlen30(zColl) + 1;
assert( nExtra>=nColl ); assert( nExtra>=nColl );
memcpy(zExtra, zColl, nColl); memcpy(zExtra, zColl, nColl);
@@ -2749,9 +2745,7 @@ Index *sqlite3CreateIndex(
nExtra -= nColl; nExtra -= nColl;
}else{ }else{
zColl = pTab->aCol[j].zColl; zColl = pTab->aCol[j].zColl;
if( !zColl ){ if( !zColl ) zColl = "BINARY";
zColl = "BINARY";
}
} }
if( !db->init.busy && !sqlite3LocateCollSeq(pParse, zColl) ){ if( !db->init.busy && !sqlite3LocateCollSeq(pParse, zColl) ){
goto exit_create_index; goto exit_create_index;

View File

@@ -116,12 +116,7 @@ CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr){
} }
assert( op!=TK_REGISTER || p->op2!=TK_COLLATE ); assert( op!=TK_REGISTER || p->op2!=TK_COLLATE );
if( op==TK_COLLATE ){ if( op==TK_COLLATE ){
if( db->init.busy ){ pColl = sqlite3GetCollSeq(pParse, ENC(db), 0, p->u.zToken);
/* Do not report errors when parsing while the schema */
pColl = sqlite3FindCollSeq(db, ENC(db), p->u.zToken, 0);
}else{
pColl = sqlite3GetCollSeq(pParse, ENC(db), 0, p->u.zToken);
}
break; break;
} }
if( p->pTab!=0 if( p->pTab!=0

View File

@@ -902,6 +902,12 @@ void sqlite3LeaveMutexAndCloseZombie(sqlite3 *db){
** go ahead and free all resources. ** go ahead and free all resources.
*/ */
/* If a transaction is open, roll it back. This also ensures that if
** any database schemas have been modified by an uncommitted transaction
** they are reset. And that the required b-tree mutex is held to make
** the pager rollback and schema reset an atomic operation. */
sqlite3RollbackAll(db, SQLITE_OK);
/* Free any outstanding Savepoint structures. */ /* Free any outstanding Savepoint structures. */
sqlite3CloseSavepoints(db); sqlite3CloseSavepoints(db);
@@ -1002,6 +1008,15 @@ void sqlite3RollbackAll(sqlite3 *db, int tripCode){
int inTrans = 0; int inTrans = 0;
assert( sqlite3_mutex_held(db->mutex) ); assert( sqlite3_mutex_held(db->mutex) );
sqlite3BeginBenignMalloc(); sqlite3BeginBenignMalloc();
/* Obtain all b-tree mutexes before making any calls to BtreeRollback().
** This is important in case the transaction being rolled back has
** modified the database schema. If the b-tree mutexes are not taken
** here, then another shared-cache connection might sneak in between
** the database rollback and schema reset, which can cause false
** corruption reports in some cases. */
sqlite3BtreeEnterAll(db);
for(i=0; i<db->nDb; i++){ for(i=0; i<db->nDb; i++){
Btree *p = db->aDb[i].pBt; Btree *p = db->aDb[i].pBt;
if( p ){ if( p ){
@@ -1019,6 +1034,7 @@ void sqlite3RollbackAll(sqlite3 *db, int tripCode){
sqlite3ExpirePreparedStatements(db); sqlite3ExpirePreparedStatements(db);
sqlite3ResetAllSchemasOfConnection(db); sqlite3ResetAllSchemasOfConnection(db);
} }
sqlite3BtreeLeaveAll(db);
/* Any deferred constraint violations have now been resolved. */ /* Any deferred constraint violations have now been resolved. */
db->nDeferredCons = 0; db->nDeferredCons = 0;

View File

@@ -5153,7 +5153,7 @@ static int fillInUnixFile(
pNew->pVfs = pVfs; pNew->pVfs = pVfs;
pNew->zPath = zFilename; pNew->zPath = zFilename;
pNew->ctrlFlags = (u8)ctrlFlags; pNew->ctrlFlags = (u8)ctrlFlags;
pNew->mmapSizeMax = sqlite3GlobalConfig.mxMmap; pNew->mmapSizeMax = sqlite3GlobalConfig.szMmap;
if( sqlite3_uri_boolean(((ctrlFlags & UNIXFILE_URI) ? zFilename : 0), if( sqlite3_uri_boolean(((ctrlFlags & UNIXFILE_URI) ? zFilename : 0),
"psow", SQLITE_POWERSAFE_OVERWRITE) ){ "psow", SQLITE_POWERSAFE_OVERWRITE) ){
pNew->ctrlFlags |= UNIXFILE_PSOW; pNew->ctrlFlags |= UNIXFILE_PSOW;

View File

@@ -2937,8 +2937,6 @@ static int winDeviceCharacteristics(sqlite3_file *id){
((p->ctrlFlags & WINFILE_PSOW)?SQLITE_IOCAP_POWERSAFE_OVERWRITE:0); ((p->ctrlFlags & WINFILE_PSOW)?SQLITE_IOCAP_POWERSAFE_OVERWRITE:0);
} }
#ifndef SQLITE_OMIT_WAL
/* /*
** Windows will only let you create file view mappings ** Windows will only let you create file view mappings
** on allocation size granularity boundaries. ** on allocation size granularity boundaries.
@@ -2947,6 +2945,8 @@ static int winDeviceCharacteristics(sqlite3_file *id){
*/ */
SYSTEM_INFO winSysInfo; SYSTEM_INFO winSysInfo;
#ifndef SQLITE_OMIT_WAL
/* /*
** Helper functions to obtain and relinquish the global mutex. The ** Helper functions to obtain and relinquish the global mutex. The
** global mutex is used to protect the winLockInfo objects used by ** global mutex is used to protect the winLockInfo objects used by
@@ -4246,7 +4246,7 @@ static int winOpen(
pFile->pMapRegion = 0; pFile->pMapRegion = 0;
pFile->mmapSize = 0; pFile->mmapSize = 0;
pFile->mmapSizeActual = 0; pFile->mmapSizeActual = 0;
pFile->mmapSizeMax = sqlite3GlobalConfig.mxMmap; pFile->mmapSizeMax = sqlite3GlobalConfig.szMmap;
#endif #endif
OpenCounter(+1); OpenCounter(+1);

View File

@@ -1159,8 +1159,8 @@ static int resolveSelectStep(Walker *pWalker, Select *p){
** re-evaluated for each reference to it. ** re-evaluated for each reference to it.
*/ */
sNC.pEList = p->pEList; sNC.pEList = p->pEList;
if( sqlite3ResolveExprNames(&sNC, p->pHaving) ) return WRC_Abort;
sNC.ncFlags |= NC_AsMaybe; sNC.ncFlags |= NC_AsMaybe;
if( sqlite3ResolveExprNames(&sNC, p->pHaving) ) return WRC_Abort;
if( sqlite3ResolveExprNames(&sNC, p->pWhere) ) return WRC_Abort; if( sqlite3ResolveExprNames(&sNC, p->pWhere) ) return WRC_Abort;
sNC.ncFlags &= ~NC_AsMaybe; sNC.ncFlags &= ~NC_AsMaybe;

View File

@@ -681,6 +681,30 @@ static int sqlite_test_close(
return TCL_OK; return TCL_OK;
} }
/*
** Usage: sqlite3_close_v2 DB
**
** Closes the database opened by sqlite3_open.
*/
static int sqlite_test_close_v2(
void *NotUsed,
Tcl_Interp *interp, /* The TCL interpreter that invoked this command */
int argc, /* Number of arguments */
char **argv /* Text of each argument */
){
sqlite3 *db;
int rc;
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
" FILENAME\"", 0);
return TCL_ERROR;
}
if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
rc = sqlite3_close_v2(db);
Tcl_SetResult(interp, (char *)t1ErrorName(rc), TCL_STATIC);
return TCL_OK;
}
/* /*
** Implementation of the x_coalesce() function. ** Implementation of the x_coalesce() function.
** Return the first argument non-NULL argument. ** Return the first argument non-NULL argument.
@@ -6077,6 +6101,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
{ "sqlite3_get_table_printf", (Tcl_CmdProc*)test_get_table_printf }, { "sqlite3_get_table_printf", (Tcl_CmdProc*)test_get_table_printf },
#endif #endif
{ "sqlite3_close", (Tcl_CmdProc*)sqlite_test_close }, { "sqlite3_close", (Tcl_CmdProc*)sqlite_test_close },
{ "sqlite3_close_v2", (Tcl_CmdProc*)sqlite_test_close_v2 },
{ "sqlite3_create_function", (Tcl_CmdProc*)test_create_function }, { "sqlite3_create_function", (Tcl_CmdProc*)test_create_function },
{ "sqlite3_create_aggregate", (Tcl_CmdProc*)test_create_aggregate }, { "sqlite3_create_aggregate", (Tcl_CmdProc*)test_create_aggregate },
{ "sqlite_register_test_function", (Tcl_CmdProc*)test_register_func }, { "sqlite_register_test_function", (Tcl_CmdProc*)test_register_func },

View File

@@ -69,13 +69,13 @@
** the xNextSystemCall() VFS method. ** the xNextSystemCall() VFS method.
*/ */
#include "sqliteInt.h"
#include "sqlite3.h" #include "sqlite3.h"
#include "tcl.h" #include "tcl.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
#include "sqliteInt.h"
#if SQLITE_OS_UNIX #if SQLITE_OS_UNIX
/* From main.c */ /* From main.c */

View File

@@ -142,14 +142,14 @@ char *sqlite3VdbeExpandSql(
#endif #endif
nOut = pVar->n; nOut = pVar->n;
#ifdef SQLITE_TRACE_SIZE_LIMIT #ifdef SQLITE_TRACE_SIZE_LIMIT
if( n>SQLITE_TRACE_SIZE_LIMIT ){ if( nOut>SQLITE_TRACE_SIZE_LIMIT ){
nOut = SQLITE_TRACE_SIZE_LIMIT; nOut = SQLITE_TRACE_SIZE_LIMIT;
while( nOut<pVar->n && (pVar->z[n]&0xc0)==0x80 ){ n++; } while( nOut<pVar->n && (pVar->z[nOut]&0xc0)==0x80 ){ nOut++; }
} }
#endif #endif
sqlite3XPrintf(&out, "'%.*q'", nOut, pVar->z); sqlite3XPrintf(&out, "'%.*q'", nOut, pVar->z);
#ifdef SQLITE_TRACE_SIZE_LIMIT #ifdef SQLITE_TRACE_SIZE_LIMIT
if( nOut<pVar->n ) sqlite3XPrintf(&out, "/*+%d bytes*/", pVar->n-n); if( nOut<pVar->n ) sqlite3XPrintf(&out, "/*+%d bytes*/", pVar->n-nOut);
#endif #endif
#ifndef SQLITE_OMIT_UTF16 #ifndef SQLITE_OMIT_UTF16
if( enc!=SQLITE_UTF8 ) sqlite3VdbeMemRelease(&utf8); if( enc!=SQLITE_UTF8 ) sqlite3VdbeMemRelease(&utf8);
@@ -169,7 +169,7 @@ char *sqlite3VdbeExpandSql(
} }
sqlite3StrAccumAppend(&out, "'", 1); sqlite3StrAccumAppend(&out, "'", 1);
#ifdef SQLITE_TRACE_SIZE_LIMIT #ifdef SQLITE_TRACE_SIZE_LIMIT
if( nOut<pVar->n ) sqlite3XPrintf(&out, "/*+%d bytes*/", pVar->n-n); if( nOut<pVar->n ) sqlite3XPrintf(&out, "/*+%d bytes*/", pVar->n-nOut);
#endif #endif
} }
} }

View File

@@ -18,6 +18,14 @@ source $testdir/tester.tcl
source $testdir/malloc_common.tcl source $testdir/malloc_common.tcl
set testprefix btreefault set testprefix btreefault
# This test will not work with an in-memory journal, as the database will
# become corrupt if an error is injected into a transaction after it starts
# writing data out to the db file.
if {[permutation]=="inmemory_journal"} {
finish_test
return
}
do_test 1-pre1 { do_test 1-pre1 {
execsql { execsql {
PRAGMA auto_vacuum = incremental; PRAGMA auto_vacuum = incremental;

79
test/close.test Normal file
View File

@@ -0,0 +1,79 @@
# 2013 May 14
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
#
# Test some specific circumstances to do with shared cache mode.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set ::testprefix close
do_execsql_test 1.0 {
CREATE TABLE t1(x);
INSERT INTO t1 VALUES('one');
INSERT INTO t1 VALUES('two');
INSERT INTO t1 VALUES('three');
}
db close
do_test 1.1 {
set DB [sqlite3_open test.db]
sqlite3_close_v2 $DB
} {SQLITE_OK}
do_test 1.2.1 {
set DB [sqlite3_open test.db]
set STMT [sqlite3_prepare $DB "SELECT * FROM t1" -1 dummy]
sqlite3_close_v2 $DB
} {SQLITE_OK}
do_test 1.2.2 {
sqlite3_finalize $STMT
} {SQLITE_OK}
do_test 1.3.1 {
set DB [sqlite3_open test.db]
set STMT [sqlite3_prepare $DB "SELECT * FROM t1" -1 dummy]
sqlite3_step $STMT
sqlite3_close_v2 $DB
} {SQLITE_OK}
do_test 1.3.2 {
sqlite3_column_text $STMT 0
} {one}
do_test 1.3.3 {
sqlite3_finalize $STMT
} {SQLITE_OK}
do_test 1.4.1 {
set DB [sqlite3_open test.db]
set STMT [sqlite3_prepare $DB "SELECT * FROM t1" -1 dummy]
sqlite3_step $STMT
sqlite3_close_v2 $DB
} {SQLITE_OK}
do_test 1.4.2 {
list [sqlite3_step $STMT] [sqlite3_column_text $STMT 0]
} {SQLITE_ROW two}
do_test 1.4.3 {
list [catch {
sqlite3_prepare $DB "SELECT * FROM sqlite_master" -1 dummy
} msg] $msg
} {1 {(21) library routine called out of sequence}}
do_test 1.4.4 {
sqlite3_finalize $STMT
} {SQLITE_OK}
finish_test

View File

@@ -15,6 +15,8 @@ set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
set testprefix closure01 set testprefix closure01
ifcapable !vtab { finish_test ; return }
load_static_extension db closure load_static_extension db closure
do_execsql_test 1.0 { do_execsql_test 1.0 {

View File

@@ -55,6 +55,104 @@ execsql {
DROP TABLE collate3t1; DROP TABLE collate3t1;
} }
proc caseless {a b} { string compare -nocase $a $b }
do_test collate3-1.4 {
db collate caseless caseless
execsql {
CREATE TABLE t1(a COLLATE caseless);
INSERT INTO t1 VALUES('Abc2');
INSERT INTO t1 VALUES('abc1');
INSERT INTO t1 VALUES('aBc3');
}
execsql { SELECT * FROM t1 ORDER BY a }
} {abc1 Abc2 aBc3}
do_test collate3-1.5 {
db close
sqlite3 db test.db
catchsql { SELECT * FROM t1 ORDER BY a }
} {1 {no such collation sequence: caseless}}
do_test collate3-1.6.1 {
db collate caseless caseless
execsql { CREATE INDEX i1 ON t1(a) }
execsql { SELECT * FROM t1 ORDER BY a }
} {abc1 Abc2 aBc3}
do_test collate3-1.6.2 {
db close
sqlite3 db test.db
catchsql { SELECT * FROM t1 ORDER BY a }
} {1 {no such collation sequence: caseless}}
do_test collate3-1.6.3 {
db close
sqlite3 db test.db
catchsql { PRAGMA integrity_check }
} {1 {no such collation sequence: caseless}}
do_test collate3-1.6.4 {
db close
sqlite3 db test.db
catchsql { REINDEX }
} {1 {no such collation sequence: caseless}}
do_test collate3-1.7.1 {
db collate caseless caseless
execsql {
DROP TABLE t1;
CREATE TABLE t1(a);
CREATE INDEX i1 ON t1(a COLLATE caseless);
INSERT INTO t1 VALUES('Abc2');
INSERT INTO t1 VALUES('abc1');
INSERT INTO t1 VALUES('aBc3');
SELECT * FROM t1 ORDER BY a COLLATE caseless;
}
} {abc1 Abc2 aBc3}
do_test collate3-1.7.2 {
db close
sqlite3 db test.db
catchsql { SELECT * FROM t1 ORDER BY a COLLATE caseless}
} {1 {no such collation sequence: caseless}}
do_test collate3-1.7.4 {
db close
sqlite3 db test.db
catchsql { REINDEX }
} {1 {no such collation sequence: caseless}}
do_test collate3-1.7.3 {
db close
sqlite3 db test.db
catchsql { PRAGMA integrity_check }
} {1 {no such collation sequence: caseless}}
do_test collate3-1.7.4 {
db close
sqlite3 db test.db
catchsql { REINDEX }
} {1 {no such collation sequence: caseless}}
do_test collate3-1.7.5 {
db close
sqlite3 db test.db
db collate caseless caseless
catchsql { PRAGMA integrity_check }
} {0 ok}
proc needed {nm} { db collate caseless caseless }
do_test collate3-1.7.6 {
db close
sqlite3 db test.db
db collation_needed needed
catchsql { PRAGMA integrity_check }
} {0 ok}
do_test collate3-1.8 {
execsql { DROP TABLE t1 }
} {}
# #
# Create a table with a default collation sequence, then close # Create a table with a default collation sequence, then close
# and re-open the database without re-registering the collation # and re-open the database without re-registering the collation

View File

@@ -580,6 +580,7 @@ do_test io-6.1 {
execsql { execsql {
PRAGMA mmap_size = 0; PRAGMA mmap_size = 0;
PRAGMA page_size = 1024; PRAGMA page_size = 1024;
PRAGMA cache_size = 2000;
CREATE TABLE t1(x); CREATE TABLE t1(x);
CREATE TABLE t2(x); CREATE TABLE t2(x);
CREATE TABLE t3(x); CREATE TABLE t3(x);
@@ -612,9 +613,15 @@ foreach {tn sql} {
COMMIT; COMMIT;
} }
} { } {
# These tests don't work with memsubsys1, as it causes the effective page
# cache size to become too small to hold the entire db in memory.
if {[permutation] == "memsubsys1"} continue
db_restore db_restore
sqlite3 db test.db -vfs devsym sqlite3 db test.db -vfs devsym
execsql { execsql {
PRAGMA cache_size = 2000;
PRAGMA mmap_size = 0; PRAGMA mmap_size = 0;
SELECT x FROM t3 ORDER BY rowid; SELECT x FROM t3 ORDER BY rowid;
SELECT x FROM t3 ORDER BY x; SELECT x FROM t3 ORDER BY x;

View File

@@ -55,6 +55,9 @@ foreach {t mmap_size nRead c2init} {
} { } {
do_multiclient_test tn { do_multiclient_test tn {
sql1 {PRAGMA cache_size=2000}
sql2 {PRAGMA cache_size=2000}
sql1 {PRAGMA page_size=1024} sql1 {PRAGMA page_size=1024}
sql1 $mmap_size sql1 $mmap_size
sql2 $c2init sql2 $c2init
@@ -129,25 +132,28 @@ do_execsql_test 2.2 {
SELECT count(*) FROM t1; SELECT count(*) FROM t1;
} {1 32} } {1 32}
do_test 2.3 { if {[permutation] != "inmemory_journal"} {
sqlite3 db2 test.db do_test 2.3 {
db2 func rblob rblob sqlite3 db2 test.db
db2 eval { db2 func rblob rblob
DELETE FROM t1 WHERE (rowid%4); db2 eval {
DELETE FROM t1 WHERE (rowid%4);
PRAGMA wal_checkpoint;
}
db2 eval {
INSERT INTO t1 SELECT rblob(500), rblob(500) FROM t1; -- 16
SELECT count(*) FROM t1;
}
} {16}
do_execsql_test 2.4 {
PRAGMA wal_checkpoint; PRAGMA wal_checkpoint;
} } {0 24 24}
db2 eval { db2 close
INSERT INTO t1 SELECT rblob(500), rblob(500) FROM t1; -- 16 }
SELECT count(*) FROM t1;
}
} {16}
do_execsql_test 2.4 {
PRAGMA wal_checkpoint;
} {0 24 24}
db2 close
reset_db reset_db
execsql { PRAGMA mmap_size = 67108864; }
db func rblob rblob db func rblob rblob
do_execsql_test 3.1 { do_execsql_test 3.1 {
PRAGMA auto_vacuum = 1; PRAGMA auto_vacuum = 1;
@@ -176,6 +182,7 @@ do_test 3.2 {
# to rows using the incrblob API. # to rows using the incrblob API.
# #
reset_db reset_db
execsql { PRAGMA mmap_size = 67108864; }
set aaa [string repeat a 400] set aaa [string repeat a 400]
set bbb [string repeat b 400] set bbb [string repeat b 400]
set ccc [string repeat c 400] set ccc [string repeat c 400]
@@ -225,6 +232,7 @@ do_execsql_test 4.5 { COMMIT }
# new table or index. # new table or index.
# #
reset_db reset_db
execsql { PRAGMA mmap_size = 67108864; }
do_execsql_test 5.1 { do_execsql_test 5.1 {
PRAGMA auto_vacuum = 2; PRAGMA auto_vacuum = 2;
PRAGMA page_size = 1024; PRAGMA page_size = 1024;

View File

@@ -45,6 +45,7 @@ foreach syscall {mmap mremap} {
for {set i 1} {$i < 20} {incr i} { for {set i 1} {$i < 20} {incr i} {
reset_db reset_db
execsql { PRAGMA mmap_size = 8000000 }
test_syscall fault $i 1 test_syscall fault $i 1
test_syscall errno $syscall ENOMEM test_syscall errno $syscall ENOMEM

View File

@@ -243,10 +243,14 @@ lappend ::testsuitelist xxx
# Run some tests using pre-allocated page and scratch blocks. # Run some tests using pre-allocated page and scratch blocks.
# #
# mmap1.test is excluded because a good number of its tests depend on
# the page-cache being larger than the database. But this permutation
# causes the effective limit on the page-cache to be just 24 pages.
#
test_suite "memsubsys1" -description { test_suite "memsubsys1" -description {
Tests using pre-allocated page and scratch blocks Tests using pre-allocated page and scratch blocks
} -files [ } -files [
test_set $::allquicktests -exclude ioerr5.test malloc5.test test_set $::allquicktests -exclude ioerr5.test malloc5.test mmap1.test
] -initialize { ] -initialize {
catch {db close} catch {db close}
sqlite3_shutdown sqlite3_shutdown

188
test/sharedA.test Normal file
View File

@@ -0,0 +1,188 @@
# 2013 May 14
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
#
# Test some specific circumstances to do with shared cache mode.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
if {[run_thread_tests]==0} { finish_test ; return }
db close
set ::testprefix sharedA
set ::enable_shared_cache [sqlite3_enable_shared_cache 1]
#-------------------------------------------------------------------------
#
do_test 0.1 {
sqlite3 db1 test.db
sqlite3 db2 test.db
db1 eval {
CREATE TABLE t1(x);
INSERT INTO t1 VALUES(randomblob(100));
INSERT INTO t1 SELECT randomblob(100) FROM t1;
INSERT INTO t1 SELECT randomblob(100) FROM t1;
INSERT INTO t1 SELECT randomblob(100) FROM t1;
INSERT INTO t1 SELECT randomblob(100) FROM t1;
INSERT INTO t1 SELECT randomblob(100) FROM t1;
INSERT INTO t1 SELECT randomblob(100) FROM t1;
CREATE INDEX i1 ON t1(x);
}
db1 eval {
BEGIN;
DROP INDEX i1;
}
db2 close
db1 eval {
INSERT INTO t1 SELECT randomblob(100) FROM t1;
ROLLBACK;
PRAGMA integrity_check;
}
} {ok}
db1 close
forcedelete test.db
#-------------------------------------------------------------------------
#
do_test 1.1 {
sqlite3 db1 test.db
sqlite3 db2 test.db
db2 eval {
CREATE TABLE t1(x);
INSERT INTO t1 VALUES(123);
}
db1 eval {
SELECT * FROM t1;
CREATE INDEX i1 ON t1(x);
}
} {123}
do_test 1.2 {
db2 eval { SELECT * FROM t1 ORDER BY x; }
db1 eval {
BEGIN; DROP INDEX i1;
}
db1 close
db2 eval { SELECT * FROM t1 ORDER BY x; }
} {123}
do_test 1.3 {
db2 close
} {}
#-------------------------------------------------------------------------
#
# sqlite3RollbackAll() loops through all attached b-trees and rolls
# back each one separately. Then if the SQLITE_InternChanges flag is
# set, it resets the schema. Both of the above steps must be done
# while holding a mutex, otherwise another thread might slip in and
# try to use the new schema with the old data.
#
# The following sequence of tests attempt to verify that the actions
# taken by sqlite3RollbackAll() are thread-atomic (that they cannot be
# interrupted by a separate thread.)
#
# Note that a TCL interpreter can only be used within the thread in which
# it was originally created (because it uses thread-local-storage).
# The tvfs callbacks must therefore only run on the main thread.
# There is some trickery in the read_callback procedure to ensure that
# this is the case.
#
testvfs tvfs
# Set up two databases and two database connections.
#
# db1: main(test.db), two(test2.db)
# db2: main(test.db)
#
# The cache for test.db is shared between db1 and db2.
#
do_test 2.1 {
forcedelete test.db test.db2
sqlite3 db1 test.db -vfs tvfs
db1 eval { ATTACH 'test.db2' AS two }
db1 eval {
CREATE TABLE t1(x);
INSERT INTO t1 VALUES(1);
INSERT INTO t1 VALUES(2);
INSERT INTO t1 VALUES(3);
CREATE TABLE two.t2(x);
INSERT INTO t2 SELECT * FROM t1;
}
sqlite3 db2 test.db -vfs tvfs
db2 eval { SELECT * FROM t1 }
} {1 2 3}
# Create a prepared statement on db2 that will attempt a schema change
# in test.db. Meanwhile, start a transaction on db1 that changes
# the schema of test.db and that creates a rollback journal on test2.db
#
do_test 2.2 {
set ::STMT [sqlite3_prepare db2 "CREATE INDEX i1 ON t1(x)" -1 tail]
db1 eval {
BEGIN;
CREATE INDEX i1 ON t1(x);
INSERT INTO t2 VALUES('value!');
}
} {}
# Set up a callback that will cause db2 to try to execute its
# schema change when db1 accesses the journal file of test2.db.
#
# This callback will be invoked after the content of test.db has
# be rolled back but before the schema has been reset. If the
# sqlite3RollbackAll() operation is not thread-atomic, then the
# db2 statement in the callback will see old content with the newer
# schema, which is wrong.
#
tvfs filter xRead
tvfs script read_callback
unset -nocomplain ::some_time_laster
unset -nocomplain ::thread_result
proc read_callback {call file args} {
if {[string match *test.db2-journal $file]} {
tvfs filter {} ;# Ensure that tvfs callbacks to do run on the
# child thread
sqlthread spawn ::thread_result [subst -nocommands {
sqlite3_step $::STMT
set rc [sqlite3_finalize $::STMT]
}]
after 1000 { set ::some_time_later 1 }
vwait ::some_time_later
}
}
do_test 2.3 { db1 eval ROLLBACK } {}
# Verify that the db2 statement invoked by the callback detected the
# schema change.
#
if {[info exists ::thread_result]==0} { vwait ::thread_result }
do_test 2.4 {
list $::thread_result [sqlite3_errmsg db2]
} {SQLITE_SCHEMA {database schema has changed}}
db1 close
db2 close
tvfs delete
sqlite3_enable_shared_cache $::enable_shared_cache
finish_test

View File

@@ -1512,11 +1512,10 @@ do_test wal-23.3 {
faultsim_restore_and_reopen faultsim_restore_and_reopen
execsql { SELECT * FROM t1 } execsql { SELECT * FROM t1 }
} {1 2 3 4} } {1 2 3 4}
set nPage [expr 2+$AUTOVACUUM]
do_test wal-23.4 { do_test wal-23.4 {
set ::log set ::log
} [list SQLITE_NOTICE_RECOVER_WAL \ } [list SQLITE_NOTICE_RECOVER_WAL \
"recovered $nPage frames from WAL file $walfile"] "recovered 2 frames from WAL file $walfile"]
ifcapable autovacuum { ifcapable autovacuum {

View File

@@ -301,22 +301,26 @@ do_test where8-3.21.1 {
SELECT a, d FROM t1, ((t2)) AS t3 WHERE (a=d OR b=e) AND a<5 ORDER BY a SELECT a, d FROM t1, ((t2)) AS t3 WHERE (a=d OR b=e) AND a<5 ORDER BY a
} }
} {1 1 2 2 3 3 4 2 4 4 0 0} } {1 1 2 2 3 3 4 2 4 4 0 0}
if {[permutation] != "no_optimization"} {
do_test where8-3.21.2 { do_test where8-3.21.2 {
execsql_status { execsql_status {
SELECT a, d FROM t1, ((SELECT * FROM t2)) AS t3 WHERE (a=d OR b=e) AND a<5 ORDER BY a SELECT a, d FROM t1, ((SELECT * FROM t2)) AS t3 WHERE (a=d OR b=e) AND a<5 ORDER BY a
} }
} {1 1 2 2 3 3 4 2 4 4 0 0} } {1 1 2 2 3 3 4 2 4 4 0 0}
}
do_test where8-3.22 { do_test where8-3.22 {
execsql_status { execsql_status {
SELECT a, d FROM ((((((t1))), (((t2)))))) SELECT a, d FROM ((((((t1))), (((t2))))))
WHERE (a=d OR b=e) AND a<5 ORDER BY a WHERE (a=d OR b=e) AND a<5 ORDER BY a
} }
} {1 1 2 2 3 3 4 2 4 4 0 0} } {1 1 2 2 3 3 4 2 4 4 0 0}
if {[permutation] != "no_optimization"} {
do_test where8-3.23 { do_test where8-3.23 {
execsql_status { execsql_status {
SELECT * FROM ((SELECT * FROM t2)) AS t3; SELECT * FROM ((SELECT * FROM t2)) AS t3;
} }
} {1 {} I 2 four IV 3 {} IX 4 sixteen XVI 5 {} XXV 6 thirtysix XXXVI 7 fortynine XLIX 8 sixtyeight LXIV 9 eightyone LXXXIX 10 {} C 9 0} } {1 {} I 2 four IV 3 {} IX 4 sixteen XVI 5 {} XXV 6 thirtysix XXXVI 7 fortynine XLIX 8 sixtyeight LXIV 9 eightyone LXXXIX 10 {} C 9 0}
}
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
# The following tests - where8-4.* - verify that adding or removing # The following tests - where8-4.* - verify that adding or removing