diff --git a/manifest b/manifest index 7c051fab78..6f9cffcd2b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Repair\stypo\sin\sprevious\scommit.\s(CVS\s2849) -D 2005-12-30T16:31:54 +C Additional\stests\sfor\sdescending\sindices.\s\sComment\schanges.\s(CVS\s2850) +D 2006-01-02T18:24:40 F Makefile.in e3c6b3a38d734d41574c04f2fc90d18de2b87102 F Makefile.linux-gcc aee18d8a05546dcf1888bd4547e442008a49a092 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -88,7 +88,7 @@ F src/vdbe.c 8b0d676bcd8d8b12606f684ea2d7934147b40101 F src/vdbe.h 8729a4ee16ff9aeab2af9667df3cf300ff978e13 F src/vdbeInt.h 9b78ba00cc006bff17e04a54ba3ded9fc7810a10 F src/vdbeapi.c b270b680cbc5d20b5a1abfdb08339667985df94e -F src/vdbeaux.c e7c116d4b14868d5fe570e361c6872839b6ab07a +F src/vdbeaux.c 7d55232a7e8c21899bbfc9ba3bd2469eb32faaf0 F src/vdbefifo.c 9efb94c8c3f4c979ebd0028219483f88e57584f5 F src/vdbemem.c deba8d6e3727643924b210a8c531a496c2b8d386 F src/where.c 0296a20c2e2a39c0cb785efe471fd1958a5259f3 @@ -147,6 +147,7 @@ F test/delete2.test e382b6a97787197eb8b93dd4ccd37797c3725ea3 F test/delete3.test 555e84a00a99230b7d049d477a324a631126a6ab F test/descidx1.test 466a9b87f3a7682156916dcbd5b77be55fd39d75 F test/descidx2.test f9f73c562932b81207faa525cd52acdfd2fc0482 +F test/descidx3.test 56daed47e2eb91cef15a21a656691bb82a4699ba F test/diskfull.test d828d72adfc9e2d1a194d25996718c1989152cf9 F test/distinctagg.test 2b89d1c5220d966a30ba4b40430338669301188b F test/enc.test 7a03417a1051fe8bc6c7641cf4c8c3f7e0066d52 @@ -332,7 +333,7 @@ F www/tclsqlite.tcl ddcf912ea48695603c8ed7efb29f0812ef8d1b49 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513 -P 2afcad990190af97d1ad0010f211a5ca8f0fd745 -R a424e10a9f0c619045afb8d75245a73e -U danielk1977 -Z 3408bf2c5f10e96359ff6870ee5c171c +P a4aa0911bccd0627cd6d926c5bdd2a4f4b8f6cc5 +R c2bfcb4903f64a4a18ff50a2924cea57 +U drh +Z 1c84688d70590b66b4c8fd7b5cde6cad diff --git a/manifest.uuid b/manifest.uuid index cc1b0d6d12..10d18dcd65 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a4aa0911bccd0627cd6d926c5bdd2a4f4b8f6cc5 \ No newline at end of file +2622c5242b0cba5bc19f190a7c209ab9ed8f57e0 \ No newline at end of file diff --git a/src/vdbeaux.c b/src/vdbeaux.c index b0d5f6f5e1..f606647d05 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -1496,6 +1496,8 @@ int sqlite3VdbeCursorMoveto(Cursor *p){ ** N>=12 and even (N-12)/2 BLOB ** N>=13 and odd (N-13)/2 text ** +** The 8 and 9 types were added in 3.3.0, file format 4. Prior versions +** of SQLite will not understand those serial types. */ /* diff --git a/test/descidx3.test b/test/descidx3.test new file mode 100644 index 0000000000..8977e1e8d2 --- /dev/null +++ b/test/descidx3.test @@ -0,0 +1,144 @@ +# 2006 January 02 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#************************************************************************* +# This file implements regression tests for SQLite library. The +# focus of this script is descending indices. +# +# $Id: descidx3.test,v 1.1 2006/01/02 18:24:40 drh Exp $ +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +# This procedure sets the value of the file-format in file 'test.db' +# to $newval. Also, the schema cookie is incremented. +# +proc set_file_format {newval} { + set bt [btree_open test.db 10 0] + btree_begin_transaction $bt + set meta [btree_get_meta $bt] + lset meta 2 $newval ;# File format + lset meta 1 [expr [lindex $meta 1]+1] ;# Schema cookie + eval "btree_update_meta $bt $meta" + btree_commit $bt + btree_close $bt +} + +# This procedure returns the value of the file-format in file 'test.db'. +# +proc get_file_format {{fname test.db}} { + set bt [btree_open $fname 10 0] + set meta [btree_get_meta $bt] + btree_close $bt + lindex $meta 2 +} + +# Verify that the file format starts as 4. +# +do_test descidx3-1.1 { + execsql { + CREATE TABLE t1(i INTEGER PRIMARY KEY,a,b,c,d); + CREATE INDEX t1i1 ON t1(a DESC, b ASC, c DESC); + CREATE INDEX t1i2 ON t1(b DESC, c ASC, d DESC); + } + get_file_format +} {4} + +# Put some information in the table and verify that the descending +# index actually works. +# +do_test descidx3-2.1 { + execsql { + INSERT INTO t1 VALUES(1, NULL, NULL, NULL, NULL); + INSERT INTO t1 VALUES(2, 2, 2, 2, 2); + INSERT INTO t1 VALUES(3, 3, 3, 3, 3); + INSERT INTO t1 VALUES(4, 2.5, 2.5, 2.5, 2.5); + INSERT INTO t1 VALUES(5, -5, -5, -5, -5); + INSERT INTO t1 VALUES(6, 'six', 'six', 'six', 'six'); + INSERT INTO t1 VALUES(7, x'77', x'77', x'77', x'77'); + INSERT INTO t1 VALUES(8, 'eight', 'eight', 'eight', 'eight'); + INSERT INTO t1 VALUES(9, x'7979', x'7979', x'7979', x'7979'); + SELECT count(*) FROM t1; + } +} 9 +do_test descidx3-2.2 { + execsql { + SELECT i FROM t1 ORDER BY a; + } +} {1 5 2 4 3 8 6 7 9} +do_test descidx3-2.3 { + execsql { + SELECT i FROM t1 ORDER BY a DESC; + } +} {9 7 6 8 3 4 2 5 1} + +# The "natural" order for the index is decreasing +do_test descidx3-2.4 { + execsql { + SELECT i FROM t1 WHERE a<=x'7979'; + } +} {9 7 6 8 3 4 2 5} +do_test descidx3-2.5 { + execsql { + SELECT i FROM t1 WHERE a>-99; + } +} {9 7 6 8 3 4 2 5} + +# Even when all values of t1.a are the same, sorting by A returns +# the rows in reverse order because this the natural order of the +# index. +# +do_test descidx3-3.1 { + execsql { + UPDATE t1 SET a=1; + SELECT i FROM t1 ORDER BY a; + } +} {9 7 6 8 3 4 2 5 1} +do_test descidx3-3.2 { + execsql { + SELECT i FROM t1 WHERE a=1 AND b>0 AND b<'zzz' + } +} {2 4 3 8 6} +do_test descidx3-3.3 { + execsql { + SELECT i FROM t1 WHERE b>0 AND b<'zzz' + } +} {6 8 3 4 2} +do_test descidx3-3.4 { + execsql { + SELECT i FROM t1 WHERE a=1 AND b>-9999 AND b-9999 AND b0 AND b<'zzz'; + } +} {8 6 2 4 3} +do_test descidx3-4.2 { + execsql { + UPDATE t1 SET a=1; + SELECT i FROM t1 WHERE a IN (1,2) AND b>0 AND b<'zzz'; + } +} {2 4 3 8 6} +do_test descidx3-4.3 { + execsql { + UPDATE t1 SET b=2; + SELECT i FROM t1 WHERE a IN (1,2) AND b>0 AND b<'zzz'; + } +} {9 7 6 8 3 4 2 5 1} + +finish_test