]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Move the build-in function definitions into a new source file "func.c". (CVS 391)
authordrh <drh@noemail.net>
Sun, 24 Feb 2002 01:55:15 +0000 (01:55 +0000)
committerdrh <drh@noemail.net>
Sun, 24 Feb 2002 01:55:15 +0000 (01:55 +0000)
FossilOrigin-Name: 530b0f4f2def89e200b7b0724a5967bf981bd91d

Makefile.in
Makefile.template
manifest
manifest.uuid
src/func.c [new file with mode: 0644]
src/main.c
src/sqliteInt.h

index ce21097db75328010df2fb865e57f3c4595584a5..484fd0aa790b3988cf0ed51d49e7c54d4f9f10b7 100644 (file)
@@ -61,7 +61,7 @@ ENCODING = @ENCODING@
 
 # 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 \
          table.lo tokenize.lo update.lo util.lo vdbe.lo where.lo
 
@@ -73,6 +73,7 @@ SRC = \
   $(TOP)/src/build.c \
   $(TOP)/src/delete.c \
   $(TOP)/src/expr.c \
+  $(TOP)/src/func.c \
   $(TOP)/src/hash.c \
   $(TOP)/src/insert.c \
   $(TOP)/src/main.c \
@@ -192,6 +193,9 @@ delete.lo:  $(TOP)/src/delete.c $(HDR)
 expr.lo:       $(TOP)/src/expr.c $(HDR)
        $(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)
        $(LIBTOOL) $(TCC) -c $(TOP)/src/hash.c
 
index b30014f425959e03fa60e24e1c9fbfb19e6510a5..9f2b5edbd9bfe90eb4acd0a368d60820fc04c20b 100644 (file)
@@ -116,7 +116,7 @@ TCCX = $(TCC) $(OPTS) $(THREADSAFE) $(USLEEP) -I. -I$(TOP)/src
 
 # 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 \
          tokenize.o update.o util.o vdbe.o where.o tclsqlite.o
 
@@ -128,6 +128,7 @@ SRC = \
   $(TOP)/src/build.c \
   $(TOP)/src/delete.c \
   $(TOP)/src/expr.c \
+  $(TOP)/src/func.c \
   $(TOP)/src/hash.c \
   $(TOP)/src/hash.h \
   $(TOP)/src/insert.c \
@@ -259,6 +260,9 @@ delete.o:   $(TOP)/src/delete.c $(HDR)
 expr.o:        $(TOP)/src/expr.c $(HDR)
        $(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)
        $(TCCX) -c $(TOP)/src/hash.c
 
index f0269573f9c05c56a6fdfb932514c532edae421e..74c9d3df2d35b8677343115988c7a5005591a0b7 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,7 +1,7 @@
-C Added\ssupport\sfor\suser-defined\snormal\sfunctions.\s\sSupport\sfor\suser-defined\naggregates\sis\spending.\s(CVS\s390)
-D 2002-02-23T23:45:45
-F Makefile.in 9fa4277413bf1d9cf91365f07d4108d7d87ed2af
-F Makefile.template 3372d45f8853afdb70bd30cc6fb50a3cd9069834
+C Move\sthe\sbuild-in\sfunction\sdefinitions\sinto\sa\snew\ssource\sfile\s"func.c".\s(CVS\s391)
+D 2002-02-24T01:55:16
+F Makefile.in 50f1b3351df109b5774771350d8c1b8d3640130d
+F Makefile.template 89e373b2dad0321df00400fa968dc14b61a03296
 F README a4c0ba11354ef6ba0776b400d057c59da47a4cc0
 F VERSION 80c0f75cf7de338f1c6c31c07f5576d21f764431
 F aclocal.m4 11faa843caa38fd451bc6aeb43e248d1723a269d
@@ -24,10 +24,11 @@ F src/btree.h 8abeabfe6e0b1a990b64fa457592a6482f6674f3
 F src/build.c 1da051784be0155ae579d47890db74f0186f9b9f
 F src/delete.c 950d8f9097361419f1963875f9943344b469cf02
 F src/expr.c 4f9db24c4e90585fd046703d4f91c10b453867fa
