:-) (CVS 76)
FossilOrigin-Name: 19029233082e319d4bfd94b22a694c917d8f0296
This commit is contained in:
parent
10e5e3cfde
commit
92dba24b69
13
manifest
13
manifest
@ -1,5 +1,5 @@
|
||||
C :-)\s(CVS\s75)
|
||||
D 2000-06-08T00:19:03
|
||||
C :-)\s(CVS\s76)
|
||||
D 2000-06-08T00:28:52
|
||||
F COPYRIGHT 74a8a6531a42e124df07ab5599aad63870fa0bd4
|
||||
F Makefile.in 17ba1ccf8d2d40c627796bba8f72952365d6d644
|
||||
F README 51f6a4e7408b34afa5bc1c0485f61b6a4efb6958
|
||||
@ -14,7 +14,7 @@ F src/expr.c baa8a4229b3acf69d908efcd697ab63922009c9f
|
||||
F src/insert.c ac4edfff474589c00b2490f206317dc5822122e5
|
||||
F src/main.c e3297835b8e38ca726ac73f2c2bdb7cf08103197
|
||||
F src/parse.y bb2126c8313c111184b89af8675911dcb57f1dca
|
||||
F src/select.c 409c38858024a4bf7d046e0aa387900fb742f70b
|
||||
F src/select.c 5d97d2542abe4675d31d24df7ec2b04f78d89a7f
|
||||
F src/shell.c 3f4afc39a36e4824e8aa262623fd03568874799e
|
||||
F src/sqlite.h 58da0a8590133777b741f9836beaef3d58f40268
|
||||
F src/sqliteInt.h 816c491f9896090dde03804fd3f60346456b99df
|
||||
@ -38,6 +38,7 @@ F test/main.test cf1e9035aca55da9ef6d3b73ab36c54b7514b83f
|
||||
F test/select1.test 64703852af34c85bb31b0a74bd73b340e8267f42
|
||||
F test/select2.test 3cd3c0f9d67e98b1b54af5853679b4a111224410
|
||||
F test/select3.test 73ae8c7b80c4e03a9c29d12f2ea1782e28b8e61f
|
||||
F test/select4.test c9b4b4ab9fefee41859b05f42d1237e2c4080612
|
||||
F test/sort.test d582086c4bb7df3fbf50aa72e69d7e235e9f8e31
|
||||
F test/subselect.test bf8b251a92fb091973c1c469ce499dc9648a41d5
|
||||
F test/table.test 85d6f410d127ec508c6640f02d7c40d218414e81
|
||||
@ -54,7 +55,7 @@ F www/c_interface.tcl 9ac800854272db5fe439e07b7435b243a5422293
|
||||
F www/changes.tcl 04e66b4257589ff78a7e1de93e9dda4725fb03d6
|
||||
F www/index.tcl 52e29a4eeda8d59e91af43c61fef177c5f2ffd53
|
||||
F www/sqlite.tcl 2f933ce18cffd34a0a020a82435ab937137970fd
|
||||
P 2ffeb8509c469f5a499d56bb109da079fcdff570
|
||||
R 34a6f329df3d735505a6a2ab126209c9
|
||||
P c47d552e7e275dcc03a687e2a874e8e6e1eeb109
|
||||
R 26d7a98ed8d3a0f1eb183339f6803dc3
|
||||
U drh
|
||||
Z e59795bced83ef8a6bbccbb701b0703f
|
||||
Z aff0389b3f704be27fd43dfadeac47e1
|
||||
|
@ -1 +1 @@
|
||||
c47d552e7e275dcc03a687e2a874e8e6e1eeb109
|
||||
19029233082e319d4bfd94b22a694c917d8f0296
|
@ -24,7 +24,7 @@
|
||||
** This file contains C code routines that are called by the parser
|
||||
** to handle SELECT statements.
|
||||
**
|
||||
** $Id: select.c,v 1.17 2000/06/08 00:19:03 drh Exp $
|
||||
** $Id: select.c,v 1.18 2000/06/08 00:28:52 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
|
||||
@ -509,6 +509,9 @@ static int multiSelect(Parse *pParse, Select *p, int eDest, int iParm){
|
||||
int iCont, iBreak;
|
||||
assert( p->pEList );
|
||||
generateColumnNames(pParse, 0, p->pEList);
|
||||
if( p->pOrderBy ){
|
||||
sqliteVdbeAddOp(v, OP_SortOpen, 0, 0, 0, 0);
|
||||
}
|
||||
iBreak = sqliteVdbeMakeLabel(v);
|
||||
iCont = sqliteVdbeAddOp(v, OP_Next, unionTab, iBreak, 0, 0);
|
||||
rc = selectInnerLoop(pParse, 0, unionTab, p->pEList->nExpr,
|
||||
@ -558,6 +561,9 @@ static int multiSelect(Parse *pParse, Select *p, int eDest, int iParm){
|
||||
*/
|
||||
assert( p->pEList );
|
||||
generateColumnNames(pParse, 0, p->pEList);
|
||||
if( p->pOrderBy ){
|
||||
sqliteVdbeAddOp(v, OP_SortOpen, 0, 0, 0, 0);
|
||||
}
|
||||
iBreak = sqliteVdbeMakeLabel(v);
|
||||
iCont = sqliteVdbeAddOp(v, OP_Next, tab1, iBreak, 0, 0);
|
||||
sqliteVdbeAddOp(v, OP_Key, tab1, 0, 0, 0);
|
||||
|
131
test/select4.test
Normal file
131
test/select4.test
Normal file
@ -0,0 +1,131 @@
|
||||
# Copyright (c) 1999, 2000 D. Richard Hipp
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this library; if not, write to the
|
||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# Author contact information:
|
||||
# drh@hwaci.com
|
||||
# http://www.hwaci.com/drh/
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing UNION, INTERSECT and EXCEPT operators
|
||||
# in SELECT statements.
|
||||
#
|
||||
# $Id: select4.test,v 1.1 2000/06/08 00:28:52 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
|
||||
# Build some test data
|
||||
#
|
||||
do_test select4-1.0 {
|
||||
set fd [open data1.txt w]
|
||||
for {set i 1} {$i<32} {incr i} {
|
||||
for {set j 0} {pow(2,$j)<$i} {incr j} {}
|
||||
puts $fd "$i\t$j"
|
||||
}
|
||||
close $fd
|
||||
execsql {
|
||||
CREATE TABLE t1(n int, log int);
|
||||
COPY t1 FROM 'data1.txt'
|
||||
}
|
||||
file delete data1.txt
|
||||
execsql {SELECT DISTINCT log FROM t1 ORDER BY log}
|
||||
} {0 1 2 3 4 5}
|
||||
|
||||
# Union All operator
|
||||
#
|
||||
do_test select4-1.1a {
|
||||
lsort [execsql {SELECT DISTINCT log FROM t1}]
|
||||
} {0 1 2 3 4 5}
|
||||
do_test select4-1.1b {
|
||||
lsort [execsql {SELECT n FROM t1 WHERE log=3}]
|
||||
} {5 6 7 8}
|
||||
do_test select4-1.1c {
|
||||
execsql {
|
||||
SELECT DISTINCT log FROM t1
|
||||
UNION ALL
|
||||
SELECT n FROM t1 WHERE log=3
|
||||
ORDER BY log;
|
||||
}
|
||||
} {0 1 2 3 4 5 5 6 7 8}
|
||||
do_test select4-1.2 {
|
||||
execsql {
|
||||
SELECT log FROM t1 WHERE n IN
|
||||
(SELECT DISTINCT log FROM t1 UNION ALL
|
||||
SELECT n FROM t1 WHERE log=3)
|
||||
ORDER BY log;
|
||||
}
|
||||
} {0 1 2 2 3 3 3 3}
|
||||
|
||||
# Union operator
|
||||
#
|
||||
do_test select4-2.1 {
|
||||
execsql {
|
||||
SELECT DISTINCT log FROM t1
|
||||
UNION
|
||||
SELECT n FROM t1 WHERE log=3
|
||||
ORDER BY log;
|
||||
}
|
||||
} {0 1 2 3 4 5 6 7 8}
|
||||
do_test select4-2.2 {
|
||||
execsql {
|
||||
SELECT log FROM t1 WHERE n IN
|
||||
(SELECT DISTINCT log FROM t1 UNION
|
||||
SELECT n FROM t1 WHERE log=3)
|
||||
ORDER BY log;
|
||||
}
|
||||
} {0 1 2 2 3 3 3 3}
|
||||
|
||||
# Except operator
|
||||
#
|
||||
do_test select4-3.1 {
|
||||
execsql {
|
||||
SELECT DISTINCT log FROM t1
|
||||
EXCEPT
|
||||
SELECT n FROM t1 WHERE log=3
|
||||
ORDER BY log;
|
||||
}
|
||||
} {0 1 2 3 4}
|
||||
do_test select4-3.2 {
|
||||
execsql {
|
||||
SELECT log FROM t1 WHERE n IN
|
||||
(SELECT DISTINCT log FROM t1 EXCEPT
|
||||
SELECT n FROM t1 WHERE log=3)
|
||||
ORDER BY log;
|
||||
}
|
||||
} {0 1 2 2}
|
||||
|
||||
# Intersect operator
|
||||
#
|
||||
do_test select4-4.1 {
|
||||
execsql {
|
||||
SELECT DISTINCT log FROM t1
|
||||
INTERSECT
|
||||
SELECT n FROM t1 WHERE log=3
|
||||
ORDER BY log;
|
||||
}
|
||||
} {5}
|
||||
do_test select4-4.2 {
|
||||
execsql {
|
||||
SELECT log FROM t1 WHERE n IN
|
||||
(SELECT DISTINCT log FROM t1 INTERSECT
|
||||
SELECT n FROM t1 WHERE log=3)
|
||||
ORDER BY log;
|
||||
}
|
||||
} {3}
|
||||
|
||||
finish_test
|
Loading…
x
Reference in New Issue
Block a user