]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
:-) (CVS 40)
authordrh <drh@noemail.net>
Fri, 2 Jun 2000 15:05:33 +0000 (15:05 +0000)
committerdrh <drh@noemail.net>
Fri, 2 Jun 2000 15:05:33 +0000 (15:05 +0000)
FossilOrigin-Name: 939adb4d373842db0dde6ea00ee2c40316db5ac3

manifest
manifest.uuid
src/vdbe.c
test/select2.test

index 64fed062b06123c2df784f49de78faf6ec749939..2e7c14583facc6bc0618301c5fbba785b5fac6b5 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-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
@@ -22,7 +22,7 @@ F src/tclsqlite.c 10c00c460246cfba375b768c90b22bfe3c774c8f
 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
@@ -32,7 +32,7 @@ F test/expr.test f3fc925935533082911dfa5fde9b22e382b3132f
 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
@@ -46,7 +46,7 @@ F www/c_interface.tcl 8867d76ddd416d2fbd41e4cb3de8efa9cef105a5
 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
index 422df02b9624a618771dd7445f8a20172a5bf7d9..c76ab57a0f59a561fb03f331191839196b6fa61a 100644 (file)
@@ -1 +1 @@
-721d58f4e1677a5814c00a59cce8c065fea8e7fe
\ No newline at end of file
+939adb4d373842db0dde6ea00ee2c40316db5ac3
\ No newline at end of file
index bb28801580bcae66918cb3b2ead18c64fea21755..6fc4097f1eacd57acdaa8a99fb04497854994405 100644 (file)
@@ -41,7 +41,7 @@
 ** 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"
 
@@ -747,8 +747,10 @@ int sqliteVdbeExec(
           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;
@@ -2022,8 +2024,10 @@ int sqliteVdbeExec(
       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;
index e8a38a153388c703350ce7cdb525111df6f27645..65439abc36301a7076adbe41a4275ecaa06f4856 100644 (file)
 # 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} {
@@ -36,7 +37,7 @@ 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.
 #
@@ -54,7 +55,6 @@ do_test select2-1.1 {
   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 {}
@@ -69,4 +69,41 @@ do_test select2-1.2 {
   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