mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Add a few more tests and fix a few bugs that the tests uncovered. (CVS 652)
FossilOrigin-Name: 91c0db66c86facb21b5b522afadd83d91a488256
This commit is contained in:
26
manifest
26
manifest
@ -1,5 +1,5 @@
|
|||||||
C Additional\stest\scases\sadded.\s\sThe\sfollowing\sbug\sfixed:\sA\ssegfault\swas\soccurring\nif\sa\sVIEW\sconsisted\sof\sa\sjoin\swith\sa\sUSING\sclause.\s(CVS\s651)
|
C Add\sa\sfew\smore\stests\sand\sfix\sa\sfew\sbugs\sthat\sthe\stests\suncovered.\s(CVS\s652)
|
||||||
D 2002-06-28T12:18:47
|
D 2002-06-29T02:20:08
|
||||||
F Makefile.in 6291a33b87d2a395aafd7646ee1ed562c6f2c28c
|
F Makefile.in 6291a33b87d2a395aafd7646ee1ed562c6f2c28c
|
||||||
F Makefile.template 4e11752e0b5c7a043ca50af4296ec562857ba495
|
F Makefile.template 4e11752e0b5c7a043ca50af4296ec562857ba495
|
||||||
F README a4c0ba11354ef6ba0776b400d057c59da47a4cc0
|
F README a4c0ba11354ef6ba0776b400d057c59da47a4cc0
|
||||||
@ -23,7 +23,7 @@ F src/btree.h 8abeabfe6e0b1a990b64fa457592a6482f6674f3
|
|||||||
F src/build.c 0834185cbe316dda5173de50886ed804b82e3ba6
|
F src/build.c 0834185cbe316dda5173de50886ed804b82e3ba6
|
||||||
F src/delete.c 44c45460b1e03033756e35adc6d569ffbf30b725
|
F src/delete.c 44c45460b1e03033756e35adc6d569ffbf30b725
|
||||||
F src/encode.c 346b12b46148506c32038524b95c4631ab46d760
|
F src/encode.c 346b12b46148506c32038524b95c4631ab46d760
|
||||||
F src/expr.c c5b8ee4d51df4de4ee51cadfd0123294e3d683d5
|
F src/expr.c ecd8267f70f4099b760c3862527a52cdfb768612
|
||||||
F src/func.c 5eae8227a8b0d276a64d51a3880a6e86f238fedf
|
F src/func.c 5eae8227a8b0d276a64d51a3880a6e86f238fedf
|
||||||
F src/hash.c 6a6236b89c8c060c65dabd300a1c8ce7c10edb72
|
F src/hash.c 6a6236b89c8c060c65dabd300a1c8ce7c10edb72
|
||||||
F src/hash.h cd0433998bc1a3759d244e1637fe5a3c13b53bf8
|
F src/hash.h cd0433998bc1a3759d244e1637fe5a3c13b53bf8
|
||||||
@ -37,11 +37,11 @@ F src/pager.h 6fddfddd3b73aa8abc081b973886320e3c614f0e
|
|||||||
F src/parse.y c75ea2580de675bcb80ff8b7c10c0a15e02a21ab
|
F src/parse.y c75ea2580de675bcb80ff8b7c10c0a15e02a21ab
|
||||||
F src/printf.c 236ed7a79386feed4456fa728fff8be793f1547c
|
F src/printf.c 236ed7a79386feed4456fa728fff8be793f1547c
|
||||||
F src/random.c 19e8e00fe0df32a742f115773f57651be327cabe
|
F src/random.c 19e8e00fe0df32a742f115773f57651be327cabe
|
||||||
F src/select.c 473670ff00c30ffa92784a49766c522181239a9a
|
F src/select.c 63a10ea636c8ac8cdf2fbb804fbfcfd372150717
|
||||||
F src/shell.c 0b06e4421ddf34f30263a2674abe768a2b5fd538
|
F src/shell.c 0b06e4421ddf34f30263a2674abe768a2b5fd538
|
||||||
F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e
|
F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e
|
||||||
F src/sqlite.h.in 75c5bbb066d0faf34424b7d1babf8b44d5b31af2
|
F src/sqlite.h.in 75c5bbb066d0faf34424b7d1babf8b44d5b31af2
|
||||||
F src/sqliteInt.h 0f2cca162fbb352ca53f97283dbafce31495dcce
|
F src/sqliteInt.h 314a4feb08cccdeb90b434e6dde86b93d2f36b8e
|
||||||
F src/table.c eed2098c9b577aa17f8abe89313a9c4413f57d63
|
F src/table.c eed2098c9b577aa17f8abe89313a9c4413f57d63
|
||||||
F src/tclsqlite.c e932591c0bb522b0a35ea7dc861c623ccb2e3aa8
|
F src/tclsqlite.c e932591c0bb522b0a35ea7dc861c623ccb2e3aa8
|
||||||
F src/test1.c 29ed719d8ce890733fbeadb53cacc4e542d423ed
|
F src/test1.c 29ed719d8ce890733fbeadb53cacc4e542d423ed
|
||||||
@ -50,9 +50,9 @@ F src/test3.c 72ac6a9017a70e542954907a1dfd87ab6f7824e3
|
|||||||
F src/threadtest.c 81f0598e0f031c1bd506af337fdc1b7e8dff263f
|
F src/threadtest.c 81f0598e0f031c1bd506af337fdc1b7e8dff263f
|
||||||
F src/tokenize.c ac4c46f190346b87da54ec3e2605d160af80c619
|
F src/tokenize.c ac4c46f190346b87da54ec3e2605d160af80c619
|
||||||
F src/trigger.c d88ab4d68d68955c217b38fb6717e090fbbf54a4
|
F src/trigger.c d88ab4d68d68955c217b38fb6717e090fbbf54a4
|
||||||
F src/update.c 6f6a4dcd71cd9ff730b7f12c83de5498cde4924f
|
F src/update.c 06303bf3895032c7eccb748927f650ed02b9f0cf
|
||||||
F src/util.c 876b259f9186e84b944b72e793dd3dad50e63e95
|
F src/util.c 876b259f9186e84b944b72e793dd3dad50e63e95
|
||||||
F src/vdbe.c 0c7783ba52b1bd9e40331937c32d3aa3351ff4a3
|
F src/vdbe.c c83ece2aeb3a6ce7de9a1636c98c3feec9267499
|
||||||
F src/vdbe.h a9292f2b5fcecef924fa255fb74609e9cbc776c2
|
F src/vdbe.h a9292f2b5fcecef924fa255fb74609e9cbc776c2
|
||||||
F src/where.c 6a43aa6c80eab12221eeca754cba852a9ecd1e13
|
F src/where.c 6a43aa6c80eab12221eeca754cba852a9ecd1e13
|
||||||
F test/all.test e4d3821eeba751829b419cd47814bd20af4286d1
|
F test/all.test e4d3821eeba751829b419cd47814bd20af4286d1
|
||||||
@ -63,8 +63,8 @@ F test/btree3.test 9caa9e22491dd8cd8aa36d7ac3b48b089817c895
|
|||||||
F test/conflict.test 4518cc3c1c40c4ba74220d9ee814257ae7d09c47
|
F test/conflict.test 4518cc3c1c40c4ba74220d9ee814257ae7d09c47
|
||||||
F test/copy.test 92e21ebea11319c3f70448d3763fdaa0e2f1c21f
|
F test/copy.test 92e21ebea11319c3f70448d3763fdaa0e2f1c21f
|
||||||
F test/delete.test c904a62129fe102b314a96111a8417f10249e4d8
|
F test/delete.test c904a62129fe102b314a96111a8417f10249e4d8
|
||||||
F test/expr.test c61a92f7d76d63d7379d58bc35245e156c9b63c3
|
F test/expr.test 5fadd0bc87c223b424ce6752b576c1df346abf1f
|
||||||
F test/func.test 628ab513b0d9c54251a63e026a26b7b4347e54ab
|
F test/func.test 7e5500c9db4b02fd62f9737931a6ada01e3b55d0
|
||||||
F test/in.test c09312672e3f0709fa02c8e2e9cd8fb4bd6269aa
|
F test/in.test c09312672e3f0709fa02c8e2e9cd8fb4bd6269aa
|
||||||
F test/index.test c8a471243bbf878974b99baf5badd59407237cf3
|
F test/index.test c8a471243bbf878974b99baf5badd59407237cf3
|
||||||
F test/insert.test a122afb86911e77c181d912348866a5b1a61eeab
|
F test/insert.test a122afb86911e77c181d912348866a5b1a61eeab
|
||||||
@ -94,7 +94,7 @@ F test/select4.test 10ba54f24ef6ca7958a7045b001079378db2370c
|
|||||||
F test/select5.test c2a6c4a003316ee42cbbd689eebef8fdce0db2ac
|
F test/select5.test c2a6c4a003316ee42cbbd689eebef8fdce0db2ac
|
||||||
F test/select6.test efb8d0c07a440441db87db2c4ade6904e1407e85
|
F test/select6.test efb8d0c07a440441db87db2c4ade6904e1407e85
|
||||||
F test/sort.test 3b996ce7ca385f9cd559944ac0f4027a23aa546b
|
F test/sort.test 3b996ce7ca385f9cd559944ac0f4027a23aa546b
|
||||||
F test/subselect.test f3bc1dcbddddcea08d818fcff75228ad3464fc83
|
F test/subselect.test 64e71b1be804dc57c72b61d2bd7b506dbc962c40
|
||||||
F test/table.test 42511f98a3e9bbee62913e3ae1774777faa23d35
|
F test/table.test 42511f98a3e9bbee62913e3ae1774777faa23d35
|
||||||
F test/tableapi.test 3c80421a889e1d106df16e5800fa787f0d2914a6
|
F test/tableapi.test 3c80421a889e1d106df16e5800fa787f0d2914a6
|
||||||
F test/tclsqlite.test 6f4b9760681c7dbca52a18d0ab46a1679cdc79b9
|
F test/tclsqlite.test 6f4b9760681c7dbca52a18d0ab46a1679cdc79b9
|
||||||
@ -137,7 +137,7 @@ F www/speed.tcl da8afcc1d3ccc5696cfb388a68982bc3d9f7f00f
|
|||||||
F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098
|
F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098
|
||||||
F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
|
F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
|
||||||
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
|
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
|
||||||
P c07e493b62125e85eaea36b6945f1e146e2792b8
|
P 96515b813eb57e1f48c28d357d1f38639b2fdcfa
|
||||||
R 533eee0cd3864ec067733fb32b2f681d
|
R c1f2449afe59030f9bd638b2fb549a9b
|
||||||
U drh
|
U drh
|
||||||
Z 42e105a8fbfb4f79b6ee97023cbdbecf
|
Z e559f098ea075de4e2b198f365f605ef
|
||||||
|
@ -1 +1 @@
|
|||||||
96515b813eb57e1f48c28d357d1f38639b2fdcfa
|
91c0db66c86facb21b5b522afadd83d91a488256
|
@ -12,7 +12,7 @@
|
|||||||
** This file contains routines used for analyzing expressions and
|
** This file contains routines used for analyzing expressions and
|
||||||
** for generating VDBE code that evaluates expressions in SQLite.
|
** for generating VDBE code that evaluates expressions in SQLite.
|
||||||
**
|
**
|
||||||
** $Id: expr.c,v 1.75 2002/06/28 12:18:47 drh Exp $
|
** $Id: expr.c,v 1.76 2002/06/29 02:20:08 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -370,7 +370,7 @@ int sqliteExprIsInteger(Expr *p, int *pValue){
|
|||||||
/*
|
/*
|
||||||
** Return TRUE if the given string is a row-id column name.
|
** Return TRUE if the given string is a row-id column name.
|
||||||
*/
|
*/
|
||||||
static int sqliteIsRowid(const char *z){
|
int sqliteIsRowid(const char *z){
|
||||||
if( sqliteStrICmp(z, "_ROWID_")==0 ) return 1;
|
if( sqliteStrICmp(z, "_ROWID_")==0 ) return 1;
|
||||||
if( sqliteStrICmp(z, "ROWID")==0 ) return 1;
|
if( sqliteStrICmp(z, "ROWID")==0 ) return 1;
|
||||||
if( sqliteStrICmp(z, "OID")==0 ) return 1;
|
if( sqliteStrICmp(z, "OID")==0 ) return 1;
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
** This file contains C code routines that are called by the parser
|
** This file contains C code routines that are called by the parser
|
||||||
** to handle SELECT statements in SQLite.
|
** to handle SELECT statements in SQLite.
|
||||||
**
|
**
|
||||||
** $Id: select.c,v 1.101 2002/06/28 12:18:47 drh Exp $
|
** $Id: select.c,v 1.102 2002/06/29 02:20:08 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
|
||||||
@ -436,14 +436,16 @@ static int selectInnerLoop(
|
|||||||
** item into the set table with bogus data.
|
** item into the set table with bogus data.
|
||||||
*/
|
*/
|
||||||
case SRT_Set: {
|
case SRT_Set: {
|
||||||
|
int lbl = sqliteVdbeMakeLabel(v);
|
||||||
assert( nColumn==1 );
|
assert( nColumn==1 );
|
||||||
sqliteVdbeAddOp(v, OP_IsNull, -1, sqliteVdbeCurrentAddr(v)+3);
|
sqliteVdbeAddOp(v, OP_IsNull, -1, lbl);
|
||||||
sqliteVdbeAddOp(v, OP_String, 0, 0);
|
|
||||||
if( pOrderBy ){
|
if( pOrderBy ){
|
||||||
pushOntoSorter(pParse, v, pOrderBy);
|
pushOntoSorter(pParse, v, pOrderBy);
|
||||||
}else{
|
}else{
|
||||||
|
sqliteVdbeAddOp(v, OP_String, 0, 0);
|
||||||
sqliteVdbeAddOp(v, OP_PutStrKey, iParm, 0);
|
sqliteVdbeAddOp(v, OP_PutStrKey, iParm, 0);
|
||||||
}
|
}
|
||||||
|
sqliteVdbeResolveLabel(v, lbl);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
*************************************************************************
|
*************************************************************************
|
||||||
** Internal interface definitions for SQLite.
|
** Internal interface definitions for SQLite.
|
||||||
**
|
**
|
||||||
** @(#) $Id: sqliteInt.h,v 1.132 2002/06/28 12:18:47 drh Exp $
|
** @(#) $Id: sqliteInt.h,v 1.133 2002/06/29 02:20:09 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqlite.h"
|
#include "sqlite.h"
|
||||||
#include "hash.h"
|
#include "hash.h"
|
||||||
@ -908,6 +908,7 @@ void sqliteRollbackTransaction(Parse*);
|
|||||||
char *sqlite_mprintf(const char *, ...);
|
char *sqlite_mprintf(const char *, ...);
|
||||||
int sqliteExprIsConstant(Expr*);
|
int sqliteExprIsConstant(Expr*);
|
||||||
int sqliteExprIsInteger(Expr*, int*);
|
int sqliteExprIsInteger(Expr*, int*);
|
||||||
|
int sqliteIsRowid(const char*);
|
||||||
void sqliteGenerateRowDelete(Vdbe*, Table*, int, int);
|
void sqliteGenerateRowDelete(Vdbe*, Table*, int, int);
|
||||||
void sqliteGenerateRowIndexDelete(Vdbe*, Table*, int, char*);
|
void sqliteGenerateRowIndexDelete(Vdbe*, Table*, int, char*);
|
||||||
void sqliteGenerateConstraintChecks(Parse*,Table*,int,char*,int,int,int,int);
|
void sqliteGenerateConstraintChecks(Parse*,Table*,int,char*,int,int,int,int);
|
||||||
|
10
src/update.c
10
src/update.c
@ -12,7 +12,7 @@
|
|||||||
** This file contains C code routines that are called by the parser
|
** This file contains C code routines that are called by the parser
|
||||||
** to handle UPDATE statements.
|
** to handle UPDATE statements.
|
||||||
**
|
**
|
||||||
** $Id: update.c,v 1.45 2002/06/19 14:27:06 drh Exp $
|
** $Id: update.c,v 1.46 2002/06/29 02:20:09 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
|
||||||
@ -293,12 +293,8 @@ void sqliteUpdate(
|
|||||||
** on top of the stack.)
|
** on top of the stack.)
|
||||||
*/
|
*/
|
||||||
if( chngRecno ){
|
if( chngRecno ){
|
||||||
if( pTab->iPKey<0 || (j = aXRef[pTab->iPKey])<0 ){
|
sqliteExprCode(pParse, pRecnoExpr);
|
||||||
sqliteVdbeAddOp(v, OP_Dup, 0, 0);
|
sqliteVdbeAddOp(v, OP_MustBeInt, 0, 0);
|
||||||
}else{
|
|
||||||
sqliteExprCode(pParse, pChanges->a[j].pExpr);
|
|
||||||
sqliteVdbeAddOp(v, OP_MustBeInt, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compute new data for this record.
|
/* Compute new data for this record.
|
||||||
|
23
src/vdbe.c
23
src/vdbe.c
@ -30,7 +30,7 @@
|
|||||||
** But other routines are also provided to help in building up
|
** But other routines are also provided to help in building up
|
||||||
** a program instruction by instruction.
|
** a program instruction by instruction.
|
||||||
**
|
**
|
||||||
** $Id: vdbe.c,v 1.162 2002/06/28 01:02:38 drh Exp $
|
** $Id: vdbe.c,v 1.163 2002/06/29 02:20:09 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -1649,7 +1649,8 @@ case OP_NullCallback: {
|
|||||||
** Look at the first P1 elements of the stack. Append them all
|
** Look at the first P1 elements of the stack. Append them all
|
||||||
** together with the lowest element first. Use P3 as a separator.
|
** together with the lowest element first. Use P3 as a separator.
|
||||||
** Put the result on the top of the stack. The original P1 elements
|
** Put the result on the top of the stack. The original P1 elements
|
||||||
** are popped from the stack if P2==0 and retained if P2==1.
|
** are popped from the stack if P2==0 and retained if P2==1. If
|
||||||
|
** any element of the stack is NULL, then the result is NULL.
|
||||||
**
|
**
|
||||||
** If P3 is NULL, then use no separator. When P1==1, this routine
|
** If P3 is NULL, then use no separator. When P1==1, this routine
|
||||||
** makes a copy of the top stack element into memory obtained
|
** makes a copy of the top stack element into memory obtained
|
||||||
@ -1671,12 +1672,21 @@ case OP_Concat: {
|
|||||||
nByte = 1 - nSep;
|
nByte = 1 - nSep;
|
||||||
for(i=p->tos-nField+1; i<=p->tos; i++){
|
for(i=p->tos-nField+1; i<=p->tos; i++){
|
||||||
if( aStack[i].flags & STK_Null ){
|
if( aStack[i].flags & STK_Null ){
|
||||||
nByte += nSep;
|
nByte = -1;
|
||||||
|
break;
|
||||||
}else{
|
}else{
|
||||||
if( Stringify(p, i) ) goto no_mem;
|
if( Stringify(p, i) ) goto no_mem;
|
||||||
nByte += aStack[i].n - 1 + nSep;
|
nByte += aStack[i].n - 1 + nSep;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if( nByte<0 ){
|
||||||
|
if( pOp->p2==0 ) PopStack(p, nField);
|
||||||
|
VERIFY( NeedStack(p, p->tos+1); )
|
||||||
|
p->tos++;
|
||||||
|
aStack[p->tos].flags = STK_Null;
|
||||||
|
zStack[p->tos] = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
zNew = sqliteMalloc( nByte );
|
zNew = sqliteMalloc( nByte );
|
||||||
if( zNew==0 ) goto no_mem;
|
if( zNew==0 ) goto no_mem;
|
||||||
j = 0;
|
j = 0;
|
||||||
@ -4194,11 +4204,14 @@ case OP_SortPut: {
|
|||||||
pSorter->pNext = p->pSort;
|
pSorter->pNext = p->pSort;
|
||||||
p->pSort = pSorter;
|
p->pSort = pSorter;
|
||||||
assert( aStack[tos].flags & STK_Dyn );
|
assert( aStack[tos].flags & STK_Dyn );
|
||||||
assert( aStack[nos].flags & STK_Dyn );
|
|
||||||
pSorter->nKey = aStack[tos].n;
|
pSorter->nKey = aStack[tos].n;
|
||||||
pSorter->zKey = zStack[tos];
|
pSorter->zKey = zStack[tos];
|
||||||
pSorter->nData = aStack[nos].n;
|
pSorter->nData = aStack[nos].n;
|
||||||
pSorter->pData = zStack[nos];
|
if( aStack[nos].flags & STK_Dyn ){
|
||||||
|
pSorter->pData = zStack[nos];
|
||||||
|
}else{
|
||||||
|
pSorter->pData = sqliteStrDup(zStack[nos]);
|
||||||
|
}
|
||||||
aStack[tos].flags = 0;
|
aStack[tos].flags = 0;
|
||||||
aStack[nos].flags = 0;
|
aStack[nos].flags = 0;
|
||||||
zStack[tos] = 0;
|
zStack[tos] = 0;
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
# This file implements regression tests for SQLite library. The
|
# This file implements regression tests for SQLite library. The
|
||||||
# focus of this file is testing expressions.
|
# focus of this file is testing expressions.
|
||||||
#
|
#
|
||||||
# $Id: expr.test,v 1.24 2002/05/31 15:51:26 drh Exp $
|
# $Id: expr.test,v 1.25 2002/06/29 02:20:09 drh Exp $
|
||||||
|
|
||||||
set testdir [file dirname $argv0]
|
set testdir [file dirname $argv0]
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
@ -181,8 +181,8 @@ test_expr expr-3.27 {t1=NULL, t2='hi'} {t1 notnull} 0
|
|||||||
test_expr expr-3.28 {t1=NULL, t2='hi'} {t2 notnull} 1
|
test_expr expr-3.28 {t1=NULL, t2='hi'} {t2 notnull} 1
|
||||||
test_expr expr-3.28b {t1=NULL, t2='hi'} {t2 is not null} 1
|
test_expr expr-3.28b {t1=NULL, t2='hi'} {t2 is not null} 1
|
||||||
test_expr expr-3.29 {t1='xyz', t2='abc'} {t1||t2} {xyzabc}
|
test_expr expr-3.29 {t1='xyz', t2='abc'} {t1||t2} {xyzabc}
|
||||||
test_expr expr-3.30 {t1=NULL, t2='abc'} {t1||t2} {abc}
|
test_expr expr-3.30 {t1=NULL, t2='abc'} {t1||t2} {{}}
|
||||||
test_expr expr-3.31 {t1='xyz', t2=NULL} {t1||t2} {xyz}
|
test_expr expr-3.31 {t1='xyz', t2=NULL} {t1||t2} {{}}
|
||||||
test_expr expr-3.32 {t1='xyz', t2='abc'} {t1||' hi '||t2} {{xyz hi abc}}
|
test_expr expr-3.32 {t1='xyz', t2='abc'} {t1||' hi '||t2} {{xyz hi abc}}
|
||||||
|
|
||||||
test_expr expr-4.1 {t1='abc', t2='Abc'} {t1<t2} 0
|
test_expr expr-4.1 {t1='abc', t2='Abc'} {t1<t2} 0
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
# This file implements regression tests for SQLite library. The
|
# This file implements regression tests for SQLite library. The
|
||||||
# focus of this file is testing built-in functions.
|
# focus of this file is testing built-in functions.
|
||||||
#
|
#
|
||||||
# $Id: func.test,v 1.12 2002/05/29 23:22:23 drh Exp $
|
# $Id: func.test,v 1.13 2002/06/29 02:20:09 drh Exp $
|
||||||
|
|
||||||
set testdir [file dirname $argv0]
|
set testdir [file dirname $argv0]
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
@ -221,7 +221,7 @@ do_test func-5.5 {
|
|||||||
catchsql {SELECT upper(*) FROM t2}
|
catchsql {SELECT upper(*) FROM t2}
|
||||||
} {1 {wrong number of arguments to function upper()}}
|
} {1 {wrong number of arguments to function upper()}}
|
||||||
|
|
||||||
# Test the coalesce() function
|
# Test the coalesce() and nullif() functions
|
||||||
#
|
#
|
||||||
do_test func-6.1 {
|
do_test func-6.1 {
|
||||||
execsql {SELECT coalesce(a,'xyz') FROM t2}
|
execsql {SELECT coalesce(a,'xyz') FROM t2}
|
||||||
@ -229,6 +229,16 @@ do_test func-6.1 {
|
|||||||
do_test func-6.2 {
|
do_test func-6.2 {
|
||||||
execsql {SELECT coalesce(upper(a),'nil') FROM t2}
|
execsql {SELECT coalesce(upper(a),'nil') FROM t2}
|
||||||
} {1 nil 345 nil 67890}
|
} {1 nil 345 nil 67890}
|
||||||
|
do_test func-6.3 {
|
||||||
|
execsql {SELECT coalesce(nullif(1,1),'nil')}
|
||||||
|
} {nil}
|
||||||
|
do_test func-6.4 {
|
||||||
|
execsql {SELECT coalesce(nullif(1,2),'nil')}
|
||||||
|
} {1}
|
||||||
|
do_test func-6.5 {
|
||||||
|
execsql {SELECT coalesce(nullif(1,NULL),'nil')}
|
||||||
|
} {1}
|
||||||
|
|
||||||
|
|
||||||
# Test the last_insert_rowid() function
|
# Test the last_insert_rowid() function
|
||||||
#
|
#
|
||||||
@ -243,6 +253,24 @@ do_test func-8.1 {
|
|||||||
SELECT sum(a), count(a), round(avg(a),2), min(a), max(a), count(*) FROM t2;
|
SELECT sum(a), count(a), round(avg(a),2), min(a), max(a), count(*) FROM t2;
|
||||||
}
|
}
|
||||||
} {68236 3 22745.33 1 67890 5}
|
} {68236 3 22745.33 1 67890 5}
|
||||||
|
do_test func-8.2 {
|
||||||
|
execsql {
|
||||||
|
SELECT max('z+'||a||'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP') FROM t2;
|
||||||
|
}
|
||||||
|
} {z+67890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP}
|
||||||
|
do_test func-8.3 {
|
||||||
|
execsql {
|
||||||
|
CREATE TEMP TABLE t3 AS SELECT a FROM t2 ORDER BY a DESC;
|
||||||
|
SELECT min('z+'||a||'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP') FROM t3;
|
||||||
|
}
|
||||||
|
} {z+1abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP}
|
||||||
|
|
||||||
|
# How do you test the random() function in a meaningful, deterministic way?
|
||||||
|
#
|
||||||
|
do_test func-9.1 {
|
||||||
|
execsql {
|
||||||
|
SELECT random() is not null;
|
||||||
|
}
|
||||||
|
} {1}
|
||||||
|
|
||||||
finish_test
|
finish_test
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
# focus of this file is testing SELECT statements that are part of
|
# focus of this file is testing SELECT statements that are part of
|
||||||
# expressions.
|
# expressions.
|
||||||
#
|
#
|
||||||
# $Id: subselect.test,v 1.5 2002/05/26 20:54:35 drh Exp $
|
# $Id: subselect.test,v 1.6 2002/06/29 02:20:09 drh Exp $
|
||||||
|
|
||||||
set testdir [file dirname $argv0]
|
set testdir [file dirname $argv0]
|
||||||
source $testdir/tester.tcl
|
source $testdir/tester.tcl
|
||||||
@ -82,4 +82,22 @@ do_test subselect-1.6 {
|
|||||||
execsql {SELECT x FROM t2 ORDER BY x}
|
execsql {SELECT x FROM t2 ORDER BY x}
|
||||||
} {2 3 4}
|
} {2 3 4}
|
||||||
|
|
||||||
|
# Make sure sorting works for SELECTs there used as a scalar expression.
|
||||||
|
#
|
||||||
|
do_test subselect-2.1 {
|
||||||
|
execsql {
|
||||||
|
SELECT (SELECT a FROM t1 ORDER BY a), (SELECT a FROM t1 ORDER BY a DESC)
|
||||||
|
}
|
||||||
|
} {1 5}
|
||||||
|
do_test subselect-2.2 {
|
||||||
|
execsql {
|
||||||
|
SELECT 1 IN (SELECT a FROM t1 ORDER BY a);
|
||||||
|
}
|
||||||
|
} {1}
|
||||||
|
do_test subselect-2.3 {
|
||||||
|
execsql {
|
||||||
|
SELECT 2 IN (SELECT a FROM t1 ORDER BY a DESC);
|
||||||
|
}
|
||||||
|
} {0}
|
||||||
|
|
||||||
finish_test
|
finish_test
|
||||||
|
Reference in New Issue
Block a user