-C The\snew\sfunction\scode\spasses\sregression\stests.\s(CVS\s403)
-D 2002-02-28T03:04:48
+C Change\sthe\sIFNULL\sand\sNVL\sfunctions\sto\sCOALESCE.\s\sChange\sMIN\sand\sMAX\sso\sthat\nthey\srequire\sat\sleast\sone\sargument.\s(CVS\s404)
+D 2002-02-28T03:14:18
F Makefile.in 50f1b3351df109b5774771350d8c1b8d3640130d
F Makefile.template 89e373b2dad0321df00400fa968dc14b61a03296
F README a4c0ba11354ef6ba0776b400d057c59da47a4cc0
F src/build.c 7ada2426caba70cb1072ba268bedb694b5018065
F src/delete.c 950d8f9097361419f1963875f9943344b469cf02
F src/expr.c b70bedaffd27ea24c5c2a197a88b07e82dfa4967
-F src/func.c 14ac2dfa1845a9b12bf71557ae3a179d32902abe
+F src/func.c 7169103d1082c24f0e8a71c66e7ac4062f6acc15
F src/hash.c cc259475e358baaf299b00a2c7370f2b03dda892
F src/hash.h dca065dda89d4575f3176e75e9a3dc0f4b4fb8b9
F src/insert.c 164d2d5e943268a8ff0594e1947599e04df0ce11
F test/quick.test 6f023c7a73fc413e6d65b7a1879c79764038dc05
F test/quote.test 286db944717afa9a9bf829dd85e59185c65d5435
F test/rowid.test 4c55943300cddf73dd0f88d40a268cab14c83274
-F test/select1.test 72328eb569399e2075a0ce0d84d67df93f27eef2
+F test/select1.test ec4c20514598ae9b52abbd5e17488c8dbcdc74d1
F test/select2.test ed2c1882857106b85478f54f67000e14966be4c4
F test/select3.test 9469c332250a75a0ef1771fb5da62dc04ec77f18
F test/select4.test 29a2ffb187f3d8b6ca42a0a6b619e9cabe12e228
F www/sqlite.tcl 8b5884354cb615049aed83039f8dfe1552a44279
F www/tclsqlite.tcl 829b393d1ab187fd7a5e978631b3429318885c49
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
-P 6af10cc53acc1ffa60de3f0d5880a6b72815404c
-R a8e13733ee5e31e5e4261dfef2a4a7b4
+P b00cf110b1cc671b7200a5ce8b9e704f660763c9
+R 700a29215d4083019c40f619d0c95fb2
U drh
-Z 2f9159adbbc07ca082acf9822ba9ab2f
+Z b9fbc42617ff7af7970f2ca4a8912d6a
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
** All other code has file scope.
**
-** $Id: func.c,v 1.9 2002/02/28 03:04:48 drh Exp $
+** $Id: func.c,v 1.10 2002/02/28 03:14:18 drh Exp $
*/
#include <ctype.h>
#include <math.h>
}
/*
-** Implementation of the IFNULL() and NVL() functions. (both do the
-** same thing. They return their first argument if it is not NULL or
-** their second argument if the first is NULL.
+** Implementation of the IFNULL(), NVL(), and COALESCE() functions.
+** All three do the same thing. They return the first argument
+** non-NULL argument.
*/
static void ifnullFunc(sqlite_func *context, int argc, const char **argv){
- const char *z;
- assert( argc==2 );
- z = argv[0] ? argv[0] : argv[1];
- sqlite_set_result_string(context, z, -1);
+ int i;
+ for(i=0; i<argc; i++){
+ if( argv[i] ){
+ sqlite_set_result_string(context, argv[i], -1);
+ break;
+ }
+ }
}
/*
int nArg;
void (*xFunc)(sqlite_func*,int,const char**);
} aFuncs[] = {
- { "min", -1, minFunc },
- { "max", -1, maxFunc },
- { "length", 1, lengthFunc },
- { "substr", 3, substrFunc },
- { "abs", 1, absFunc },
- { "round", 1, roundFunc },
- { "round", 2, roundFunc },
- { "upper", 1, upperFunc },
- { "lower", 1, lowerFunc },
- { "ifnull", 2, ifnullFunc },
- { "nvl", 2, ifnullFunc },
+ { "min", -1, minFunc },
+ { "min", 0, 0 },
+ { "max", -1, maxFunc },
+ { "max", 0, 0 },
+ { "length", 1, lengthFunc },
+ { "substr", 3, substrFunc },
+ { "abs", 1, absFunc },
+ { "round", 1, roundFunc },
+ { "round", 2, roundFunc },
+ { "upper", 1, upperFunc },
+ { "lower", 1, lowerFunc },
+ { "coalesce", -1, ifnullFunc },
+ { "coalesce", 0, 0 },
+ { "coalesce", 1, 0 },
+
};
static struct {
char *zName;
# This file implements regression tests for SQLite library. The
# focus of this file is testing the SELECT statement.
#
-# $Id: select1.test,v 1.20 2002/02/28 03:04:48 drh Exp $
+# $Id: select1.test,v 1.21 2002/02/28 03:14:18 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
do_test select1-2.6 {
set v [catch {execsql {SELECT min(*) FROM test1}} msg]
lappend v $msg
-} {0 {{} {}}}
+} {1 {wrong number of arguments to function min()}}
do_test select1-2.7 {
set v [catch {execsql {SELECT Min(f1) FROM test1}} msg]
lappend v $msg
do_test select1-2.9 {
set v [catch {execsql {SELECT MAX(*) FROM test1}} msg]
lappend v $msg
-} {0 {{} {}}}
+} {1 {wrong number of arguments to function MAX()}}
do_test select1-2.10 {
set v [catch {execsql {SELECT Max(f1) FROM test1}} msg]
lappend v $msg