mirror of
https://github.com/sqlite/sqlite.git
synced 2025-10-24 09:53:10 +03:00
Added IFNULL and NVL functions. (CVS 401)
FossilOrigin-Name: c6a85c8ee3d653a294bcc033ac6cab2b6de06f96
This commit is contained in:
12
manifest
12
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Completely\sremove\sthe\sold\sSQL\sfunction\ssystem\sand\sreplace\sit\swith\sthe\nnew\suser\sfunctions.\s\sThe\scode\scurrently\scompiles\sbut\sit\scoredumps\son\sthe\ntest\ssuite.\s\sDo\snot\suse\sin\sits\spresent\sstate.\s(CVS\s400)
|
C Added\sIFNULL\sand\sNVL\sfunctions.\s(CVS\s401)
|
||||||
D 2002-02-28T00:41:10
|
D 2002-02-28T00:46:26
|
||||||
F Makefile.in 50f1b3351df109b5774771350d8c1b8d3640130d
|
F Makefile.in 50f1b3351df109b5774771350d8c1b8d3640130d
|
||||||
F Makefile.template 89e373b2dad0321df00400fa968dc14b61a03296
|
F Makefile.template 89e373b2dad0321df00400fa968dc14b61a03296
|
||||||
F README a4c0ba11354ef6ba0776b400d057c59da47a4cc0
|
F README a4c0ba11354ef6ba0776b400d057c59da47a4cc0
|
||||||
@@ -24,7 +24,7 @@ F src/btree.h 8abeabfe6e0b1a990b64fa457592a6482f6674f3
|
|||||||
F src/build.c 7ada2426caba70cb1072ba268bedb694b5018065
|
F src/build.c 7ada2426caba70cb1072ba268bedb694b5018065
|
||||||
F src/delete.c 950d8f9097361419f1963875f9943344b469cf02
|
F src/delete.c 950d8f9097361419f1963875f9943344b469cf02
|
||||||
F src/expr.c 32a2b5826b892a61e153df0ff5778e01d1ba9ad9
|
F src/expr.c 32a2b5826b892a61e153df0ff5778e01d1ba9ad9
|
||||||
F src/func.c 709784ce09c6156c52cbf860f6bcc7c2349d0b65
|
F src/func.c 7bfb8a2068cc5e8bed64a3eaf8521448e05371cc
|
||||||
F src/hash.c cc259475e358baaf299b00a2c7370f2b03dda892
|
F src/hash.c cc259475e358baaf299b00a2c7370f2b03dda892
|
||||||
F src/hash.h dca065dda89d4575f3176e75e9a3dc0f4b4fb8b9
|
F src/hash.h dca065dda89d4575f3176e75e9a3dc0f4b4fb8b9
|
||||||
F src/insert.c 164d2d5e943268a8ff0594e1947599e04df0ce11
|
F src/insert.c 164d2d5e943268a8ff0594e1947599e04df0ce11
|
||||||
@@ -127,7 +127,7 @@ F www/speed.tcl 83457b2bf6bb430900bd48ca3dd98264d9a916a5
|
|||||||
F www/sqlite.tcl 8b5884354cb615049aed83039f8dfe1552a44279
|
F www/sqlite.tcl 8b5884354cb615049aed83039f8dfe1552a44279
|
||||||
F www/tclsqlite.tcl 829b393d1ab187fd7a5e978631b3429318885c49
|
F www/tclsqlite.tcl 829b393d1ab187fd7a5e978631b3429318885c49
|
||||||
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
|
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
|
||||||
P c4f9e017b449d4036fa8d2bf77b931d4c31d74f7
|
P 50797fee5066ec9ea23b720e5ab7e8fc8ccc1988
|
||||||
R 8c438145064b7ce85d82d8ac4ca5e8e8
|
R ce3267187f04fb6cf19d5ce1ab432374
|
||||||
U drh
|
U drh
|
||||||
Z 324db426e1592b4f7c305e457c298b2e
|
Z b311912d740a382c290a6410e1cb599f
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
50797fee5066ec9ea23b720e5ab7e8fc8ccc1988
|
c6a85c8ee3d653a294bcc033ac6cab2b6de06f96
|
||||||
16
src/func.c
16
src/func.c
@@ -16,7 +16,7 @@
|
|||||||
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
|
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
|
||||||
** All other code has file scope.
|
** All other code has file scope.
|
||||||
**
|
**
|
||||||
** $Id: func.c,v 1.6 2002/02/28 00:41:10 drh Exp $
|
** $Id: func.c,v 1.7 2002/02/28 00:46:26 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
@@ -165,6 +165,18 @@ static void lowerFunc(sqlite_func *context, int argc, const char **argv){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** 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.
|
||||||
|
*/
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** An instance of the following structure holds the context of a
|
** An instance of the following structure holds the context of a
|
||||||
** sum() or avg() aggregate computation.
|
** sum() or avg() aggregate computation.
|
||||||
@@ -350,6 +362,8 @@ void sqliteRegisterBuildinFunctions(sqlite *db){
|
|||||||
{ "round", 2, roundFunc },
|
{ "round", 2, roundFunc },
|
||||||
{ "upper", 1, upperFunc },
|
{ "upper", 1, upperFunc },
|
||||||
{ "lower", 1, lowerFunc },
|
{ "lower", 1, lowerFunc },
|
||||||
|
{ "ifnull", 2, ifnullFunc },
|
||||||
|
{ "nvl", 2, ifnullFunc },
|
||||||
};
|
};
|
||||||
static struct {
|
static struct {
|
||||||
char *zName;
|
char *zName;
|
||||||
|
|||||||
Reference in New Issue
Block a user