Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | :-) (CVS 40) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
939adb4d373842db0dde6ea00ee2c403 |
User & Date: | drh 2000-06-02 15:05:33.000 |
Context
2000-06-02
| ||
15:51 | :-) (CVS 41) (check-in: 90cfd6174b user: drh tags: trunk) | |
15:05 | :-) (CVS 40) (check-in: 939adb4d37 user: drh tags: trunk) | |
14:38 | :-) (CVS 39) (check-in: 721d58f4e1 user: drh tags: trunk) | |
Changes
Changes to src/vdbe.c.
︙ | ︙ | |||
37 38 39 40 41 42 43 | ** inplicit conversion from one type to the other occurs as necessary. ** ** Most of the code in this file is taken up by the sqliteVdbeExec() ** function which does the work of interpreting a VDBE program. ** But other routines are also provided to help in building up ** a program instruction by instruction. ** | | | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | ** inplicit conversion from one type to the other occurs as necessary. ** ** Most of the code in this file is taken up by the sqliteVdbeExec() ** function which does the work of interpreting a VDBE program. ** But other routines are also provided to help in building up ** a program instruction by instruction. ** ** $Id: vdbe.c,v 1.10 2000/06/02 15:05:33 drh Exp $ */ #include "sqliteInt.h" /* ** SQL is translated into a sequence of instructions to be ** executed by a virtual machine. Each instruction is an instance ** of the following structure. |
︙ | ︙ | |||
743 744 745 746 747 748 749 | int j; if( i<0 ) goto not_enough_stack; if( NeedStack(p, p->tos+2) ) goto no_mem; for(j=i; j<=p->tos; j++){ if( Stringify(p, j) ) goto no_mem; } p->zStack[p->tos+1] = 0; | > | | > | 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 | int j; if( i<0 ) goto not_enough_stack; if( NeedStack(p, p->tos+2) ) goto no_mem; for(j=i; j<=p->tos; j++){ if( Stringify(p, j) ) goto no_mem; } p->zStack[p->tos+1] = 0; if( xCallback!=0 ){ if( xCallback(pArg, pOp->p1, &p->zStack[i], p->azColName)!=0 ){ rc = SQLITE_ABORT; } } PopStack(p, pOp->p1); break; } /* Opcode: Concat * * * ** |
︙ | ︙ | |||
2018 2019 2020 2021 2022 2023 2024 | ** the SortMakeRec operation with the same P1 value as this ** instruction. Pop this record from the stack and invoke the ** callback on it. */ case OP_SortCallback: { int i = p->tos; if( i<0 ) goto not_enough_stack; | > | | > | 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 | ** the SortMakeRec operation with the same P1 value as this ** instruction. Pop this record from the stack and invoke the ** callback on it. */ case OP_SortCallback: { int i = p->tos; if( i<0 ) goto not_enough_stack; if( xCallback!=0 ){ if( xCallback(pArg, pOp->p1, (char**)p->zStack[i], p->azColName) ){ rc = SQLITE_ABORT; } } PopStack(p, 1); break; } /* Opcode: SortClose P1 * * ** |
︙ | ︙ |
Changes to test/select2.test.
︙ | ︙ | |||
19 20 21 22 23 24 25 | # drh@hwaci.com # http://www.hwaci.com/drh/ # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the SELECT statement. # | | | > | < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | # drh@hwaci.com # http://www.hwaci.com/drh/ # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the SELECT statement. # # $Id: select2.test,v 1.4 2000/06/02 15:05:33 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # 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} { puts $f "[expr {$i%9}]\t[expr {$i%10}]" } close $f execsql {COPY tbl1 FROM './testdata1.txt'} file delete -force ./testdata1.txt # Do a second query inside a first. # do_test select2-1.1 { set sql {SELECT DISTINCT f1 FROM tbl1 ORDER BY f1} set r {} db eval $sql data { set f1 $data(f1) lappend r $f1: set sql2 "SELECT f2 FROM tbl1 WHERE f1=$f1 ORDER BY f2" db eval $sql2 d2 { lappend r $d2(f2) } } 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 {} db eval $sql data { set f1 $data(f1) lappend r $f1: set sql2 "SELECT f2 FROM tbl1 WHERE f1=$f1 ORDER BY f2" db eval $sql2 d2 { lappend r $d2(f2) } } 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 |