+F src/func.c f06739ac3266fe237a8079415c75b4fe27f9b604
 F src/hash.c cc259475e358baaf299b00a2c7370f2b03dda892
 F src/hash.h dca065dda89d4575f3176e75e9a3dc0f4b4fb8b9
 F src/insert.c 164d2d5e943268a8ff0594e1947599e04df0ce11
-F src/main.c 0fa2298ab8980cb446dc81086ce36f905f607f70
+F src/main.c 69ba23401427f18f6eb1e9b92a3bd3236e2e39ad
 F src/md5.c 52f677bfc590e09f71d07d7e327bd59da738d07c
 F src/os.c f6bc9b7ab530346bb7fef2ed39f2f1f214bc14ea
 F src/os.h a17596ecc7f38a228b83ecdb661fb03ce44726d6
@@ -40,7 +41,7 @@ F src/select.c 61d4a739956aaeb124cdf12c34c66e99ae34212c
 F src/shell.c cbf48bf0ca35c4e0d8a7d2a86f7724f52c525cd7
 F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e
 F src/sqlite.h.in f1421919a4437a377fb712b98835a224482e776e
-F src/sqliteInt.h b089e9226fbb88b25810d2f52285929dcf6999c6
+F src/sqliteInt.h 55a15c38dbb2cfcf148b56b51945b50d5d41f254
 F src/table.c 203a09d5d0009eeeb1f670370d52b4ce163a3b52
 F src/tclsqlite.c b9cf346e95291cb4c4f1bf5ac1d77db6b8ad023d
 F src/test1.c 33efd350dca27c52c58c553c04fd3a6a51f13c1f
@@ -125,7 +126,7 @@ F www/speed.tcl 83457b2bf6bb430900bd48ca3dd98264d9a916a5
 F www/sqlite.tcl 8b5884354cb615049aed83039f8dfe1552a44279
 F www/tclsqlite.tcl 829b393d1ab187fd7a5e978631b3429318885c49
 F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
-P 67a135a051e7c96ddbfe85976539b4b8372c7026
-R fa8d1484ff86c96c0829999f970d3d5e
+P c490a1ff951c5d4a2de8e4f8d349189bfaef7f74
+R 0358ce63954d177a9cd11817b7f3c75f
 U drh
-Z f2c150ed8d00dcdf045fbfc7cf498205
+Z 379bf92a060e853d2b3e64f2e8f8e8ad
index 5cdd6e2062832499af9bb1adc795caa45510d448..cc61005f815c93ad47c0f1adf4a15c09b15ceae7 100644 (file)
@@ -1 +1 @@
-c490a1ff951c5d4a2de8e4f8d349189bfaef7f74
\ No newline at end of file
+530b0f4f2def89e200b7b0724a5967bf981bd91d
\ No newline at end of file
diff --git a/src/func.c b/src/func.c
new file mode 100644 (file)
index 0000000..a726c69
--- /dev/null
@@ -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);
+}
index 4253ae12514b7a4867e20507ffc5d21a4fc6d038..3ec2f5dd5036c703dbcd1cbd6bfbc9e83d23a585 100644 (file)
@@ -14,9 +14,8 @@
 ** other files are for internal use by SQLite and should not be
 ** 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 "os.h"
 
@@ -293,30 +292,6 @@ const char sqlite_encoding[] = "UTF-8";
 const char sqlite_encoding[] = "iso8859";
 #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
 ** 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->idxDrop, SQLITE_HASH_POINTER, 0);
   sqliteHashInit(&db->userFunc, SQLITE_HASH_STRING, 1);
-  sqlite_create_function(db, "upper", 1, upperFunc);
-  sqlite_create_function(db, "lower", 1, lowerFunc);
+  sqliteRegisterBuildinFunctions(db);
   db->onError = OE_Default;
   db->priorNewRowid = 0;
   
index 82d7121782326bd9a83e2367fdb72b35989bbabd..b86cf34675e57f3ff9dbbcabc86a2e6e16021775 100644 (file)
@@ -11,7 +11,7 @@
 *************************************************************************
 ** 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 "hash.h"
@@ -646,3 +646,4 @@ void sqliteExprMoveStrings(Expr*, int);
 void sqliteExprListMoveStrings(ExprList*, int);
 void sqliteSelectMoveStrings(Select*, int);
 UserFunc *sqliteFindUserFunction(sqlite*,const char*,int,int,int);
+void sqliteRegisterBuildinFunctions(sqlite*);