mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Move the build-in function definitions into a new source file "func.c". (CVS 391)
FossilOrigin-Name: 530b0f4f2def89e200b7b0724a5967bf981bd91d
This commit is contained in:
@@ -61,7 +61,7 @@ ENCODING = @ENCODING@
|
|||||||
|
|
||||||
# Object files for the SQLite library.
|
# Object files for the SQLite library.
|
||||||
#
|
#
|
||||||
LIBOBJ = btree.lo build.lo delete.lo expr.lo hash.lo insert.lo \
|
LIBOBJ = btree.lo build.lo delete.lo expr.lo func.lo hash.lo insert.lo \
|
||||||
main.lo os.lo pager.lo parse.lo printf.lo random.lo select.lo \
|
main.lo os.lo pager.lo parse.lo printf.lo random.lo select.lo \
|
||||||
table.lo tokenize.lo update.lo util.lo vdbe.lo where.lo
|
table.lo tokenize.lo update.lo util.lo vdbe.lo where.lo
|
||||||
|
|
||||||
@@ -73,6 +73,7 @@ SRC = \
|
|||||||
$(TOP)/src/build.c \
|
$(TOP)/src/build.c \
|
||||||
$(TOP)/src/delete.c \
|
$(TOP)/src/delete.c \
|
||||||
$(TOP)/src/expr.c \
|
$(TOP)/src/expr.c \
|
||||||
|
$(TOP)/src/func.c \
|
||||||
$(TOP)/src/hash.c \
|
$(TOP)/src/hash.c \
|
||||||
$(TOP)/src/insert.c \
|
$(TOP)/src/insert.c \
|
||||||
$(TOP)/src/main.c \
|
$(TOP)/src/main.c \
|
||||||
@@ -192,6 +193,9 @@ delete.lo: $(TOP)/src/delete.c $(HDR)
|
|||||||
expr.lo: $(TOP)/src/expr.c $(HDR)
|
expr.lo: $(TOP)/src/expr.c $(HDR)
|
||||||
$(LIBTOOL) $(TCC) -c $(TOP)/src/expr.c
|
$(LIBTOOL) $(TCC) -c $(TOP)/src/expr.c
|
||||||
|
|
||||||
|
func.lo: $(TOP)/src/func.c $(HDR)
|
||||||
|
$(LIBTOOL) $(TCC) -c $(TOP)/src/func.c
|
||||||
|
|
||||||
hash.lo: $(TOP)/src/hash.c $(HDR)
|
hash.lo: $(TOP)/src/hash.c $(HDR)
|
||||||
$(LIBTOOL) $(TCC) -c $(TOP)/src/hash.c
|
$(LIBTOOL) $(TCC) -c $(TOP)/src/hash.c
|
||||||
|
|
||||||
|
@@ -116,7 +116,7 @@ TCCX = $(TCC) $(OPTS) $(THREADSAFE) $(USLEEP) -I. -I$(TOP)/src
|
|||||||
|
|
||||||
# Object files for the SQLite library.
|
# Object files for the SQLite library.
|
||||||
#
|
#
|
||||||
LIBOBJ = btree.o build.o delete.o expr.o hash.o insert.o \
|
LIBOBJ = btree.o build.o delete.o expr.o func.o hash.o insert.o \
|
||||||
main.o os.o pager.o parse.o printf.o random.o select.o table.o \
|
main.o os.o pager.o parse.o printf.o random.o select.o table.o \
|
||||||
tokenize.o update.o util.o vdbe.o where.o tclsqlite.o
|
tokenize.o update.o util.o vdbe.o where.o tclsqlite.o
|
||||||
|
|
||||||
@@ -128,6 +128,7 @@ SRC = \
|
|||||||
$(TOP)/src/build.c \
|
$(TOP)/src/build.c \
|
||||||
$(TOP)/src/delete.c \
|
$(TOP)/src/delete.c \
|
||||||
$(TOP)/src/expr.c \
|
$(TOP)/src/expr.c \
|
||||||
|
$(TOP)/src/func.c \
|
||||||
$(TOP)/src/hash.c \
|
$(TOP)/src/hash.c \
|
||||||
$(TOP)/src/hash.h \
|
$(TOP)/src/hash.h \
|
||||||
$(TOP)/src/insert.c \
|
$(TOP)/src/insert.c \
|
||||||
@@ -259,6 +260,9 @@ delete.o: $(TOP)/src/delete.c $(HDR)
|
|||||||
expr.o: $(TOP)/src/expr.c $(HDR)
|
expr.o: $(TOP)/src/expr.c $(HDR)
|
||||||
$(TCCX) -c $(TOP)/src/expr.c
|
$(TCCX) -c $(TOP)/src/expr.c
|
||||||
|
|
||||||
|
func.o: $(TOP)/src/func.c $(HDR)
|
||||||
|
$(TCCX) -c $(TOP)/src/func.c
|
||||||
|
|
||||||
hash.o: $(TOP)/src/hash.c $(HDR)
|
hash.o: $(TOP)/src/hash.c $(HDR)
|
||||||
$(TCCX) -c $(TOP)/src/hash.c
|
$(TCCX) -c $(TOP)/src/hash.c
|
||||||
|
|
||||||
|
19
manifest
19
manifest
@@ -1,7 +1,7 @@
|
|||||||
C Added\ssupport\sfor\suser-defined\snormal\sfunctions.\s\sSupport\sfor\suser-defined\naggregates\sis\spending.\s(CVS\s390)
|
C Move\sthe\sbuild-in\sfunction\sdefinitions\sinto\sa\snew\ssource\sfile\s"func.c".\s(CVS\s391)
|
||||||
D 2002-02-23T23:45:45
|
D 2002-02-24T01:55:16
|
||||||
F Makefile.in 9fa4277413bf1d9cf91365f07d4108d7d87ed2af
|
F Makefile.in 50f1b3351df109b5774771350d8c1b8d3640130d
|
||||||
F Makefile.template 3372d45f8853afdb70bd30cc6fb50a3cd9069834
|
F Makefile.template 89e373b2dad0321df00400fa968dc14b61a03296
|
||||||
F README a4c0ba11354ef6ba0776b400d057c59da47a4cc0
|
F README a4c0ba11354ef6ba0776b400d057c59da47a4cc0
|
||||||
F VERSION 80c0f75cf7de338f1c6c31c07f5576d21f764431
|
F VERSION 80c0f75cf7de338f1c6c31c07f5576d21f764431
|
||||||
F aclocal.m4 11faa843caa38fd451bc6aeb43e248d1723a269d
|
F aclocal.m4 11faa843caa38fd451bc6aeb43e248d1723a269d
|
||||||
@@ -24,10 +24,11 @@ F src/btree.h 8abeabfe6e0b1a990b64fa457592a6482f6674f3
|
|||||||
F src/build.c 1da051784be0155ae579d47890db74f0186f9b9f
|
F src/build.c 1da051784be0155ae579d47890db74f0186f9b9f
|
||||||
F src/delete.c 950d8f9097361419f1963875f9943344b469cf02
|
F src/delete.c 950d8f9097361419f1963875f9943344b469cf02
|
||||||
F src/expr.c 4f9db24c4e90585fd046703d4f91c10b453867fa
|
F src/expr.c 4f9db24c4e90585fd046703d4f91c10b453867fa
|
||||||
|
F src/func.c f06739ac3266fe237a8079415c75b4fe27f9b604
|
||||||
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
|
||||||
F src/main.c 0fa2298ab8980cb446dc81086ce36f905f607f70
|
F src/main.c 69ba23401427f18f6eb1e9b92a3bd3236e2e39ad
|
||||||
F src/md5.c 52f677bfc590e09f71d07d7e327bd59da738d07c
|
F src/md5.c 52f677bfc590e09f71d07d7e327bd59da738d07c
|
||||||
F src/os.c f6bc9b7ab530346bb7fef2ed39f2f1f214bc14ea
|
F src/os.c f6bc9b7ab530346bb7fef2ed39f2f1f214bc14ea
|
||||||
F src/os.h a17596ecc7f38a228b83ecdb661fb03ce44726d6
|
F src/os.h a17596ecc7f38a228b83ecdb661fb03ce44726d6
|
||||||
@@ -40,7 +41,7 @@ F src/select.c 61d4a739956aaeb124cdf12c34c66e99ae34212c
|
|||||||
F src/shell.c cbf48bf0ca35c4e0d8a7d2a86f7724f52c525cd7
|
F src/shell.c cbf48bf0ca35c4e0d8a7d2a86f7724f52c525cd7
|
||||||
F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e
|
F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e
|
||||||
F src/sqlite.h.in f1421919a4437a377fb712b98835a224482e776e
|
F src/sqlite.h.in f1421919a4437a377fb712b98835a224482e776e
|
||||||
F src/sqliteInt.h b089e9226fbb88b25810d2f52285929dcf6999c6
|
F src/sqliteInt.h 55a15c38dbb2cfcf148b56b51945b50d5d41f254
|
||||||
F src/table.c 203a09d5d0009eeeb1f670370d52b4ce163a3b52
|
F src/table.c 203a09d5d0009eeeb1f670370d52b4ce163a3b52
|
||||||
F src/tclsqlite.c b9cf346e95291cb4c4f1bf5ac1d77db6b8ad023d
|
F src/tclsqlite.c b9cf346e95291cb4c4f1bf5ac1d77db6b8ad023d
|
||||||
F src/test1.c 33efd350dca27c52c58c553c04fd3a6a51f13c1f
|
F src/test1.c 33efd350dca27c52c58c553c04fd3a6a51f13c1f
|
||||||
@@ -125,7 +126,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 67a135a051e7c96ddbfe85976539b4b8372c7026
|
P c490a1ff951c5d4a2de8e4f8d349189bfaef7f74
|
||||||
R fa8d1484ff86c96c0829999f970d3d5e
|
R 0358ce63954d177a9cd11817b7f3c75f
|
||||||
U drh
|
U drh
|
||||||
Z f2c150ed8d00dcdf045fbfc7cf498205
|
Z 379bf92a060e853d2b3e64f2e8f8e8ad
|
||||||
|
@@ -1 +1 @@
|
|||||||
c490a1ff951c5d4a2de8e4f8d349189bfaef7f74
|
530b0f4f2def89e200b7b0724a5967bf981bd91d
|
55
src/func.c
Normal file
55
src/func.c
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
** 2002 February 23
|
||||||
|
**
|
||||||
|
** The author disclaims copyright to this source code. In place of
|
||||||
|
** a legal notice, here is a blessing:
|
||||||
|
**
|
||||||
|
** May you do good and not evil.
|
||||||
|
** May you find forgiveness for yourself and forgive others.
|
||||||
|
** May you share freely, never taking more than you give.
|
||||||
|
**
|
||||||
|
*************************************************************************
|
||||||
|
** This file contains the C functions that implement various SQL
|
||||||
|
** functions of SQLite.
|
||||||
|
**
|
||||||
|
** There is only one exported symbol in this file - the function
|
||||||
|
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
|
||||||
|
** All other code has file scope.
|
||||||
|
**
|
||||||
|
** $Id: func.c,v 1.1 2002/02/24 01:55:17 drh Exp $
|
||||||
|
*/
|
||||||
|
#include <ctype.h>
|
||||||
|
#include "sqlite.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Implementation of the upper() and lower() SQL functions.
|
||||||
|
*/
|
||||||
|
static void upperFunc(void *context, int argc, const char **argv){
|
||||||
|
char *z;
|
||||||
|
int i;
|
||||||
|
if( argc<1 || argv[0]==0 ) return;
|
||||||
|
z = sqlite_set_result_string(context, argv[0], -1);
|
||||||
|
if( z==0 ) return;
|
||||||
|
for(i=0; z[i]; i++){
|
||||||
|
if( islower(z[i]) ) z[i] = toupper(z[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void lowerFunc(void *context, int argc, const char **argv){
|
||||||
|
char *z;
|
||||||
|
int i;
|
||||||
|
if( argc<1 || argv[0]==0 ) return;
|
||||||
|
z = sqlite_set_result_string(context, argv[0], -1);
|
||||||
|
if( z==0 ) return;
|
||||||
|
for(i=0; z[i]; i++){
|
||||||
|
if( isupper(z[i]) ) z[i] = tolower(z[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** This file registered all of the above C functions as SQL
|
||||||
|
** functions.
|
||||||
|
*/
|
||||||
|
void sqliteRegisterBuildinFunctions(sqlite *db){
|
||||||
|
sqlite_create_function(db, "upper", 1, upperFunc);
|
||||||
|
sqlite_create_function(db, "lower", 1, lowerFunc);
|
||||||
|
}
|
30
src/main.c
30
src/main.c
@@ -14,9 +14,8 @@
|
|||||||
** other files are for internal use by SQLite and should not be
|
** other files are for internal use by SQLite and should not be
|
||||||
** accessed by users of the library.
|
** accessed by users of the library.
|
||||||
**
|
**
|
||||||
** $Id: main.c,v 1.62 2002/02/23 23:45:45 drh Exp $
|
** $Id: main.c,v 1.63 2002/02/24 01:55:17 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include <ctype.h>
|
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
|
|
||||||
@@ -293,30 +292,6 @@ const char sqlite_encoding[] = "UTF-8";
|
|||||||
const char sqlite_encoding[] = "iso8859";
|
const char sqlite_encoding[] = "iso8859";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
** Implementation of the upper() and lower() SQL functions.
|
|
||||||
*/
|
|
||||||
static void upperFunc(void *context, int argc, const char **argv){
|
|
||||||
char *z;
|
|
||||||
int i;
|
|
||||||
if( argc<1 || argv[0]==0 ) return;
|
|
||||||
z = sqlite_set_result_string(context, argv[0], -1);
|
|
||||||
if( z==0 ) return;
|
|
||||||
for(i=0; z[i]; i++){
|
|
||||||
if( islower(z[i]) ) z[i] = toupper(z[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
static void lowerFunc(void *context, int argc, const char **argv){
|
|
||||||
char *z;
|
|
||||||
int i;
|
|
||||||
if( argc<1 || argv[0]==0 ) return;
|
|
||||||
z = sqlite_set_result_string(context, argv[0], -1);
|
|
||||||
if( z==0 ) return;
|
|
||||||
for(i=0; z[i]; i++){
|
|
||||||
if( isupper(z[i]) ) z[i] = tolower(z[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Open a new SQLite database. Construct an "sqlite" structure to define
|
** Open a new SQLite database. Construct an "sqlite" structure to define
|
||||||
** the state of this database and return a pointer to that structure.
|
** the state of this database and return a pointer to that structure.
|
||||||
@@ -339,8 +314,7 @@ sqlite *sqlite_open(const char *zFilename, int mode, char **pzErrMsg){
|
|||||||
sqliteHashInit(&db->tblDrop, SQLITE_HASH_POINTER, 0);
|
sqliteHashInit(&db->tblDrop, SQLITE_HASH_POINTER, 0);
|
||||||
sqliteHashInit(&db->idxDrop, SQLITE_HASH_POINTER, 0);
|
sqliteHashInit(&db->idxDrop, SQLITE_HASH_POINTER, 0);
|
||||||
sqliteHashInit(&db->userFunc, SQLITE_HASH_STRING, 1);
|
sqliteHashInit(&db->userFunc, SQLITE_HASH_STRING, 1);
|
||||||
sqlite_create_function(db, "upper", 1, upperFunc);
|
sqliteRegisterBuildinFunctions(db);
|
||||||
sqlite_create_function(db, "lower", 1, lowerFunc);
|
|
||||||
db->onError = OE_Default;
|
db->onError = OE_Default;
|
||||||
db->priorNewRowid = 0;
|
db->priorNewRowid = 0;
|
||||||
|
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
*************************************************************************
|
*************************************************************************
|
||||||
** Internal interface definitions for SQLite.
|
** Internal interface definitions for SQLite.
|
||||||
**
|
**
|
||||||
** @(#) $Id: sqliteInt.h,v 1.91 2002/02/23 23:45:45 drh Exp $
|
** @(#) $Id: sqliteInt.h,v 1.92 2002/02/24 01:55:17 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqlite.h"
|
#include "sqlite.h"
|
||||||
#include "hash.h"
|
#include "hash.h"
|
||||||
@@ -646,3 +646,4 @@ void sqliteExprMoveStrings(Expr*, int);
|
|||||||
void sqliteExprListMoveStrings(ExprList*, int);
|
void sqliteExprListMoveStrings(ExprList*, int);
|
||||||
void sqliteSelectMoveStrings(Select*, int);
|
void sqliteSelectMoveStrings(Select*, int);
|
||||||
UserFunc *sqliteFindUserFunction(sqlite*,const char*,int,int,int);
|
UserFunc *sqliteFindUserFunction(sqlite*,const char*,int,int,int);
|
||||||
|
void sqliteRegisterBuildinFunctions(sqlite*);
|
||||||
|
Reference in New Issue
Block a user