Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fe88fbfc82 | |||
| 6e7722669e | |||
| 2476a6f2cb | |||
| d6b7946c32 | |||
| 3901692ede | |||
| 3adf8783b0 | |||
| f83075201f | |||
| 51675f24f3 | |||
| c750ee999e | |||
| 9ced20d892 | |||
| c8bb430dfe | |||
| ff621c6894 | |||
| 2ab410aa1e | |||
| dbbda39453 | |||
| aa8ff2ff6a | |||
| 06d7b00b6a | |||
| 8b8446fc21 | |||
| b1d607de25 | |||
| 9030d0ac28 | |||
| 70528d7868 | |||
| d82211db56 | |||
| 780b02de4a |
@@ -160,6 +160,7 @@ struct Fts5Config {
|
||||
int pgsz; /* Approximate page size used in %_data */
|
||||
int nAutomerge; /* 'automerge' setting */
|
||||
int nCrisisMerge; /* Maximum allowed segments per level */
|
||||
int nHashSize; /* Bytes of memory for in-memory hash */
|
||||
char *zRank; /* Name of rank function */
|
||||
char *zRankArgs; /* Arguments to rank function */
|
||||
|
||||
|
||||
+43
-25
@@ -20,6 +20,7 @@
|
||||
#define FTS5_DEFAULT_PAGE_SIZE 4050
|
||||
#define FTS5_DEFAULT_AUTOMERGE 4
|
||||
#define FTS5_DEFAULT_CRISISMERGE 16
|
||||
#define FTS5_DEFAULT_HASHSIZE (1024*1024)
|
||||
|
||||
/* Maximum allowed page size */
|
||||
#define FTS5_MAX_PAGE_SIZE (128*1024)
|
||||
@@ -706,33 +707,37 @@ int sqlite3Fts5ConfigParseRank(
|
||||
*pzRank = 0;
|
||||
*pzRankArgs = 0;
|
||||
|
||||
p = fts5ConfigSkipWhitespace(p);
|
||||
pRank = p;
|
||||
p = fts5ConfigSkipBareword(p);
|
||||
|
||||
if( p ){
|
||||
zRank = sqlite3Fts5MallocZero(&rc, 1 + p - pRank);
|
||||
if( zRank ) memcpy(zRank, pRank, p-pRank);
|
||||
}else{
|
||||
if( p==0 ){
|
||||
rc = SQLITE_ERROR;
|
||||
}
|
||||
}else{
|
||||
p = fts5ConfigSkipWhitespace(p);
|
||||
pRank = p;
|
||||
p = fts5ConfigSkipBareword(p);
|
||||
|
||||
if( rc==SQLITE_OK ){
|
||||
p = fts5ConfigSkipWhitespace(p);
|
||||
if( *p!='(' ) rc = SQLITE_ERROR;
|
||||
p++;
|
||||
}
|
||||
if( rc==SQLITE_OK ){
|
||||
const char *pArgs;
|
||||
p = fts5ConfigSkipWhitespace(p);
|
||||
pArgs = p;
|
||||
if( *p!=')' ){
|
||||
p = fts5ConfigSkipArgs(p);
|
||||
if( p==0 ){
|
||||
rc = SQLITE_ERROR;
|
||||
}else{
|
||||
zRankArgs = sqlite3Fts5MallocZero(&rc, 1 + p - pArgs);
|
||||
if( zRankArgs ) memcpy(zRankArgs, pArgs, p-pArgs);
|
||||
if( p ){
|
||||
zRank = sqlite3Fts5MallocZero(&rc, 1 + p - pRank);
|
||||
if( zRank ) memcpy(zRank, pRank, p-pRank);
|
||||
}else{
|
||||
rc = SQLITE_ERROR;
|
||||
}
|
||||
|
||||
if( rc==SQLITE_OK ){
|
||||
p = fts5ConfigSkipWhitespace(p);
|
||||
if( *p!='(' ) rc = SQLITE_ERROR;
|
||||
p++;
|
||||
}
|
||||
if( rc==SQLITE_OK ){
|
||||
const char *pArgs;
|
||||
p = fts5ConfigSkipWhitespace(p);
|
||||
pArgs = p;
|
||||
if( *p!=')' ){
|
||||
p = fts5ConfigSkipArgs(p);
|
||||
if( p==0 ){
|
||||
rc = SQLITE_ERROR;
|
||||
}else{
|
||||
zRankArgs = sqlite3Fts5MallocZero(&rc, 1 + p - pArgs);
|
||||
if( zRankArgs ) memcpy(zRankArgs, pArgs, p-pArgs);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -767,6 +772,18 @@ int sqlite3Fts5ConfigSetValue(
|
||||
}
|
||||
}
|
||||
|
||||
else if( 0==sqlite3_stricmp(zKey, "hashsize") ){
|
||||
int nHashSize = -1;
|
||||
if( SQLITE_INTEGER==sqlite3_value_numeric_type(pVal) ){
|
||||
nHashSize = sqlite3_value_int(pVal);
|
||||
}
|
||||
if( nHashSize<=0 ){
|
||||
*pbBadkey = 1;
|
||||
}else{
|
||||
pConfig->nHashSize = nHashSize;
|
||||
}
|
||||
}
|
||||
|
||||
else if( 0==sqlite3_stricmp(zKey, "automerge") ){
|
||||
int nAutomerge = -1;
|
||||
if( SQLITE_INTEGER==sqlite3_value_numeric_type(pVal) ){
|
||||
@@ -827,6 +844,7 @@ int sqlite3Fts5ConfigLoad(Fts5Config *pConfig, int iCookie){
|
||||
pConfig->pgsz = FTS5_DEFAULT_PAGE_SIZE;
|
||||
pConfig->nAutomerge = FTS5_DEFAULT_AUTOMERGE;
|
||||
pConfig->nCrisisMerge = FTS5_DEFAULT_CRISISMERGE;
|
||||
pConfig->nHashSize = FTS5_DEFAULT_HASHSIZE;
|
||||
|
||||
zSql = sqlite3Fts5Mprintf(&rc, zSelect, pConfig->zDb, pConfig->zName);
|
||||
if( zSql ){
|
||||
|
||||
@@ -288,7 +288,6 @@ struct Fts5Index {
|
||||
** in-memory hash tables before they are flushed to disk.
|
||||
*/
|
||||
Fts5Hash *pHash; /* Hash table for in-memory data */
|
||||
int nMaxPendingData; /* Max pending data before flush to disk */
|
||||
int nPendingData; /* Current bytes of pending data */
|
||||
i64 iWriteRowid; /* Rowid for current doc being written */
|
||||
int bDelete; /* Current write is a delete */
|
||||
@@ -4453,7 +4452,7 @@ int sqlite3Fts5IndexBeginWrite(Fts5Index *p, int bDelete, i64 iRowid){
|
||||
/* Flush the hash table to disk if required */
|
||||
if( iRowid<p->iWriteRowid
|
||||
|| (iRowid==p->iWriteRowid && p->bDelete==0)
|
||||
|| (p->nPendingData > p->nMaxPendingData)
|
||||
|| (p->nPendingData > p->pConfig->nHashSize)
|
||||
){
|
||||
fts5IndexFlush(p);
|
||||
}
|
||||
@@ -4519,7 +4518,6 @@ int sqlite3Fts5IndexOpen(
|
||||
if( rc==SQLITE_OK ){
|
||||
p->pConfig = pConfig;
|
||||
p->nWorkUnit = FTS5_WORK_UNIT;
|
||||
p->nMaxPendingData = 1024*1024;
|
||||
p->zDataTbl = sqlite3Fts5Mprintf(&rc, "%s_data", pConfig->zName);
|
||||
if( p->zDataTbl && bCreate ){
|
||||
rc = sqlite3Fts5CreateTable(
|
||||
|
||||
+40
-5
@@ -395,6 +395,15 @@ static int fts5InitVtab(
|
||||
rc = sqlite3Fts5ConfigDeclareVtab(pConfig);
|
||||
}
|
||||
|
||||
/* Load the initial configuration */
|
||||
if( rc==SQLITE_OK ){
|
||||
assert( pConfig->pzErrmsg==0 );
|
||||
pConfig->pzErrmsg = pzErr;
|
||||
rc = sqlite3Fts5IndexLoadConfig(pTab->pIndex);
|
||||
sqlite3Fts5IndexRollback(pTab->pIndex);
|
||||
pConfig->pzErrmsg = 0;
|
||||
}
|
||||
|
||||
if( rc!=SQLITE_OK ){
|
||||
fts5FreeVtab(pTab);
|
||||
pTab = 0;
|
||||
@@ -829,6 +838,36 @@ static int fts5NextMethod(sqlite3_vtab_cursor *pCursor){
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
static sqlite3_stmt *fts5PrepareStatement(
|
||||
int *pRc,
|
||||
Fts5Config *pConfig,
|
||||
const char *zFmt,
|
||||
...
|
||||
){
|
||||
sqlite3_stmt *pRet = 0;
|
||||
va_list ap;
|
||||
va_start(ap, zFmt);
|
||||
|
||||
if( *pRc==SQLITE_OK ){
|
||||
int rc;
|
||||
char *zSql = sqlite3_vmprintf(zFmt, ap);
|
||||
if( zSql==0 ){
|
||||
rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
rc = sqlite3_prepare_v2(pConfig->db, zSql, -1, &pRet, 0);
|
||||
if( rc!=SQLITE_OK ){
|
||||
*pConfig->pzErrmsg = sqlite3_mprintf("%s", sqlite3_errmsg(pConfig->db));
|
||||
}
|
||||
sqlite3_free(zSql);
|
||||
}
|
||||
*pRc = rc;
|
||||
}
|
||||
|
||||
va_end(ap);
|
||||
return pRet;
|
||||
}
|
||||
|
||||
static int fts5CursorFirstSorted(Fts5Table *pTab, Fts5Cursor *pCsr, int bDesc){
|
||||
Fts5Config *pConfig = pTab->pConfig;
|
||||
Fts5Sorter *pSorter;
|
||||
@@ -853,17 +892,13 @@ static int fts5CursorFirstSorted(Fts5Table *pTab, Fts5Cursor *pCsr, int bDesc){
|
||||
** table, saving it creates a circular reference.
|
||||
**
|
||||
** If SQLite a built-in statement cache, this wouldn't be a problem. */
|
||||
zSql = sqlite3Fts5Mprintf(&rc,
|
||||
pSorter->pStmt = fts5PrepareStatement(&rc, pConfig,
|
||||
"SELECT rowid, rank FROM %Q.%Q ORDER BY %s(%s%s%s) %s",
|
||||
pConfig->zDb, pConfig->zName, zRank, pConfig->zName,
|
||||
(zRankArgs ? ", " : ""),
|
||||
(zRankArgs ? zRankArgs : ""),
|
||||
bDesc ? "DESC" : "ASC"
|
||||
);
|
||||
if( zSql ){
|
||||
rc = sqlite3_prepare_v2(pConfig->db, zSql, -1, &pSorter->pStmt, 0);
|
||||
sqlite3_free(zSql);
|
||||
}
|
||||
|
||||
pCsr->pSorter = pSorter;
|
||||
if( rc==SQLITE_OK ){
|
||||
|
||||
@@ -52,7 +52,7 @@ do_faultsim_test 2 -prep {
|
||||
INSERT INTO t1 VALUES('a b c', 'a bc def ghij klmno');
|
||||
}
|
||||
} -test {
|
||||
faultsim_test_result {0 {}}
|
||||
faultsim_test_result {0 {}} {1 {vtable constructor failed: t1}}
|
||||
}
|
||||
|
||||
reset_db
|
||||
@@ -66,7 +66,7 @@ do_faultsim_test 3 -prep {
|
||||
} -body {
|
||||
execsql { DELETE FROM t1 }
|
||||
} -test {
|
||||
faultsim_test_result {0 {}}
|
||||
faultsim_test_result {0 {}} {1 {vtable constructor failed: t1}}
|
||||
}
|
||||
|
||||
reset_db
|
||||
@@ -101,7 +101,7 @@ foreach {tn expr res} {
|
||||
} -body "
|
||||
execsql { SELECT rowid FROM t2 WHERE t2 MATCH '$expr' }
|
||||
" -test "
|
||||
faultsim_test_result {[list 0 $res]}
|
||||
faultsim_test_result {[list 0 $res]} {1 {vtable constructor failed: t2}}
|
||||
"
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ set ::res [db eval {SELECT rowid, x1 FROM x1 WHERE x1 MATCH '*reads'}]
|
||||
do_faultsim_test 4 -faults oom-* -body {
|
||||
db eval {SELECT rowid, x, x1 FROM x1 WHERE x1 MATCH '*reads'}
|
||||
} -test {
|
||||
faultsim_test_result {0 {0 {} 3}}
|
||||
faultsim_test_result {0 {0 {} 4}}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@@ -41,5 +41,60 @@ do_execsql_test 1.3 {
|
||||
WHERE xyz MATCH 'x AND y' ORDER BY rank
|
||||
} [list [string map {x [x] y [y]} $doc]]
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Check that the 'rank' option really is persistent.
|
||||
#
|
||||
do_execsql_test 2.0 {
|
||||
CREATE VIRTUAL TABLE tt USING fts5(a);
|
||||
INSERT INTO tt VALUES('a x x x x');
|
||||
INSERT INTO tt VALUES('x x a a a');
|
||||
INSERT INTO tt VALUES('x a a x x');
|
||||
}
|
||||
|
||||
proc firstinst {cmd} {
|
||||
foreach {p c o} [$cmd xInst 0] {}
|
||||
return $o
|
||||
}
|
||||
sqlite3_fts5_create_function db firstinst firstinst
|
||||
|
||||
do_execsql_test 2.1 {
|
||||
SELECT rowid FROM tt('a') ORDER BY rank;
|
||||
} {2 3 1}
|
||||
|
||||
do_execsql_test 2.2 {
|
||||
SELECT rowid FROM tt('a', 'firstinst()') ORDER BY rank;
|
||||
} {1 3 2}
|
||||
|
||||
do_execsql_test 2.3 {
|
||||
INSERT INTO tt(tt, rank) VALUES('rank', 'firstinst()');
|
||||
SELECT rowid FROM tt('a') ORDER BY rank;
|
||||
} {1 3 2}
|
||||
|
||||
do_test 2.4 {
|
||||
sqlite3 db2 test.db
|
||||
catchsql { SELECT rowid FROM tt('a') ORDER BY rank; } db2
|
||||
} {1 {no such function: firstinst}}
|
||||
|
||||
do_test 2.5 {
|
||||
db2 close
|
||||
sqlite3 db2 test.db
|
||||
sqlite3_fts5_create_function db2 firstinst firstinst
|
||||
execsql { SELECT rowid FROM tt('a') ORDER BY rank; } db2
|
||||
} {1 3 2}
|
||||
|
||||
do_test 2.6 {
|
||||
execsql { SELECT rowid FROM tt('a') ORDER BY rank; } db2
|
||||
} {1 3 2}
|
||||
|
||||
do_test 2.7 {
|
||||
execsql { SELECT rowid FROM tt('a') ORDER BY rank; } db
|
||||
} {1 3 2}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
finish_test
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ ifcapable !fts5 {
|
||||
finish_test
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
set doc "x x [string repeat {y } 50]z z"
|
||||
@@ -322,5 +322,34 @@ do_execsql_test 13.3 {
|
||||
INSERT INTO xy(xy) VALUES('integrity-check');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
do_execsql_test 14.1 {
|
||||
CREATE VIRTUAL TABLE ttt USING fts5(x);
|
||||
BEGIN;
|
||||
INSERT INTO ttt(rowid, x) VALUES(1, 'a b c');
|
||||
INSERT INTO ttt(rowid, x) VALUES(2, 'a b c');
|
||||
INSERT INTO ttt(rowid, x) VALUES(3, 'a b c');
|
||||
COMMIT;
|
||||
}
|
||||
do_test 14.2 {
|
||||
fts5_level_segs ttt
|
||||
} {1}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
db func rnddoc fts5_rnddoc
|
||||
do_execsql_test 4.0 {
|
||||
CREATE VIRTUAL TABLE x1 USING fts5(x);
|
||||
INSERT INTO x1(x1, rank) VALUES('pgsz', 32);
|
||||
|
||||
WITH ii(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM ii WHERE i<10 )
|
||||
INSERT INTO x1 SELECT rnddoc(5) FROM ii;
|
||||
}
|
||||
|
||||
do_execsql_test 4.1 {
|
||||
SELECT rowid, x, x1 FROM x1 WHERE x1 MATCH '*reads'
|
||||
} {0 {} 4}
|
||||
|
||||
|
||||
finish_test
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ proc usage {} {
|
||||
puts stderr " -crisismerge N (set the crisismerge parameter to N)"
|
||||
puts stderr " -prefix PREFIX (comma separated prefix= argument)"
|
||||
puts stderr " -trans N (commit after N inserts - 0 == never)"
|
||||
puts stderr " -hashsize N (set the fts5 hashsize parameter to N)"
|
||||
exit 1
|
||||
}
|
||||
|
||||
@@ -59,6 +60,7 @@ set O(automerge) -1
|
||||
set O(crisismerge) -1
|
||||
set O(prefix) ""
|
||||
set O(trans) 0
|
||||
set O(hashsize) -1
|
||||
|
||||
if {[llength $argv]<2} usage
|
||||
set nOpt [expr {[llength $argv]-2}]
|
||||
@@ -106,6 +108,11 @@ for {set i 0} {$i < $nOpt} {incr i} {
|
||||
set O(prefix) [lindex $argv $i]
|
||||
}
|
||||
|
||||
-hashsize {
|
||||
if { [incr i]>=$nOpt } usage
|
||||
set O(hashsize) [lindex $argv $i]
|
||||
}
|
||||
|
||||
default {
|
||||
usage
|
||||
}
|
||||
@@ -126,6 +133,14 @@ db eval BEGIN
|
||||
db eval "CREATE VIRTUAL TABLE t1 USING $O(vtab) (path, content$O(tok)$pref)"
|
||||
db eval "INSERT INTO t1(t1, rank) VALUES('pgsz', 4050);"
|
||||
}
|
||||
|
||||
if {$O(hashsize)>=0} {
|
||||
catch {
|
||||
db eval "INSERT INTO t1(t1, rank) VALUES('hashsize', $O(hashsize));"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if {$O(automerge)>=0} {
|
||||
if {$O(vtab) == "fts5"} {
|
||||
db eval { INSERT INTO t1(t1, rank) VALUES('automerge', $O(automerge)) }
|
||||
@@ -141,6 +156,7 @@ db eval BEGIN
|
||||
}
|
||||
load_hierachy [lindex $argv end]
|
||||
db eval COMMIT
|
||||
puts ""
|
||||
|
||||
|
||||
|
||||
|
||||
+3
-3
@@ -94,16 +94,16 @@ static void ieee754func(
|
||||
m >>= 1;
|
||||
e++;
|
||||
}
|
||||
while( ((m>>32)&0xfff00000)==0 ){
|
||||
while( m!=0 && ((m>>32)&0xfff00000)==0 ){
|
||||
m <<= 1;
|
||||
e--;
|
||||
}
|
||||
e += 1075;
|
||||
if( e<0 ) e = m = 0;
|
||||
if( e>0x7ff ) m = 0;
|
||||
if( e>0x7ff ) e = 0x7ff;
|
||||
a = m & ((((sqlite3_int64)1)<<52)-1);
|
||||
a |= e<<52;
|
||||
if( isNeg ) a |= ((sqlite3_int64)1)<<63;
|
||||
if( isNeg ) a |= ((sqlite3_uint64)1)<<63;
|
||||
memcpy(&r, &a, sizeof(r));
|
||||
sqlite3_result_double(context, r);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
C Remove\s#pragma\sthat\swas\sused\sto\swork\saround\san\sobsolete\sissue\swith\sMSVC\s2012.
|
||||
D 2015-11-05T03:26:36.026
|
||||
C Add\stest\scases\sfor\sWITH\sclauses.
|
||||
D 2015-11-07T17:51:39.619
|
||||
F Makefile.in 3a705bb4bd12e194212ddbdbf068310d17153cdb
|
||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||
F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4
|
||||
@@ -103,14 +103,14 @@ F ext/fts3/unicode/mkunicode.tcl 95cf7ec186e48d4985e433ff8a1c89090a774252
|
||||
F ext/fts3/unicode/parseunicode.tcl da577d1384810fb4e2b209bf3313074353193e95
|
||||
F ext/fts5/extract_api_docs.tcl a36e54ec777172ddd3f9a88daf593b00848368e0
|
||||
F ext/fts5/fts5.h 8b9a13b309b180e9fb88ea5666c0d8d73c6102d9
|
||||
F ext/fts5/fts5Int.h 06594fd3e5a3c74da6df9141e165975dc0ea6ef4
|
||||
F ext/fts5/fts5Int.h acf968e43d57b6b1caf7554d34ec35d6ed3b4fe8
|
||||
F ext/fts5/fts5_aux.c 1f384972d606375b8fa078319f25ab4b5feb1b35
|
||||
F ext/fts5/fts5_buffer.c 1e49512a535045e621246dc7f4f65f3593fa0fc2
|
||||
F ext/fts5/fts5_config.c 88a77f5d5e4dfbb2355b8f6cc9969b7f02d94685
|
||||
F ext/fts5/fts5_config.c 6fc92c0b1bda5244c28a54c9ba740736bd5513d9
|
||||
F ext/fts5/fts5_expr.c 28b15c9ae296204bc0a2e5cf7a667d840a9d2900
|
||||
F ext/fts5/fts5_hash.c a9d4c1efebc2a91d26ad7ebdfcbf2678ceac405f
|
||||
F ext/fts5/fts5_index.c 356481ce027cc2ede8e462c316b578260cda29d2
|
||||
F ext/fts5/fts5_main.c 39358d3d8f0d6ea3757c40e0ddcbb6bc435604c3
|
||||
F ext/fts5/fts5_index.c b622a0a70f57a96469e6828da2dd70e0872aeb37
|
||||
F ext/fts5/fts5_main.c 0569cd9fc18f3b56f6eeac601836df8ed5fb54cb
|
||||
F ext/fts5/fts5_storage.c 9ea3d92178743758b6c54d9fe8836bbbdcc92e3b
|
||||
F ext/fts5/fts5_tcl.c 3bf445e66de32137d4693694ff7b1fd6074e32bd
|
||||
F ext/fts5/fts5_test_mi.c e96be827aa8f571031e65e481251dc1981d608bf
|
||||
@@ -149,10 +149,10 @@ F ext/fts5/test/fts5dlidx.test ecba5e62ea8b26c33829961602069c546228046d
|
||||
F ext/fts5/test/fts5doclist.test 8edb5b57e5f144030ed74ec00ef6fa4294fed79b
|
||||
F ext/fts5/test/fts5ea.test b01e3a18cdfabbff8104a96a5242a06a68a998a0
|
||||
F ext/fts5/test/fts5eb.test 3e5869af2008cbc4ad03a175a0b6f6e58134cd43
|
||||
F ext/fts5/test/fts5fault1.test 7a562367cb4a735b57b410dbdb62dcc8d971faec
|
||||
F ext/fts5/test/fts5fault1.test 4b39c47ca3544615daa8a2f733b911fa08022c77
|
||||
F ext/fts5/test/fts5fault2.test 28c36c843bb39ae855ba79827417ecc37f114341
|
||||
F ext/fts5/test/fts5fault3.test d6e9577d4312e331a913c72931bf131704efc8f3
|
||||
F ext/fts5/test/fts5fault4.test 762991d526ee67c2b374351a17248097ea38bee7
|
||||
F ext/fts5/test/fts5fault4.test 4864f2b5c2c083440dbe85aff60897bc1aa04603
|
||||
F ext/fts5/test/fts5fault5.test f2b8645053d48982e8979749e93994c43011c118
|
||||
F ext/fts5/test/fts5fault6.test 9682664d679643ac6736e90c225526cc84073cda
|
||||
F ext/fts5/test/fts5fault7.test 01be274bfc8d9bf22451a3bf5892e9399d044f1b
|
||||
@@ -170,11 +170,11 @@ F ext/fts5/test/fts5porter.test 7cdc07bef301d70eebbfa75dcaf45c3680e1d0e1
|
||||
F ext/fts5/test/fts5porter2.test 2e65633d58a1c525d5af0f6c01e5a59155bb3487
|
||||
F ext/fts5/test/fts5prefix.test 7ccbdf180ed561a912acef520519e85af8642239
|
||||
F ext/fts5/test/fts5query.test f5ec25f5f2fbb70033424113cdffc101b1985a40
|
||||
F ext/fts5/test/fts5rank.test 11dcebba31d822f7e99685b4ea2c2ae3ec0b16f1
|
||||
F ext/fts5/test/fts5rank.test 7e9e64eac7245637f6f2033aec4b292aaf611aab
|
||||
F ext/fts5/test/fts5rebuild.test 03935f617ace91ed23a6099c7c74d905227ff29b
|
||||
F ext/fts5/test/fts5restart.test c17728fdea26e7d0f617d22ad5b4b2862b994c17
|
||||
F ext/fts5/test/fts5rowid.test 400384798349d658eaf06aefa1e364957d5d4821
|
||||
F ext/fts5/test/fts5simple.test 41333e267c6145efc3620342af53dfe65d5676b7
|
||||
F ext/fts5/test/fts5simple.test 9bded45827b4ab8933c87b7b3bcc3cd47f7378a4
|
||||
F ext/fts5/test/fts5synonym.test cf88c0a56d5ea9591e3939ef1f6e294f7f2d0671
|
||||
F ext/fts5/test/fts5tokenizer.test ea4df698b35cc427ebf2ba22829d0e28386d8c89
|
||||
F ext/fts5/test/fts5unicode.test fbef8d8a3b4b88470536cc57604a82ca52e51841
|
||||
@@ -184,7 +184,7 @@ F ext/fts5/test/fts5unindexed.test e9539d5b78c677315e7ed8ea911d4fd25437c680
|
||||
F ext/fts5/test/fts5version.test 978f59541d8cef7e8591f8be2115ec5ccb863e2e
|
||||
F ext/fts5/test/fts5vocab.test c88a5554d0409494da95ba647bbdb4879b2624b0
|
||||
F ext/fts5/tool/fts5txt2db.tcl c374c4c4797e8cdfadabdfaeeb5412dcd6686e84
|
||||
F ext/fts5/tool/loadfts5.tcl 58e90407cc5c2b1770460119488fd7c0090d4dd3
|
||||
F ext/fts5/tool/loadfts5.tcl 4cc2d6af43b58d4fac05bc4fdabd0e5862c3b2c1
|
||||
F ext/fts5/tool/mkfts5c.tcl d1c2a9ab8e0ec690a52316f33dd9b1d379942f45
|
||||
F ext/fts5/tool/showfts5.tcl d54da0e067306663e2d5d523965ca487698e722c
|
||||
F ext/icu/README.txt d9fbbad0c2f647c3fdf715fc9fd64af53aedfc43
|
||||
@@ -196,7 +196,7 @@ F ext/misc/compress.c 122faa92d25033d6c3f07c39231de074ab3d2e83
|
||||
F ext/misc/eval.c f971962e92ebb8b0a4e6b62949463ee454d88fa2
|
||||
F ext/misc/fileio.c d4171c815d6543a9edef8308aab2951413cd8d0f
|
||||
F ext/misc/fuzzer.c 4c84635c71c26cfa7c2e5848cf49fe2d2cfcd767
|
||||
F ext/misc/ieee754.c b0362167289170627659e84173f5d2e8fee8566e
|
||||
F ext/misc/ieee754.c f190d0cc5182529acb15babd177781be1ac1718c
|
||||
F ext/misc/json1.c 4f45afd9dbcd6feca8c528251efbb7fc09299a09
|
||||
F ext/misc/nextchar.c 35c8b8baacb96d92abbb34a83a997b797075b342
|
||||
F ext/misc/percentile.c bcbee3c061b884eccb80e21651daaae8e1e43c63
|
||||
@@ -282,8 +282,8 @@ F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240
|
||||
F src/backup.c 2869a76c03eb393ee795416e2387005553df72bc
|
||||
F src/bitvec.c d1f21d7d91690747881f03940584f4cc548c9d3d
|
||||
F src/btmutex.c 45a968cc85afed9b5e6cf55bf1f42f8d18107f79
|
||||
F src/btree.c 233c1536927b12d820cb0a19c657c59837f9334f
|
||||
F src/btree.h b512723e4f27d7ba16b4b985cdecdb82c0f6d0c0
|
||||
F src/btree.c 9e5d713bf54be8bfcae9b60210173dd53570f56d
|
||||
F src/btree.h 1b8bf2818b5e256c25a5e09126720113b1d783da
|
||||
F src/btreeInt.h 3ab435ed27adea54d040584b0bcc488ee7db1e38
|
||||
F src/build.c ca574d33ffb1763cfd2979383f4d507095bfbe19
|
||||
F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0
|
||||
@@ -340,17 +340,17 @@ F src/printf.c 0c4bcdd1c2e2521024f0a69cb5eb334f86b3652a
|
||||
F src/random.c ba2679f80ec82c4190062d756f22d0c358180696
|
||||
F src/resolve.c 1954a0f01bf65d78d7d559aea3d5c67f33376d91
|
||||
F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e
|
||||
F src/select.c 167b4e9058bc8e997d18d6b6b20ecbb0c9c457af
|
||||
F src/select.c 00a2a10d4298a685d0eeb05b09ef018a2bd81bf8
|
||||
F src/shell.c d25df04168d6ba5a4fa05bdbf859df667f9eb621
|
||||
F src/sqlite.h.in 3cfc86c55e57c63d86b9e1e92869e2bfb162ca8e
|
||||
F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad
|
||||
F src/sqlite3ext.h 4b66e3e3435da4b4c8c83696d0349f0c503b3924
|
||||
F src/sqliteInt.h b1e72ffe282c91ae30a2bf403319126dbaebd556
|
||||
F src/sqliteInt.h bc6d24460fe544323517630b1e20539146379077
|
||||
F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46
|
||||
F src/status.c 70912d7be68e9e2dbc4010c93d344af61d4c59ba
|
||||
F src/table.c 51b46b2a62d1b3a959633d593b89bab5e2c9155e
|
||||
F src/tclsqlite.c d9439b6a910985b7fff43ba6756bcef00de22649
|
||||
F src/test1.c 9ac5cbfe3c859ab7518edc5109a2959d6bf7b059
|
||||
F src/test1.c a719afff3144f7f01c6dc3f7d118ac31d15e7527
|
||||
F src/test2.c 5586f43fcd9a1be0830793cf9d354082c261b25b
|
||||
F src/test3.c a8887dabbbee3059af338f20d290084a63ed1b0f
|
||||
F src/test4.c d168f83cc78d02e8d35567bb5630e40dcd85ac1e
|
||||
@@ -396,18 +396,18 @@ F src/test_vfs.c 3b65d42e18b262805716bd96178c81da8f2d9283
|
||||
F src/test_vfstrace.c bab9594adc976cbe696ff3970728830b4c5ed698
|
||||
F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
|
||||
F src/threads.c bbfb74450643cb5372a43ad4f6cffd7e9dfcecb0
|
||||
F src/tokenize.c 338bc8f7c9dd103188952cda7964696bacac6d22
|
||||
F src/treeview.c 154f0acc622fa3514de8777dcedf4c8a8802b4ce
|
||||
F src/tokenize.c b05b63e224a12531813efda3bcc73e9438958745
|
||||
F src/treeview.c 78842e90c1f71269e7a73a1d4221b6fe360bab66
|
||||
F src/trigger.c 322f23aad694e8f31d384dcfa386d52a48d3c52f
|
||||
F src/update.c 40e51cd0883cb5bfd6abb7d8a7cd8aa47fab2945
|
||||
F src/utf.c fc6b889ba0779b7722634cdeaa25f1930d93820c
|
||||
F src/util.c fc612367108b74573c5fd13a85d0a23027f438bd
|
||||
F src/vacuum.c 2ddd5cad2a7b9cef7f9e431b8c7771634c6b1701
|
||||
F src/vdbe.c dfbaae2570172c523bce14299021d352b8508f7f
|
||||
F src/vdbe.c 7a9b18027414368d800716e6319e2acd699c70db
|
||||
F src/vdbe.h efb7a8c1459e31f3ea4377824c6a7e4cb5068637
|
||||
F src/vdbeInt.h 33403622c6a8feaaac5f0f3f17f5d1bf6df42286
|
||||
F src/vdbeapi.c 020681b943e77766b32ae1cddf86d7831b7374ca
|
||||
F src/vdbeaux.c 717bc2ae9cc0b58ef398fff44bd9164bfd96772a
|
||||
F src/vdbeaux.c 6d55530b05b69bc663c87d2d258318dcdf042644
|
||||
F src/vdbeblob.c 565fabd302f5fca3bdf3d56cac330483616a39b6
|
||||
F src/vdbemem.c fdd1578e47bea61390d472de53c565781d81e045
|
||||
F src/vdbesort.c 8b23930a1289526f6d2a3a9f2e965bcc963e4a68
|
||||
@@ -453,7 +453,7 @@ F test/async2.test c0a9bd20816d7d6a2ceca7b8c03d3d69c28ffb8b
|
||||
F test/async3.test d73a062002376d7edc1fe3edff493edbec1fc2f7
|
||||
F test/async4.test 1787e3952128aa10238bf39945126de7ca23685a
|
||||
F test/async5.test 383ab533fdb9f7ad228cc99ee66e1acb34cc0dc0
|
||||
F test/atof1.test 08a61df9365c341f334a65f4348897312d8f3db7
|
||||
F test/atof1.test ff0b0156fd705b67c506e1f2bfe9e26102bea9bd
|
||||
F test/attach.test 437107943f14d131cf5efc2ae5305a94d7cb1d58
|
||||
F test/attach2.test 0ec5defa340363de6cd50fd595046465e9aaba2d
|
||||
F test/attach3.test 359eb65d00102cdfcef6fa4e81dc1648f8f80b27
|
||||
@@ -519,7 +519,7 @@ F test/coalesce.test cee0dccb9fbd2d494b77234bccf9dc6c6786eb91
|
||||
F test/collate1.test 08c18e7512a5a32c97938854263fa15362eeb846
|
||||
F test/collate2.test 9aaa410a00734e48bcb27f3872617d6f69b2a621
|
||||
F test/collate3.test 89defc49983ddfbf0a0555aca8c0521a676f56a5
|
||||
F test/collate4.test f04d5168685f2eef637ecfa2d4ddf8ec0d600177
|
||||
F test/collate4.test c953715fb498b87163e3e73dd94356bff1f317bd
|
||||
F test/collate5.test 65d928034d30d2d263a80f6359f7549ee1598ec6
|
||||
F test/collate6.test 8be65a182abaac8011a622131486dafb8076e907
|
||||
F test/collate7.test 8ec29d98f3ee4ccebce6e16ce3863fb6b8c7b868
|
||||
@@ -765,6 +765,7 @@ F test/genesis.tcl 1e2e2e8e5cc4058549a154ff1892fe5c9de19f98
|
||||
F test/hexlit.test 1d312fa816dfd3650a3bb488093bc09a0c927f67
|
||||
F test/hook.test 162d7cef7a2d2b04839fe14402934e6a1b79442f
|
||||
F test/icu.test 70df4faca133254c042d02ae342c0a141f2663f4
|
||||
F test/ieee754.test 118b665a97a8df0e8f2fbdb07d113e596f4a6b53
|
||||
F test/imposter1.test c3f1db2d3db2c24611a6596a3fc0ffc14f1466c8
|
||||
F test/in.test 61a24ae38d4b64ec69f06ccdf022992f68a98176
|
||||
F test/in2.test 5d4c61d17493c832f7d2d32bef785119e87bde75
|
||||
@@ -902,6 +903,7 @@ F test/notify3.test 10ff25cde502e72a92053a2f215d64bece4ef934
|
||||
F test/notnull.test f8fcf58669ddba79274daa2770d61dfad8274f62
|
||||
F test/null.test 0dcce4f04284ec66108c503327ad6d224c0752b3
|
||||
F test/numcast.test 5d126f7f581432e86a90d1e35cac625164aec4a1
|
||||
F test/numindex1.test 20a5450d4b056e48cd5db30e659f13347a099823
|
||||
F test/offset1.test f06b83657bcf26f9ce805e67450e189e282143b2
|
||||
F test/openv2.test 0d3040974bf402e19b7df4b783e447289d7ab394
|
||||
F test/orderby1.test 870e150450437d3980badbde3d0166b81d9e33f6
|
||||
@@ -928,7 +930,7 @@ F test/parser1.test 222b5cbf3e2e659fec1bf7d723488c8b9c94f1d0
|
||||
F test/pcache.test c8acbedd3b6fd0f9a7ca887a83b11d24a007972b
|
||||
F test/pcache2.test af7f3deb1a819f77a6d0d81534e97d1cf62cd442
|
||||
F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff
|
||||
F test/permutations.test 0be620cfc7309d72b0608b3f1cbadef1034417fa
|
||||
F test/permutations.test 4ea119731c62d2f7d0aa86dd5b184cbb61ca411b
|
||||
F test/pragma.test a44253f911e7d50127d4a08f927f47c861a4c772
|
||||
F test/pragma2.test b5e2ce4c892afceb308c6ae6163a9099b2a0d8d7
|
||||
F test/pragma3.test 6f849ccffeee7e496d2f2b5e74152306c0b8757c
|
||||
@@ -948,7 +950,7 @@ F test/rbu.test 168573d353cd0fd10196b87b0caa322c144ef736
|
||||
F test/rdonly.test 64e2696c322e3538df0b1ed624e21f9a23ed9ff8
|
||||
F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8
|
||||
F test/reindex.test 44edd3966b474468b823d481eafef0c305022254
|
||||
F test/releasetest.tcl c12c4122a7b2ddec16b5f8fb9163f7a008886005
|
||||
F test/releasetest.tcl 2d000ceded3115758be96abb9c10a5669fb27862
|
||||
F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb
|
||||
F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea
|
||||
F test/rollback2.test fc14cf6d1a2b250d2735ef16124b971bce152f14
|
||||
@@ -1301,10 +1303,10 @@ F test/walro.test 34422d1d95aaff0388f0791ec20edb34e2a3ed57
|
||||
F test/walshared.test 0befc811dcf0b287efae21612304d15576e35417
|
||||
F test/walslow.test e7be6d9888f83aa5d3d3c7c08aa9b5c28b93609a
|
||||
F test/walthread.test de8dbaf6d9e41481c460ba31ca61e163d7348f8e
|
||||
F test/where.test 66d4c107e82dfe86c01a96277b77e7a8809aff0b
|
||||
F test/where.test 9902a3d84e9bc80357a2c54ed0e76c0d6d04a867
|
||||
F test/where2.test af78c55589cbc82d793449493adba0dc3d659f23
|
||||
F test/where3.test 1ad55ba900bd7747f98b6082e65bd3e442c5004e
|
||||
F test/where4.test 44f506bf1737cf0fa4fc795e340208250f1fcd89
|
||||
F test/where4.test 4a371bfcc607f41d233701bdec33ac2972908ba8
|
||||
F test/where5.test fdf66f96d29a064b63eb543e28da4dfdccd81ad2
|
||||
F test/where6.test 5da5a98cec820d488e82708301b96cb8c18a258b
|
||||
F test/where7.test 5a4b0abc207d71da4deecd734ad8579e8dd40aa8
|
||||
@@ -1327,8 +1329,9 @@ F test/wild001.test bca33f499866f04c24510d74baf1e578d4e44b1c
|
||||
F test/win32heap.test ea19770974795cff26e11575e12d422dbd16893c
|
||||
F test/win32lock.test fbf107c91d8f5512be5a5b87c4c42ab9fdd54972
|
||||
F test/win32longpath.test 169c75a3b2e43481f4a62122510210c67b08f26d
|
||||
F test/with1.test a1e8660be88e2eb4648f8860f831d1e38b5b5443
|
||||
F test/with1.test 05c8fc7f809f178a8a0519f02c21fe430948c895
|
||||
F test/with2.test 2b40da883658eb74ad8ad06afabe11a408e7fb87
|
||||
F test/with3.test 511bacdbe41c49cf34f9fd1bd3245fe1575bca98
|
||||
F test/withM.test e97f2a8c506ab3ea9eab94e6f6072f6cc924c991
|
||||
F test/without_rowid1.test 1a7b9bd51b899928d327052df9741d2fe8dbe701
|
||||
F test/without_rowid2.test af260339f79d13cb220288b67cd287fbcf81ad99
|
||||
@@ -1398,10 +1401,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
P 2aa50f6f2029e3c91a4cb91224df8ec1194f215e
|
||||
R 8f915e54b493516d25c62a2e6e65196c
|
||||
T *branch * reoptimizeArm
|
||||
T *sym-reoptimizeArm *
|
||||
T -sym-trunk *
|
||||
U mistachkin
|
||||
Z fcf933a8c4c4c19e441c1b9f4ebd2411
|
||||
P 028475cb17a4b50baf0e9aba9bd3403d0a5d03b0
|
||||
R 0a66e1cb90e0f88ea5b94da656f84e5f
|
||||
U dan
|
||||
Z 560670311488774642220bf984dfc3d3
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
b9b22fae69000ca506656f9cf847e713c6304b75
|
||||
e7e65c7559ed43e7065adc2ec1bd242bf187b7c3
|
||||
+2
-2
@@ -5041,6 +5041,8 @@ int sqlite3BtreeLast(BtCursor *pCur, int *pRes){
|
||||
** *pRes>0 The cursor is left pointing at an entry that
|
||||
** is larger than intKey/pIdxKey.
|
||||
**
|
||||
** For index tables, the pIdxKey->eqSeen field is set to 1 if there
|
||||
** exists an entry in the table that exactly matches pIdxKey.
|
||||
*/
|
||||
int sqlite3BtreeMovetoUnpacked(
|
||||
BtCursor *pCur, /* The cursor to be moved */
|
||||
@@ -9644,7 +9646,6 @@ int sqlite3BtreeSetVersion(Btree *pBtree, int iVersion){
|
||||
return rc;
|
||||
}
|
||||
|
||||
#ifdef SQLITE_DEBUG
|
||||
/*
|
||||
** Return true if the cursor has a hint specified. This routine is
|
||||
** only used from within assert() statements
|
||||
@@ -9652,7 +9653,6 @@ int sqlite3BtreeSetVersion(Btree *pBtree, int iVersion){
|
||||
int sqlite3BtreeCursorHasHint(BtCursor *pCsr, unsigned int mask){
|
||||
return (pCsr->hints & mask)!=0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Return true if the given Btree is read-only.
|
||||
|
||||
@@ -257,9 +257,7 @@ int sqlite3BtreePutData(BtCursor*, u32 offset, u32 amt, void*);
|
||||
void sqlite3BtreeIncrblobCursor(BtCursor *);
|
||||
void sqlite3BtreeClearCursor(BtCursor *);
|
||||
int sqlite3BtreeSetVersion(Btree *pBt, int iVersion);
|
||||
#ifdef SQLITE_DEBUG
|
||||
int sqlite3BtreeCursorHasHint(BtCursor*, unsigned int mask);
|
||||
#endif
|
||||
int sqlite3BtreeIsReadonly(Btree *pBt);
|
||||
int sqlite3HeaderSizeBtree(void);
|
||||
|
||||
|
||||
+5
-3
@@ -3972,7 +3972,7 @@ static int convertCompoundSelectToSubquery(Walker *pWalker, Select *p){
|
||||
** object that the returned CTE belongs to.
|
||||
*/
|
||||
static struct Cte *searchWith(
|
||||
With *pWith, /* Current outermost WITH clause */
|
||||
With *pWith, /* Current innermost WITH clause */
|
||||
struct SrcList_item *pItem, /* FROM clause element to resolve */
|
||||
With **ppContext /* OUT: WITH clause return value belongs to */
|
||||
){
|
||||
@@ -4003,11 +4003,12 @@ static struct Cte *searchWith(
|
||||
** statement with which it is associated.
|
||||
*/
|
||||
void sqlite3WithPush(Parse *pParse, With *pWith, u8 bFree){
|
||||
assert( bFree==0 || pParse->pWith==0 );
|
||||
assert( bFree==0 || (pParse->pWith==0 && pParse->pWithToFree==0) );
|
||||
if( pWith ){
|
||||
assert( pParse->pWith!=pWith );
|
||||
pWith->pOuter = pParse->pWith;
|
||||
pParse->pWith = pWith;
|
||||
pParse->bFreeWith = bFree;
|
||||
if( bFree ) pParse->pWithToFree = pWith;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4100,6 +4101,7 @@ static int withExpand(
|
||||
pSavedWith = pParse->pWith;
|
||||
pParse->pWith = pWith;
|
||||
sqlite3WalkSelect(pWalker, bMayRecursive ? pSel->pPrior : pSel);
|
||||
pParse->pWith = pWith;
|
||||
|
||||
for(pLeft=pSel; pLeft->pPrior; pLeft=pLeft->pPrior);
|
||||
pEList = pLeft->pEList;
|
||||
|
||||
+31
-11
@@ -1812,9 +1812,8 @@ struct KeyInfo {
|
||||
};
|
||||
|
||||
/*
|
||||
** An instance of the following structure holds information about a
|
||||
** single index record that has already been parsed out into individual
|
||||
** values.
|
||||
** This object holds a record which has been parsed out into individual
|
||||
** fields, for the purposes of doing a comparison.
|
||||
**
|
||||
** A record is an object that contains one or more fields of data.
|
||||
** Records are used to store the content of a table row and to store
|
||||
@@ -1822,20 +1821,40 @@ struct KeyInfo {
|
||||
** the OP_MakeRecord opcode of the VDBE and is disassembled by the
|
||||
** OP_Column opcode.
|
||||
**
|
||||
** This structure holds a record that has already been disassembled
|
||||
** into its constituent fields.
|
||||
** An instance of this object serves as a "key" for doing a search on
|
||||
** an index b+tree. The goal of the search is to find the entry that
|
||||
** is closed to the key described by this object. This object might hold
|
||||
** just a prefix of the key. The number of fields is given by
|
||||
** pKeyInfo->nField.
|
||||
**
|
||||
** The r1 and r2 member variables are only used by the optimized comparison
|
||||
** functions vdbeRecordCompareInt() and vdbeRecordCompareString().
|
||||
** The r1 and r2 fields are the values to return if this key is less than
|
||||
** or greater than a key in the btree, respectively. These are normally
|
||||
** -1 and +1 respectively, but might be inverted to +1 and -1 if the b-tree
|
||||
** is in DESC order.
|
||||
**
|
||||
** The key comparison functions actually return default_rc when they find
|
||||
** an equals comparison. default_rc can be -1, 0, or +1. If there are
|
||||
** multiple entries in the b-tree with the same key (when only looking
|
||||
** at the first pKeyInfo->nFields,) then default_rc can be set to -1 to
|
||||
** cause the search to find the last match, or +1 to cause the search to
|
||||
** find the first match.
|
||||
**
|
||||
** The key comparison functions will set eqSeen to true if they ever
|
||||
** get and equal results when comparing this structure to a b-tree record.
|
||||
** When default_rc!=0, the search might end up on the record immediately
|
||||
** before the first match or immediately after the last match. The
|
||||
** eqSeen field will indicate whether or not an exact match exists in the
|
||||
** b-tree.
|
||||
*/
|
||||
struct UnpackedRecord {
|
||||
KeyInfo *pKeyInfo; /* Collation and sort-order information */
|
||||
Mem *aMem; /* Values */
|
||||
u16 nField; /* Number of entries in apMem[] */
|
||||
i8 default_rc; /* Comparison result if keys are equal */
|
||||
u8 errCode; /* Error detected by xRecordCompare (CORRUPT or NOMEM) */
|
||||
Mem *aMem; /* Values */
|
||||
int r1; /* Value to return if (lhs > rhs) */
|
||||
int r2; /* Value to return if (rhs < lhs) */
|
||||
i8 r1; /* Value to return if (lhs > rhs) */
|
||||
i8 r2; /* Value to return if (rhs < lhs) */
|
||||
u8 eqSeen; /* True if an equality comparison has been seen */
|
||||
};
|
||||
|
||||
|
||||
@@ -2735,7 +2754,6 @@ struct Parse {
|
||||
int nVar; /* Number of '?' variables seen in the SQL so far */
|
||||
int nzVar; /* Number of available slots in azVar[] */
|
||||
u8 iPkSortOrder; /* ASC or DESC for INTEGER PRIMARY KEY */
|
||||
u8 bFreeWith; /* True if pWith should be freed with parser */
|
||||
u8 explain; /* True if the EXPLAIN flag is found on the query */
|
||||
#ifndef SQLITE_OMIT_VIRTUALTABLE
|
||||
u8 declareVtab; /* True if inside sqlite3_declare_vtab() */
|
||||
@@ -2762,6 +2780,7 @@ struct Parse {
|
||||
Table *pZombieTab; /* List of Table objects to delete after code gen */
|
||||
TriggerPrg *pTriggerPrg; /* Linked list of coded triggers */
|
||||
With *pWith; /* Current WITH clause, or NULL */
|
||||
With *pWithToFree; /* Free this WITH object at the end of the parse */
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -3252,6 +3271,7 @@ char *sqlite3VMPrintf(sqlite3*,const char*, va_list);
|
||||
void sqlite3TreeViewExpr(TreeView*, const Expr*, u8);
|
||||
void sqlite3TreeViewExprList(TreeView*, const ExprList*, u8, const char*);
|
||||
void sqlite3TreeViewSelect(TreeView*, const Select*, u8);
|
||||
void sqlite3TreeViewWith(TreeView*, const With*, u8);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -7039,6 +7039,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
|
||||
|
||||
};
|
||||
static int bitmask_size = sizeof(Bitmask)*8;
|
||||
static int longdouble_size = sizeof(LONGDOUBLE_TYPE);
|
||||
int i;
|
||||
extern int sqlite3_sync_count, sqlite3_fullsync_count;
|
||||
extern int sqlite3_opentemp_count;
|
||||
@@ -7139,6 +7140,8 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
|
||||
(char*)&sqlite3_data_directory, TCL_LINK_STRING);
|
||||
Tcl_LinkVar(interp, "bitmask_size",
|
||||
(char*)&bitmask_size, TCL_LINK_INT|TCL_LINK_READ_ONLY);
|
||||
Tcl_LinkVar(interp, "longdouble_size",
|
||||
(char*)&longdouble_size, TCL_LINK_INT|TCL_LINK_READ_ONLY);
|
||||
Tcl_LinkVar(interp, "sqlite_sync_count",
|
||||
(char*)&sqlite3_sync_count, TCL_LINK_INT);
|
||||
Tcl_LinkVar(interp, "sqlite_fullsync_count",
|
||||
|
||||
+1
-1
@@ -510,7 +510,7 @@ abort_parse:
|
||||
sqlite3DeleteTable(db, pParse->pNewTable);
|
||||
}
|
||||
|
||||
if( pParse->bFreeWith ) sqlite3WithDelete(db, pParse->pWith);
|
||||
sqlite3WithDelete(db, pParse->pWithToFree);
|
||||
sqlite3DeleteTrigger(db, pParse->pNewTrigger);
|
||||
for(i=pParse->nzVar-1; i>=0; i--) sqlite3DbFree(db, pParse->azVar[i]);
|
||||
sqlite3DbFree(db, pParse->azVar);
|
||||
|
||||
@@ -79,6 +79,45 @@ static void sqlite3TreeViewItem(TreeView *p, const char *zLabel,u8 moreFollows){
|
||||
sqlite3TreeViewLine(p, "%s", zLabel);
|
||||
}
|
||||
|
||||
/*
|
||||
** Generate a human-readable description of a WITH clause.
|
||||
*/
|
||||
void sqlite3TreeViewWith(TreeView *pView, const With *pWith, u8 moreToFollow){
|
||||
int i;
|
||||
if( pWith==0 ) return;
|
||||
if( pWith->nCte==0 ) return;
|
||||
if( pWith->pOuter ){
|
||||
sqlite3TreeViewLine(pView, "WITH (0x%p, pOuter=0x%p)",pWith,pWith->pOuter);
|
||||
}else{
|
||||
sqlite3TreeViewLine(pView, "WITH (0x%p)", pWith);
|
||||
}
|
||||
if( pWith->nCte>0 ){
|
||||
pView = sqlite3TreeViewPush(pView, 1);
|
||||
for(i=0; i<pWith->nCte; i++){
|
||||
StrAccum x;
|
||||
char zLine[1000];
|
||||
const struct Cte *pCte = &pWith->a[i];
|
||||
sqlite3StrAccumInit(&x, 0, zLine, sizeof(zLine), 0);
|
||||
sqlite3XPrintf(&x, 0, "%s", pCte->zName);
|
||||
if( pCte->pCols && pCte->pCols->nExpr>0 ){
|
||||
char cSep = '(';
|
||||
int j;
|
||||
for(j=0; j<pCte->pCols->nExpr; j++){
|
||||
sqlite3XPrintf(&x, 0, "%c%s", cSep, pCte->pCols->a[j].zName);
|
||||
cSep = ',';
|
||||
}
|
||||
sqlite3XPrintf(&x, 0, ")");
|
||||
}
|
||||
sqlite3XPrintf(&x, 0, " AS");
|
||||
sqlite3StrAccumFinish(&x);
|
||||
sqlite3TreeViewItem(pView, zLine, i<pWith->nCte-1);
|
||||
sqlite3TreeViewSelect(pView, pCte->pSelect, 0);
|
||||
sqlite3TreeViewPop(pView);
|
||||
}
|
||||
sqlite3TreeViewPop(pView);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Generate a human-readable description of a the Select object.
|
||||
@@ -87,6 +126,11 @@ void sqlite3TreeViewSelect(TreeView *pView, const Select *p, u8 moreToFollow){
|
||||
int n = 0;
|
||||
int cnt = 0;
|
||||
pView = sqlite3TreeViewPush(pView, moreToFollow);
|
||||
if( p->pWith ){
|
||||
sqlite3TreeViewWith(pView, p->pWith, 1);
|
||||
cnt = 1;
|
||||
sqlite3TreeViewPush(pView, 1);
|
||||
}
|
||||
do{
|
||||
sqlite3TreeViewLine(pView, "SELECT%s%s (0x%p) selFlags=0x%x",
|
||||
((p->selFlags & SF_Distinct) ? " DISTINCT" : ""),
|
||||
|
||||
+48
-21
@@ -3597,6 +3597,13 @@ case OP_ColumnsUsed: {
|
||||
** is greater than or equal to the key value. If there are no records
|
||||
** greater than or equal to the key and P2 is not zero, then jump to P2.
|
||||
**
|
||||
** If the cursor P1 was opened using the OPFLAG_SEEKEQ flag, then this
|
||||
** opcode will always land on a record that equally equals the key, or
|
||||
** else jump immediately to P2. When the cursor is OPFLAG_SEEKEQ, this
|
||||
** opcode must be followed by an IdxLE opcode with the same arguments.
|
||||
** The IdxLE opcode will be skipped if this opcode succeeds, but the
|
||||
** IdxLE opcode will be used on subsequent loop iterations.
|
||||
**
|
||||
** This opcode leaves the cursor configured to move in forward order,
|
||||
** from the beginning toward the end. In other words, the cursor is
|
||||
** configured to use Next, not Prev.
|
||||
@@ -3655,18 +3662,26 @@ case OP_ColumnsUsed: {
|
||||
** from the end toward the beginning. In other words, the cursor is
|
||||
** configured to use Prev, not Next.
|
||||
**
|
||||
** If the cursor P1 was opened using the OPFLAG_SEEKEQ flag, then this
|
||||
** opcode will always land on a record that equally equals the key, or
|
||||
** else jump immediately to P2. When the cursor is OPFLAG_SEEKEQ, this
|
||||
** opcode must be followed by an IdxGE opcode with the same arguments.
|
||||
** The IdxGE opcode will be skipped if this opcode succeeds, but the
|
||||
** IdxGE opcode will be used on subsequent loop iterations.
|
||||
**
|
||||
** See also: Found, NotFound, SeekGt, SeekGe, SeekLt
|
||||
*/
|
||||
case OP_SeekLT: /* jump, in3 */
|
||||
case OP_SeekLE: /* jump, in3 */
|
||||
case OP_SeekGE: /* jump, in3 */
|
||||
case OP_SeekGT: { /* jump, in3 */
|
||||
int res;
|
||||
int oc;
|
||||
VdbeCursor *pC;
|
||||
UnpackedRecord r;
|
||||
int nField;
|
||||
i64 iKey; /* The rowid we are to seek to */
|
||||
int res; /* Comparison result */
|
||||
int oc; /* Opcode */
|
||||
VdbeCursor *pC; /* The cursor to seek */
|
||||
UnpackedRecord r; /* The key to seek for */
|
||||
int nField; /* Number of columns or fields in the key */
|
||||
i64 iKey; /* The rowid we are to seek to */
|
||||
int eqOnly; /* Only interested in == results */
|
||||
|
||||
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
|
||||
assert( pOp->p2!=0 );
|
||||
@@ -3679,27 +3694,16 @@ case OP_SeekGT: { /* jump, in3 */
|
||||
assert( pC->isOrdered );
|
||||
assert( pC->pCursor!=0 );
|
||||
oc = pOp->opcode;
|
||||
eqOnly = 0;
|
||||
pC->nullRow = 0;
|
||||
#ifdef SQLITE_DEBUG
|
||||
pC->seekOp = pOp->opcode;
|
||||
#endif
|
||||
|
||||
/* For a cursor with the BTREE_SEEK_EQ hint, only the OP_SeekGE and
|
||||
** OP_SeekLE opcodes are allowed, and these must be immediately followed
|
||||
** by an OP_IdxGT or OP_IdxLT opcode, respectively, with the same key.
|
||||
*/
|
||||
#ifdef SQLITE_DEBUG
|
||||
if( sqlite3BtreeCursorHasHint(pC->pCursor, BTREE_SEEK_EQ) ){
|
||||
assert( pOp->opcode==OP_SeekGE || pOp->opcode==OP_SeekLE );
|
||||
assert( pOp[1].opcode==OP_IdxLT || pOp[1].opcode==OP_IdxGT );
|
||||
assert( pOp[1].p1==pOp[0].p1 );
|
||||
assert( pOp[1].p2==pOp[0].p2 );
|
||||
assert( pOp[1].p3==pOp[0].p3 );
|
||||
assert( pOp[1].p4.i==pOp[0].p4.i );
|
||||
}
|
||||
#endif
|
||||
|
||||
if( pC->isTable ){
|
||||
/* The BTREE_SEEK_EQ flag is only set on index cursors */
|
||||
assert( sqlite3BtreeCursorHasHint(pC->pCursor, BTREE_SEEK_EQ)==0 );
|
||||
|
||||
/* The input value in P3 might be of any type: integer, real, string,
|
||||
** blob, or NULL. But it needs to be an integer before we can do
|
||||
** the seek, so convert it. */
|
||||
@@ -3748,6 +3752,20 @@ case OP_SeekGT: { /* jump, in3 */
|
||||
goto abort_due_to_error;
|
||||
}
|
||||
}else{
|
||||
/* For a cursor with the BTREE_SEEK_EQ hint, only the OP_SeekGE and
|
||||
** OP_SeekLE opcodes are allowed, and these must be immediately followed
|
||||
** by an OP_IdxGT or OP_IdxLT opcode, respectively, with the same key.
|
||||
*/
|
||||
if( sqlite3BtreeCursorHasHint(pC->pCursor, BTREE_SEEK_EQ) ){
|
||||
eqOnly = 1;
|
||||
assert( pOp->opcode==OP_SeekGE || pOp->opcode==OP_SeekLE );
|
||||
assert( pOp[1].opcode==OP_IdxLT || pOp[1].opcode==OP_IdxGT );
|
||||
assert( pOp[1].p1==pOp[0].p1 );
|
||||
assert( pOp[1].p2==pOp[0].p2 );
|
||||
assert( pOp[1].p3==pOp[0].p3 );
|
||||
assert( pOp[1].p4.i==pOp[0].p4.i );
|
||||
}
|
||||
|
||||
nField = pOp->p4.i;
|
||||
assert( pOp->p4type==P4_INT32 );
|
||||
assert( nField>0 );
|
||||
@@ -3772,10 +3790,15 @@ case OP_SeekGT: { /* jump, in3 */
|
||||
{ int i; for(i=0; i<r.nField; i++) assert( memIsValid(&r.aMem[i]) ); }
|
||||
#endif
|
||||
ExpandBlob(r.aMem);
|
||||
r.eqSeen = 0;
|
||||
rc = sqlite3BtreeMovetoUnpacked(pC->pCursor, &r, 0, 0, &res);
|
||||
if( rc!=SQLITE_OK ){
|
||||
goto abort_due_to_error;
|
||||
}
|
||||
if( eqOnly && r.eqSeen==0 ){
|
||||
assert( res!=0 );
|
||||
goto seek_not_found;
|
||||
}
|
||||
}
|
||||
pC->deferredMoveto = 0;
|
||||
pC->cacheStatus = CACHE_STALE;
|
||||
@@ -3803,10 +3826,14 @@ case OP_SeekGT: { /* jump, in3 */
|
||||
res = sqlite3BtreeEof(pC->pCursor);
|
||||
}
|
||||
}
|
||||
seek_not_found:
|
||||
assert( pOp->p2>0 );
|
||||
VdbeBranchTaken(res!=0,2);
|
||||
if( res ){
|
||||
goto jump_to_p2;
|
||||
}else if( eqOnly ){
|
||||
assert( pOp[1].opcode==OP_IdxLT || pOp[1].opcode==OP_IdxGT );
|
||||
pOp++; /* Skip the OP_IdxLt or OP_IdxGT that follows */
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
+63
-35
@@ -3319,6 +3319,10 @@ u32 sqlite3VdbeSerialGet(
|
||||
/* EVIDENCE-OF: R-01849-26079 Value is a big-endian 32-bit
|
||||
** twos-complement integer. */
|
||||
pMem->u.i = FOUR_BYTE_INT(buf);
|
||||
#ifdef __HP_cc
|
||||
/* Work around a sign-extension bug in the HP compiler for HP/UX */
|
||||
if( buf[0]&0x80 ) pMem->u.i |= 0xffffffff80000000LL;
|
||||
#endif
|
||||
pMem->flags = MEM_Int;
|
||||
testcase( pMem->u.i<0 );
|
||||
return 4;
|
||||
@@ -3634,6 +3638,34 @@ static SQLITE_NOINLINE int sqlite3BlobCompare(const Mem *pB1, const Mem *pB2){
|
||||
return pB1->n - pB2->n;
|
||||
}
|
||||
|
||||
/*
|
||||
** Do a comparison between a 64-bit signed integer and a 64-bit floating-point
|
||||
** number. Return negative, zero, or positive if the first (i64) is less than,
|
||||
** equal to, or greater than the second (double).
|
||||
*/
|
||||
static int sqlite3IntFloatCompare(i64 i, double r){
|
||||
if( sizeof(LONGDOUBLE_TYPE)>8 ){
|
||||
LONGDOUBLE_TYPE x = (LONGDOUBLE_TYPE)i;
|
||||
if( x<r ) return -1;
|
||||
if( x>r ) return +1;
|
||||
return 0;
|
||||
}else{
|
||||
i64 y;
|
||||
double s;
|
||||
if( r<-9223372036854775808.0 ) return +1;
|
||||
if( r>9223372036854775807.0 ) return -1;
|
||||
y = (i64)r;
|
||||
if( i<y ) return -1;
|
||||
if( i>y ){
|
||||
if( y==SMALLEST_INT64 && r>0.0 ) return -1;
|
||||
return +1;
|
||||
}
|
||||
s = (double)i;
|
||||
if( s<r ) return -1;
|
||||
if( s>r ) return +1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Compare the values contained by the two memory cells, returning
|
||||
@@ -3660,34 +3692,34 @@ int sqlite3MemCompare(const Mem *pMem1, const Mem *pMem2, const CollSeq *pColl){
|
||||
return (f2&MEM_Null) - (f1&MEM_Null);
|
||||
}
|
||||
|
||||
/* If one value is a number and the other is not, the number is less.
|
||||
** If both are numbers, compare as reals if one is a real, or as integers
|
||||
** if both values are integers.
|
||||
/* At least one of the two values is a number
|
||||
*/
|
||||
if( combined_flags&(MEM_Int|MEM_Real) ){
|
||||
double r1, r2;
|
||||
if( (f1 & f2 & MEM_Int)!=0 ){
|
||||
if( pMem1->u.i < pMem2->u.i ) return -1;
|
||||
if( pMem1->u.i > pMem2->u.i ) return 1;
|
||||
if( pMem1->u.i > pMem2->u.i ) return +1;
|
||||
return 0;
|
||||
}
|
||||
if( (f1 & f2 & MEM_Real)!=0 ){
|
||||
if( pMem1->u.r < pMem2->u.r ) return -1;
|
||||
if( pMem1->u.r > pMem2->u.r ) return +1;
|
||||
return 0;
|
||||
}
|
||||
if( (f1&MEM_Int)!=0 ){
|
||||
if( (f2&MEM_Real)!=0 ){
|
||||
return sqlite3IntFloatCompare(pMem1->u.i, pMem2->u.r);
|
||||
}else{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if( (f1&MEM_Real)!=0 ){
|
||||
r1 = pMem1->u.r;
|
||||
}else if( (f1&MEM_Int)!=0 ){
|
||||
r1 = (double)pMem1->u.i;
|
||||
}else{
|
||||
return 1;
|
||||
if( (f2&MEM_Int)!=0 ){
|
||||
return -sqlite3IntFloatCompare(pMem2->u.i, pMem1->u.r);
|
||||
}else{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if( (f2&MEM_Real)!=0 ){
|
||||
r2 = pMem2->u.r;
|
||||
}else if( (f2&MEM_Int)!=0 ){
|
||||
r2 = (double)pMem2->u.i;
|
||||
}else{
|
||||
return -1;
|
||||
}
|
||||
if( r1<r2 ) return -1;
|
||||
if( r1>r2 ) return 1;
|
||||
return 0;
|
||||
return +1;
|
||||
}
|
||||
|
||||
/* If one value is a string and the other is a blob, the string is less.
|
||||
@@ -3838,13 +3870,8 @@ int sqlite3VdbeRecordCompareWithSkip(
|
||||
}else if( serial_type==0 ){
|
||||
rc = -1;
|
||||
}else if( serial_type==7 ){
|
||||
double rhs = (double)pRhs->u.i;
|
||||
sqlite3VdbeSerialGet(&aKey1[d1], serial_type, &mem1);
|
||||
if( mem1.u.r<rhs ){
|
||||
rc = -1;
|
||||
}else if( mem1.u.r>rhs ){
|
||||
rc = +1;
|
||||
}
|
||||
rc = -sqlite3IntFloatCompare(pRhs->u.i, mem1.u.r);
|
||||
}else{
|
||||
i64 lhs = vdbeRecordDecodeInt(serial_type, &aKey1[d1]);
|
||||
i64 rhs = pRhs->u.i;
|
||||
@@ -3868,18 +3895,15 @@ int sqlite3VdbeRecordCompareWithSkip(
|
||||
}else if( serial_type==0 ){
|
||||
rc = -1;
|
||||
}else{
|
||||
double rhs = pRhs->u.r;
|
||||
double lhs;
|
||||
sqlite3VdbeSerialGet(&aKey1[d1], serial_type, &mem1);
|
||||
if( serial_type==7 ){
|
||||
lhs = mem1.u.r;
|
||||
if( mem1.u.r<pRhs->u.r ){
|
||||
rc = -1;
|
||||
}else if( mem1.u.r>pRhs->u.r ){
|
||||
rc = +1;
|
||||
}
|
||||
}else{
|
||||
lhs = (double)mem1.u.i;
|
||||
}
|
||||
if( lhs<rhs ){
|
||||
rc = -1;
|
||||
}else if( lhs>rhs ){
|
||||
rc = +1;
|
||||
rc = sqlite3IntFloatCompare(mem1.u.i, pRhs->u.r);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3969,6 +3993,7 @@ int sqlite3VdbeRecordCompareWithSkip(
|
||||
|| vdbeRecordCompareDebug(nKey1, pKey1, pPKey2, pPKey2->default_rc)
|
||||
|| pKeyInfo->db->mallocFailed
|
||||
);
|
||||
pPKey2->eqSeen = 1;
|
||||
return pPKey2->default_rc;
|
||||
}
|
||||
int sqlite3VdbeRecordCompare(
|
||||
@@ -4068,6 +4093,7 @@ static int vdbeRecordCompareInt(
|
||||
/* The first fields of the two keys are equal and there are no trailing
|
||||
** fields. Return pPKey2->default_rc in this case. */
|
||||
res = pPKey2->default_rc;
|
||||
pPKey2->eqSeen = 1;
|
||||
}
|
||||
|
||||
assert( vdbeRecordCompareDebug(nKey1, pKey1, pPKey2, res) );
|
||||
@@ -4088,6 +4114,7 @@ static int vdbeRecordCompareString(
|
||||
int serial_type;
|
||||
int res;
|
||||
|
||||
assert( pPKey2->aMem[0].flags & MEM_Str );
|
||||
vdbeAssertFieldCountWithinLimits(nKey1, pKey1, pPKey2->pKeyInfo);
|
||||
getVarint32(&aKey1[1], serial_type);
|
||||
if( serial_type<12 ){
|
||||
@@ -4114,6 +4141,7 @@ static int vdbeRecordCompareString(
|
||||
res = sqlite3VdbeRecordCompareWithSkip(nKey1, pKey1, pPKey2, 1);
|
||||
}else{
|
||||
res = pPKey2->default_rc;
|
||||
pPKey2->eqSeen = 1;
|
||||
}
|
||||
}else if( res>0 ){
|
||||
res = pPKey2->r2;
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
|
||||
if {![info exists __GNUC__] || [regexp arm $tcl_platform(machine)]} {
|
||||
if {$::longdouble_size<=8} {
|
||||
finish_test
|
||||
return
|
||||
}
|
||||
|
||||
+4
-4
@@ -352,7 +352,7 @@ do_test collate4-2.1.2 {
|
||||
count {
|
||||
SELECT * FROM collate4t2, collate4t1 WHERE a = b;
|
||||
}
|
||||
} {A a A A 5}
|
||||
} {A a A A 4}
|
||||
do_test collate4-2.1.3 {
|
||||
count {
|
||||
SELECT * FROM collate4t2, collate4t1 WHERE b = a;
|
||||
@@ -372,7 +372,7 @@ do_test collate4-2.1.5 {
|
||||
count {
|
||||
SELECT * FROM collate4t2, collate4t1 WHERE b = a;
|
||||
}
|
||||
} {A A 4}
|
||||
} {A A 3}
|
||||
ifcapable subquery {
|
||||
do_test collate4-2.1.6 {
|
||||
count {
|
||||
@@ -389,12 +389,12 @@ ifcapable subquery {
|
||||
SELECT a FROM collate4t1 WHERE a IN (SELECT * FROM collate4t2)
|
||||
ORDER BY rowid
|
||||
}
|
||||
} {a A 6}
|
||||
} {a A 5}
|
||||
do_test collate4-2.1.8 {
|
||||
count {
|
||||
SELECT a FROM collate4t1 WHERE a IN ('z', 'a');
|
||||
}
|
||||
} {a A 5}
|
||||
} {a A 4}
|
||||
do_test collate4-2.1.9 {
|
||||
execsql {
|
||||
DROP INDEX collate4i1;
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
# 2015-11-06
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#***********************************************************************
|
||||
#
|
||||
# Tests of the iee754 extension
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
|
||||
load_static_extension db ieee754
|
||||
|
||||
foreach {id float rep} {
|
||||
1 1.0 1,0
|
||||
2 2.0 2,0
|
||||
3 0.5 1,-1
|
||||
4 1.5 3,-1
|
||||
5 0.0 0,-1075
|
||||
6 4.9406564584124654e-324 4503599627370497,-1075
|
||||
7 2.2250738585072009e-308 9007199254740991,-1075
|
||||
8 2.2250738585072014e-308 1,-1022
|
||||
} {
|
||||
do_test ieee754-100-$id-1 {
|
||||
db eval "SELECT ieee754($float);"
|
||||
} "ieee754($rep)"
|
||||
do_test ieee754-100-$id-2 {
|
||||
db eval "SELECT ieee754($rep)==$float;"
|
||||
} {1}
|
||||
if {$float!=0.0} {
|
||||
do_test ieee754-100-$id-3 {
|
||||
db eval "SELECT ieee754(-$float);"
|
||||
} "ieee754(-$rep)"
|
||||
do_test ieee754-100-$id-4 {
|
||||
db eval "SELECT ieee754(-$rep)==-$float;"
|
||||
} {1}
|
||||
}
|
||||
}
|
||||
|
||||
do_execsql_test ieee754-110 {
|
||||
SELECT ieee754(1,1024), ieee754(4503599627370495,972);
|
||||
} {Inf 1.79769313486232e+308}
|
||||
do_execsql_test ieee754-111 {
|
||||
SELECT ieee754(-1,1024), ieee754(-4503599627370495,972);
|
||||
} {-Inf -1.79769313486232e+308}
|
||||
do_execsql_test ieee754-112 {
|
||||
SELECT ieee754(4503599627370495,973) is null;
|
||||
} {1}
|
||||
|
||||
finish_test
|
||||
@@ -0,0 +1,79 @@
|
||||
# 2015-11-05
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file implements tests for indexes on large numeric values.
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
|
||||
|
||||
# Test cases from Zsbán Ambrus:
|
||||
#
|
||||
do_execsql_test numindex1-1.1 {
|
||||
CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
|
||||
CREATE INDEX t1b ON t1(b);
|
||||
INSERT INTO t1(a,b) VALUES(100, 356282677878746339);
|
||||
INSERT INTO t1(a,b) VALUES(50, 356282677878746339.0);
|
||||
INSERT INTO t1(a,b) VALUES(0, 356282677878746340);
|
||||
DELETE FROM t1 WHERE a=50;
|
||||
PRAGMA integrity_check;
|
||||
} {ok}
|
||||
|
||||
do_execsql_test numindex1-1.2 {
|
||||
CREATE TABLE t2(a,b);
|
||||
INSERT INTO t2(a,b) VALUES('b', 1<<58),
|
||||
('c', (1<<58)+1e-7), ('d', (1<<58)+1);
|
||||
SELECT a, b, typeof(b), '|' FROM t2 ORDER BY +a;
|
||||
} {b 288230376151711744 integer | c 2.88230376151712e+17 real | d 288230376151711745 integer |}
|
||||
|
||||
do_execsql_test numindex1-1.3 {
|
||||
SELECT x.a || CASE WHEN x.b==y.b THEN '==' ELSE '<>' END || y.a
|
||||
FROM t2 AS x, t2 AS y
|
||||
ORDER BY +x.a, +x.b;
|
||||
} {b==b b==c b<>d c==b c==c c<>d d<>b d<>c d==d}
|
||||
|
||||
# New test cases
|
||||
#
|
||||
do_execsql_test numindex1-2.1 {
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1(a INTEGER PRIMARY KEY,b);
|
||||
CREATE INDEX t1b ON t1(b);
|
||||
WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<100)
|
||||
INSERT INTO t1(a,b) SELECT x, 10000000000000004.0 FROM c
|
||||
WHERE x NOT IN (23,37);
|
||||
INSERT INTO t1(a,b) VALUES(23,10000000000000005);
|
||||
INSERT INTO t1(a,b) VALUES(37,10000000000000003);
|
||||
DELETE FROM t1 WHERE a NOT IN (23,37);
|
||||
PRAGMA integrity_check;
|
||||
} {ok}
|
||||
|
||||
do_execsql_test numindex1-3.1 {
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1(a INTEGER PRIMARY KEY,b);
|
||||
CREATE INDEX t1b ON t1(b);
|
||||
WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<20)
|
||||
INSERT INTO t1(a,b) SELECT x, 100000000000000005.0
|
||||
FROM c WHERE x NOT IN (3,5,7,11,13,17,19);
|
||||
INSERT INTO t1(a,b) VALUES(3,100000000000000005);
|
||||
INSERT INTO t1(a,b) VALUES(5,100000000000000000);
|
||||
INSERT INTO t1(a,b) VALUES(7,100000000000000008);
|
||||
INSERT INTO t1(a,b) VALUES(11,100000000000000006);
|
||||
INSERT INTO t1(a,b) VALUES(13,100000000000000001);
|
||||
INSERT INTO t1(a,b) VALUES(17,100000000000000004);
|
||||
INSERT INTO t1(a,b) VALUES(19,100000000000000003);
|
||||
PRAGMA integrity_check;
|
||||
} {ok}
|
||||
|
||||
do_execsql_test numindex1-3.2 {
|
||||
SELECT a FROM t1 ORDER BY b;
|
||||
} {1 2 4 5 6 8 9 10 12 14 15 16 18 20 13 19 17 3 11 7}
|
||||
|
||||
finish_test
|
||||
@@ -178,7 +178,7 @@ test_suite "valgrind" -prefix "" -description {
|
||||
} -files [
|
||||
test_set $allquicktests -exclude *malloc* *ioerr* *fault* wal.test \
|
||||
shell*.test crash8.test atof1.test selectG.test \
|
||||
tkt-fc62af4523.test
|
||||
tkt-fc62af4523.test numindex1.test
|
||||
] -initialize {
|
||||
set ::G(valgrind) 1
|
||||
} -shutdown {
|
||||
|
||||
@@ -128,6 +128,7 @@ array set ::Configs [strip_comments {
|
||||
-DSQLITE_ENABLE_STAT4
|
||||
-DSQLITE_ENABLE_RBU
|
||||
-DSQLITE_MAX_ATTACHED=125
|
||||
-DLONGDOUBLE_TYPE=double
|
||||
}
|
||||
"Device-One" {
|
||||
-O2
|
||||
|
||||
+8
-8
@@ -412,22 +412,22 @@ ifcapable subquery {
|
||||
count {
|
||||
SELECT * FROM t1 WHERE w IN (-1,1,2,3) order by 1;
|
||||
}
|
||||
} {1 0 4 2 1 9 3 1 16 13}
|
||||
} {1 0 4 2 1 9 3 1 16 12}
|
||||
do_test where-5.3b {
|
||||
count {
|
||||
SELECT * FROM t1 WHERE w IN (3,-1,1,2) order by 1;
|
||||
}
|
||||
} {1 0 4 2 1 9 3 1 16 13}
|
||||
} {1 0 4 2 1 9 3 1 16 12}
|
||||
do_test where-5.3c {
|
||||
count {
|
||||
SELECT * FROM t1 WHERE w IN (3,2,-1,1,2) order by 1;
|
||||
}
|
||||
} {1 0 4 2 1 9 3 1 16 13}
|
||||
} {1 0 4 2 1 9 3 1 16 12}
|
||||
do_test where-5.3d {
|
||||
count {
|
||||
SELECT * FROM t1 WHERE w IN (-1,1,2,3) order by 1 DESC;
|
||||
}
|
||||
} {3 1 16 2 1 9 1 0 4 12}
|
||||
} {3 1 16 2 1 9 1 0 4 11}
|
||||
do_test where-5.4 {
|
||||
count {
|
||||
SELECT * FROM t1 WHERE w+0 IN (-1,1,2,3) order by 1;
|
||||
@@ -465,7 +465,7 @@ ifcapable subquery {
|
||||
count {
|
||||
SELECT * FROM t1 WHERE x IN (1,7) ORDER BY 1;
|
||||
}
|
||||
} {2 1 9 3 1 16 7}
|
||||
} {2 1 9 3 1 16 6}
|
||||
do_test where-5.10 {
|
||||
count {
|
||||
SELECT * FROM t1 WHERE x+0 IN (1,7) ORDER BY 1;
|
||||
@@ -485,17 +485,17 @@ ifcapable subquery {
|
||||
count {
|
||||
SELECT * FROM t1 WHERE x IN (1,7) AND y NOT IN (6400,8100) ORDER BY 1;
|
||||
}
|
||||
} {2 1 9 3 1 16 7}
|
||||
} {2 1 9 3 1 16 6}
|
||||
do_test where-5.14 {
|
||||
count {
|
||||
SELECT * FROM t1 WHERE x IN (1,7) AND y IN (9,10) ORDER BY 1;
|
||||
}
|
||||
} {2 1 9 8}
|
||||
} {2 1 9 5}
|
||||
do_test where-5.15 {
|
||||
count {
|
||||
SELECT * FROM t1 WHERE x IN (1,7) AND y IN (9,16) ORDER BY 1;
|
||||
}
|
||||
} {2 1 9 3 1 16 11}
|
||||
} {2 1 9 3 1 16 9}
|
||||
do_test where-5.100 {
|
||||
db eval {
|
||||
SELECT w, x, y FROM t1 WHERE x IN (1,5) AND y IN (9,8,3025,1000,3969)
|
||||
|
||||
+1
-1
@@ -91,7 +91,7 @@ do_test where4-1.10 {
|
||||
} {6 2}
|
||||
do_test where4-1.11 {
|
||||
count {SELECT rowid FROM t1 WHERE w=x'78' AND x IS NULL AND y=123}
|
||||
} {1}
|
||||
} {0}
|
||||
do_test where4-1.12 {
|
||||
count {SELECT rowid FROM t1 WHERE w=x'78' AND x IS NULL AND y=x'7A'}
|
||||
} {6 2}
|
||||
|
||||
+110
@@ -865,4 +865,114 @@ do_catchsql_test 16.1 {
|
||||
SELECT * FROM i;
|
||||
} {1 {recursive aggregate queries not supported}}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
do_execsql_test 17.1 {
|
||||
WITH x(a) AS (
|
||||
WITH y(b) AS (SELECT 10)
|
||||
SELECT 9 UNION ALL SELECT * FROM y
|
||||
)
|
||||
SELECT * FROM x
|
||||
} {9 10}
|
||||
|
||||
do_execsql_test 17.2 {
|
||||
WITH x AS (
|
||||
WITH y(b) AS (SELECT 10)
|
||||
SELECT * FROM y UNION ALL SELECT * FROM y
|
||||
)
|
||||
SELECT * FROM x
|
||||
} {10 10}
|
||||
|
||||
do_test 17.2 {
|
||||
db eval {
|
||||
WITH x AS (
|
||||
WITH y(b) AS (SELECT 10)
|
||||
SELECT * FROM y UNION ALL SELECT * FROM y
|
||||
)
|
||||
SELECT * FROM x
|
||||
} A {
|
||||
# no op
|
||||
}
|
||||
set A(*)
|
||||
} {b}
|
||||
|
||||
do_catchsql_test 17.3 {
|
||||
WITH i AS (
|
||||
WITH j AS (SELECT 5)
|
||||
SELECT 5 FROM i UNION SELECT 8 FROM i
|
||||
)
|
||||
SELECT * FROM i;
|
||||
} {1 {circular reference: i}}
|
||||
|
||||
do_catchsql_test 17.4 {
|
||||
WITH i AS (
|
||||
WITH j AS (SELECT 5)
|
||||
SELECT 5 FROM t1 UNION SELECT 8 FROM t11
|
||||
)
|
||||
SELECT * FROM i;
|
||||
} {1 {no such table: t11}}
|
||||
|
||||
do_execsql_test 17.5 {
|
||||
WITH
|
||||
x1 AS (SELECT 10),
|
||||
x2 AS (SELECT * FROM x1),
|
||||
x3 AS (
|
||||
WITH x1 AS (SELECT 11)
|
||||
SELECT * FROM x2 UNION ALL SELECT * FROM x2
|
||||
)
|
||||
SELECT * FROM x3;
|
||||
} {10 10}
|
||||
|
||||
do_execsql_test 17.6 {
|
||||
WITH
|
||||
x1 AS (SELECT 10),
|
||||
x2 AS (SELECT * FROM x1),
|
||||
x3 AS (
|
||||
WITH x1 AS (SELECT 11)
|
||||
SELECT * FROM x2 UNION ALL SELECT * FROM x1
|
||||
)
|
||||
SELECT * FROM x3;
|
||||
} {10 11}
|
||||
|
||||
do_execsql_test 17.7 {
|
||||
WITH
|
||||
x1 AS (SELECT 10),
|
||||
x2 AS (SELECT * FROM x1),
|
||||
x3 AS (
|
||||
WITH
|
||||
x1 AS ( SELECT 11 ),
|
||||
x4 AS ( SELECT * FROM x2 )
|
||||
SELECT * FROM x4 UNION ALL SELECT * FROM x1
|
||||
)
|
||||
SELECT * FROM x3;
|
||||
} {10 11}
|
||||
|
||||
do_execsql_test 17.8 {
|
||||
WITH
|
||||
x1 AS (SELECT 10),
|
||||
x2 AS (SELECT * FROM x1),
|
||||
x3 AS (
|
||||
WITH
|
||||
x1 AS ( SELECT 11 ),
|
||||
x4 AS ( SELECT * FROM x2 )
|
||||
SELECT * FROM x4 UNION ALL SELECT * FROM x1
|
||||
)
|
||||
SELECT * FROM x3;
|
||||
} {10 11}
|
||||
|
||||
do_execsql_test 17.9 {
|
||||
WITH
|
||||
x1 AS (SELECT 10),
|
||||
x2 AS (SELECT 11),
|
||||
x3 AS (
|
||||
SELECT * FROM x1 UNION ALL SELECT * FROM x2
|
||||
),
|
||||
x4 AS (
|
||||
WITH
|
||||
x1 AS (SELECT 12),
|
||||
x2 AS (SELECT 13)
|
||||
SELECT * FROM x3
|
||||
)
|
||||
SELECT * FROM x4;
|
||||
} {10 11}
|
||||
|
||||
finish_test
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
# 2015-11-07
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the WITH clause.
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
set ::testprefix with3
|
||||
|
||||
ifcapable {!cte} {
|
||||
finish_test
|
||||
return
|
||||
}
|
||||
|
||||
# Test problems found by Kostya Serebryany using
|
||||
# LibFuzzer. (http://llvm.org/docs/LibFuzzer.html)
|
||||
#
|
||||
do_catchsql_test 1.0 {
|
||||
WITH i(x) AS (
|
||||
WITH j AS (SELECT 10)
|
||||
SELECT 5 FROM t0 UNION SELECT 8 FROM m
|
||||
)
|
||||
SELECT * FROM i;
|
||||
} {1 {no such table: m}}
|
||||
|
||||
# Additional test cases that came out of the work to
|
||||
# fix for Kostya's problem.
|
||||
#
|
||||
do_execsql_test 2.0 {
|
||||
WITH
|
||||
x1 AS (SELECT 10),
|
||||
x2 AS (SELECT 11),
|
||||
x3 AS (
|
||||
SELECT * FROM x1 UNION ALL SELECT * FROM x2
|
||||
),
|
||||
x4 AS (
|
||||
WITH
|
||||
x1 AS (SELECT 12),
|
||||
x2 AS (SELECT 13)
|
||||
SELECT * FROM x3
|
||||
)
|
||||
SELECT * FROM x4;
|
||||
|
||||
} {10 11}
|
||||
|
||||
do_execsql_test 2.1 {
|
||||
CREATE TABLE t1(x);
|
||||
WITH
|
||||
x1(a) AS (values(100))
|
||||
INSERT INTO t1(x)
|
||||
SELECT * FROM (WITH x2(y) AS (SELECT * FROM x1) SELECT y+a FROM x1, x2);
|
||||
SELECT * FROM t1;
|
||||
} {200}
|
||||
|
||||
finish_test
|
||||
Reference in New Issue
Block a user