-C :-)\s(CVS\s39)
-D 2000-06-02T14:38:47
+C :-)\s(CVS\s40)
+D 2000-06-02T15:05:33
F COPYRIGHT 74a8a6531a42e124df07ab5599aad63870fa0bd4
F Makefile.in b0553e870e5daa6279af4dc09101322db16a49f1
F README 51f6a4e7408b34afa5bc1c0485f61b6a4efb6958
F src/tokenize.c 15c229fee77325334c6814652e429b0930eba6c1
F src/update.c 1f7284e00921352c3ae699fb60f2c2fbf8098212
F src/util.c c22846f23b9311ca0e68f076686493bac7b20d5d
-F src/vdbe.c a92f66fa70d1df99ff29795fe8f18e9ea51f8f4c
+F src/vdbe.c 3145ceb0905292965d76c06abecbb24ef96ae7de
F src/vdbe.h ab574c91c6328c5795f68b84074fbcf860eae70e
F src/where.c bed9a8360cbfbf712bdc397c8e22216a5e5f9800
F test/all.test 0950c135cab7e60c07bd745ccfad1476211e5bd7
F test/index.test 8d4f26901a5582daa353fe3c8266cbf4a53af830
F test/insert.test 161bc67a4189738c559e3569323ceae31f4d49d6
F test/select1.test a0b00df77e85adff75c338e487718c5d31f69e3a
-F test/select2.test 93b76d264f5c5ebbb7c1b42a769ef57f25b2d85a
+F test/select2.test ebb5497babf02982304841f2eacc985bcc17691e
F test/table.test 85d6f410d127ec508c6640f02d7c40d218414e81
F test/tester.tcl 44690d463c1dc83a4c76ccde07cc146a988600f6
F test/update.test 69459302ea75cafac1479e60b0e36efb88123c0e
F www/changes.tcl 7d6ed774362dea0c9687d4efbafd939c1c48fd81
F www/index.tcl 95bab9c95813c2222265532e4e0340a8c1d4e354
F www/sqlite.tcl 2f933ce18cffd34a0a020a82435ab937137970fd
-P 46c4b792e0a0e61c417f5c1771e013d90d652507
-R 444367d85cf79b4a6beeebbdc63a3155
+P 721d58f4e1677a5814c00a59cce8c065fea8e7fe
+R 3ced77f16051548a93173912781cdcfd
U drh
-Z 80239af5cac5aef78550208700b8c0c5
+Z a486cf2d12115ac7a91ec4e5894dd94e
-721d58f4e1677a5814c00a59cce8c065fea8e7fe
\ No newline at end of file
+939adb4d373842db0dde6ea00ee2c40316db5ac3
\ No newline at end of file
** But other routines are also provided to help in building up
** a program instruction by instruction.
**
-** $Id: vdbe.c,v 1.9 2000/06/02 01:51:20 drh Exp $
+** $Id: vdbe.c,v 1.10 2000/06/02 15:05:33 drh Exp $
*/
#include "sqliteInt.h"
if( Stringify(p, j) ) goto no_mem;
}
p->zStack[p->tos+1] = 0;
- if( xCallback(pArg, pOp->p1, &p->zStack[i], p->azColName)!=0 ){
- rc = SQLITE_ABORT;
+ if( xCallback!=0 ){
+ if( xCallback(pArg, pOp->p1, &p->zStack[i], p->azColName)!=0 ){
+ rc = SQLITE_ABORT;
+ }
}
PopStack(p, pOp->p1);
break;
case OP_SortCallback: {
int i = p->tos;
if( i<0 ) goto not_enough_stack;
- if( xCallback(pArg, pOp->p1, (char**)p->zStack[i], p->azColName) ){
- rc = SQLITE_ABORT;
+ if( xCallback!=0 ){
+ if( xCallback(pArg, pOp->p1, (char**)p->zStack[i], p->azColName) ){
+ rc = SQLITE_ABORT;
+ }
}
PopStack(p, 1);
break;
# This file implements regression tests for SQLite library. The
# focus of this file is testing the SELECT statement.
#
-# $Id: select2.test,v 1.3 2000/06/02 14:38:47 drh Exp $
+# $Id: select2.test,v 1.4 2000/06/02 15:05:33 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
-puts "Glob: [glob -nocomplain *.txt]"
+# Create a table with some data
+#
execsql {CREATE TABLE tbl1(f1 int, f2 int)}
set f [open ./testdata1.txt w]
for {set i 0} {$i<=30} {incr i} {
}
close $f
execsql {COPY tbl1 FROM './testdata1.txt'}
-# file delete -force ./testdata1.txt
+file delete -force ./testdata1.txt
# Do a second query inside a first.
#
set r
} {0: 0 7 8 9 1: 0 1 8 9 2: 0 1 2 9 3: 0 1 2 3 4: 2 3 4 5: 3 4 5 6: 4 5 6 7: 5 6 7 8: 6 7 8}
-
do_test select2-1.2 {
set sql {SELECT DISTINCT f1 FROM tbl1 WHERE f1>3 AND f1<5}
set r {}
set r
} {4: 2 3 4}
+# Create a largish table
+#
+execsql {CREATE TABLE tbl2(f1 int, f2 int, f3 int)}
+set f [open ./testdata1.txt w]
+for {set i 1} {$i<=30000} {incr i} {
+ puts $f "$i\t[expr {$i*2}]\t[expr {$i*3}]"
+}
+close $f
+execsql {COPY tbl2 FROM './testdata1.txt'}
+file delete -force ./testdata1.txt
+
+do_test select2-2.1 {
+ execsql {SELECT count(*) FROM tbl2}
+} {30000}
+do_test select2-2.2 {
+ execsql {SELECT count(*) FROM tbl2 WHERE f2>1000}
+} {29500}
+
+do_test select2-3.1 {
+ execsql {SELECT f1 FROM tbl2 WHERE f2==1000}
+} {500}
+
+execsql {CREATE INDEX idx1 ON tbl2(f2)}
+
+do_test select2-3.2 {
+ execsql {SELECT f1 FROM tbl2 WHERE f2==1000}
+} {500}
+
+# Make sure queries run faster with an index than without
+#
+do_test select2-3.3 {
+ set t1 [lindex [time {execsql {SELECT f1 from tbl2 WHERE f2==2000}} 1] 0]
+ execsql {DROP INDEX idx1}
+ set t2 [lindex [time {execsql {SELECT f1 FROM tbl2 WHERE f2==2000}} 1] 0]
+ expr {$t1*25 < $t2}
+} {1}
+
finish_test