-C Remove\sreferences\sto\sOP_MoveTo\sin\scomments\sof\svdbe.c\s-\sthat\sopcode\sno\nlonger\sexists.\s\sTicket\s#3327.\s(CVS\s5584)
-D 2008-08-21T19:28:30
+C Move\sdate+time\sfunctions\sto\sstart-time\sinitialization.\s\sAdditional\nstart-time\sfunction\scleanup.\s(CVS\s5585)
+D 2008-08-21T20:21:35
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 51b727303f84cf055e29514d8248e5eaf9701379
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/btree.h 6371c5e599fab391a150c96afbc10062b276d107
F src/btreeInt.h ab18c7b4980314e9e4b402e5dcde09f3c2545576
F src/build.c 160c71acca8f643f436ed6c1ee2f684c88df4dfe
-F src/callback.c 26f18b3cb5e44120390a8d2d97907889feb47bc5
+F src/callback.c 27e55dfafc66e97dd8e7343a1d7bb295f3afd736
F src/complete.c cb14e06dbe79dee031031f0d9e686ff306afe07c
-F src/date.c 52a54811218a76da6235420f532ece841159a96d
+F src/date.c 2373f20a91bec70e20e0e715520c8010d26ebb52
F src/delete.c 5105c67c741f934379722de5e11fdd73ea4d82b5
F src/expr.c 4651d08422474f7e4bcb9a35da00c33ebe719a2d
F src/fault.c 3638519d1e0b82bccfafcb9f5ff491918b28f8e1
-F src/func.c f52c6d1b5d08b94ea348059e1bd067580490dd60
-F src/global.c 39350827d0bce0fe10cca8b13c5dfca3438b4f65
+F src/func.c f2e0b55f13e678a5c5ff94f0f225ed0a995acba7
+F src/global.c 239d03b6dbae6c985deb2ffb54ab919debb9f8d7
F src/hash.c eb64e48f3781100e5934f759fbe72a63a8fe78cb
F src/hash.h 031cd9f915aff27e12262cb9eb570ac1b8326b53
F src/hwtime.h 4a1d45f4cae1f402ea19686acf24acf4f0cb53cb
F src/journal.c cffd2cd214e58c0e99c3ff632b3bee6c7cbb260e
F src/legacy.c aac57bd984e666059011ea01ec4383892a253be3
F src/loadext.c eb1fe4f44d7c8ff53fc0c6a4388ab79fbd34cd64
-F src/main.c 2513e9bb233a8ebc4aaa766a37528ef255cde7fb
+F src/main.c 69dbacc8c605f19dd380b2eda8c947a2aac19671
F src/malloc.c 7ccc630b359f57a47b6034af54e42eb838eebd46
F src/md5.c 008216bbb5d34c6fbab5357aa68575ad8a31516a
F src/mem1.c 3a7fe31d8290baa3bb203af72f7dfd6323966bcd
F src/pager.c 3a4358c72c9c8415e8648001c776857e6952e2b4
F src/pager.h 3778bea71dfb9658b6c94394e18db4a5b27e6ded
F src/parse.y d0f76d2cb8d6883d5600dc20beb961a6022b94b8
-F src/pcache.c 4668410008dda89ff5f0eb62b887cfb5e13903eb
-F src/pcache.h aef1dedd7ff6186f27052a2509fff437a8906977
+F src/pcache.c f57227003d39d40fa7f9b5a86e36b99f74b93267
+F src/pcache.h d2becbe7255f6bf57fc9e0bf889a9ec73d50ee74
F src/pragma.c f5b271b090af7fcedd308d7c5807a5503f7a853d
F src/prepare.c c197041e0c4770672cda75e6bfe10242f885e510
F src/printf.c 2e984b2507291a7e16d89dc9bb60582904f6247d
F src/shell.c d83b578a8ccdd3e0e7fef4388a0887ce9f810967
F src/sqlite.h.in 54e51c22e2294c5989156b0aec87aa44168ac1f0
F src/sqlite3ext.h 1e3887c9bd3ae66cb599e922824b04cd0d0f2c3e
-F src/sqliteInt.h 15096ac72b783de470c7f89888560e2ddaa83898
+F src/sqliteInt.h ddf6c9eb90b295bcb7c600139227e5e2a16c8063
F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8
F src/status.c 8caa772cd9310bc297280f7cf0ede4d69ed5b801
F src/table.c 22744786199c9195720c15a7a42cb97b2e2728d8
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P ef6936e50adb9ebea39c890167403fff01bbb5ed
-R 93e8a5c8f5b8731f0168db8793678abe
+P 30077ece459b515338723ca0dab11c18b9f09d21
+R e5f18970c2a651995955578eea70a847
U drh
-Z fc276d4f825ababf0c32faa8e25a17cd
+Z 9729df78d7652ca44708388f5fcbb37d
-30077ece459b515338723ca0dab11c18b9f09d21
\ No newline at end of file
+80d6a31cb3851704c09ac9d99fe4bc241df3c180
\ No newline at end of file
** This file contains functions used to access the internal hash tables
** of user defined functions and collation sequences.
**
-** $Id: callback.c,v 1.28 2008/08/21 18:49:28 drh Exp $
+** $Id: callback.c,v 1.29 2008/08/21 20:21:35 drh Exp $
*/
#include "sqliteInt.h"
** function to use.
*/
if( !createFlag && !pBest ){
- p = functionSearch(&sqlite3FuncBuiltins, h, zName, nName);
+ p = functionSearch(&sqlite3GlobalFunctions, h, zName, nName);
while( p ){
int score = matchQuality(p, nArg, enc);
if( score>bestScore ){
** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
** All other code has file scope.
**
-** $Id: date.c,v 1.87 2008/07/28 19:34:53 drh Exp $
+** $Id: date.c,v 1.88 2008/08/21 20:21:35 drh Exp $
**
** SQLite processes all times and dates as Julian Day numbers. The
** dates and times are stored as the number of days since noon
** functions. This should be the only routine in this file with
** external linkage.
*/
-void sqlite3RegisterDateTimeFunctions(sqlite3 *db){
+void sqlite3RegisterDateTimeFunctions(void){
+ static FuncDef aDateTimeFuncs[] = {
#ifndef SQLITE_OMIT_DATETIME_FUNCS
- static const struct {
- char *zName;
- int nArg;
- void (*xFunc)(sqlite3_context*,int,sqlite3_value**);
- } aFuncs[] = {
- { "julianday", -1, juliandayFunc },
- { "date", -1, dateFunc },
- { "time", -1, timeFunc },
- { "datetime", -1, datetimeFunc },
- { "strftime", -1, strftimeFunc },
- { "current_time", 0, ctimeFunc },
- { "current_timestamp", 0, ctimestampFunc },
- { "current_date", 0, cdateFunc },
- };
- int i;
-
- for(i=0; i<sizeof(aFuncs)/sizeof(aFuncs[0]); i++){
- sqlite3CreateFunc(db, aFuncs[i].zName, aFuncs[i].nArg,
- SQLITE_UTF8, 0, aFuncs[i].xFunc, 0, 0);
- }
+ FUNCTION(julianday, -1, 0, 0, juliandayFunc ),
+ FUNCTION(date, -1, 0, 0, dateFunc ),
+ FUNCTION(time, -1, 0, 0, timeFunc ),
+ FUNCTION(datetime, -1, 0, 0, datetimeFunc ),
+ FUNCTION(strftime, -1, 0, 0, strftimeFunc ),
+ FUNCTION(current_time, 0, 0, 0, ctimeFunc ),
+ FUNCTION(current_timestamp, 0, 0, 0, ctimestampFunc),
+ FUNCTION(current_date, 0, 0, 0, cdateFunc ),
#else
- static const struct {
- char *zName;
- char *zFormat;
- } aFuncs[] = {
- { "current_time", "%H:%M:%S" },
- { "current_date", "%Y-%m-%d" },
- { "current_timestamp", "%Y-%m-%d %H:%M:%S" }
+ FUNCTION(current_time, 0, "%H:%M:%S", 0, currentTimeFunc),
+ FUNCTION(current_timestamp, 0, "%Y-%m-%d", 0, currentTimeFunc),
+ FUNCTION(current_date, 0, "%Y-%m-%d %H:%M:%S", 0, currentTimeFunc),
+#endif
};
int i;
- for(i=0; i<sizeof(aFuncs)/sizeof(aFuncs[0]); i++){
- sqlite3CreateFunc(db, aFuncs[i].zName, 0, SQLITE_UTF8,
- aFuncs[i].zFormat, currentTimeFunc, 0, 0);
+ for(i=0; i<ArraySize(aDateTimeFuncs); i++){
+ sqlite3FuncDefInsert(&sqlite3GlobalFunctions, &aDateTimeFuncs[i]);
}
-#endif
}
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
** All other code has file scope.
**
-** $Id: func.c,v 1.198 2008/08/21 18:49:28 drh Exp $
+** $Id: func.c,v 1.199 2008/08/21 20:21:35 drh Exp $
*/
-
-#ifndef CREATE_BUILTIN_HASHTABLE
-
#include "sqliteInt.h"
#include <ctype.h>
#include <stdlib.h>
#ifndef SQLITE_OMIT_PARSER
sqlite3AttachFunctions(db);
#endif
- sqlite3RegisterDateTimeFunctions(db);
if( !db->mallocFailed ){
int rc = sqlite3_overload_function(db, "MATCH", 2);
assert( rc==SQLITE_NOMEM || rc==SQLITE_OK );
}
/*
-** The following three macros, FUNCTION(), LIKEFUNC() and AGGREGATE() are
-** used to create the literal values used for the FuncDef structures in
-** the global aBuiltinFunc[] array (see below).
-**
-** FUNCTION(zName, nArg, iArg, bNC, xFunc)
-** Used to create a scalar function definition of a function zName
-** implemented by C function xFunc that accepts nArg arguments. The
-** value passed as iArg is cast to a (void*) and made available
-** as the user-data (sqlite3_user_data()) for the function. If
-** argument bNC is true, then the FuncDef.needCollate flag is set.
-**
-** AGGREGATE(zName, nArg, iArg, bNC, xStep, xFinal)
-** Used to create an aggregate function definition implemented by
-** the C functions xStep and xFinal. The first four parameters
-** are interpreted in the same way as the first 4 parameters to
-** FUNCTION().
+** The following array holds FuncDef structures for all of the functions
+** defined in this file.
**
-** LIKEFUNC(zName, nArg, pArg, flags)
-** Used to create a scalar function definition of a function zName
-** that accepts nArg arguments and is implemented by a call to C
-** function likeFunc. Argument pArg is cast to a (void *) and made
-** available as the function user-data (sqlite3_user_data()). The
-** FuncDef.flags variable is set to the value passed as the flags
-** parameter.
-**
-** See below for examples.
-*/
-#define FUNCTION(zName, nArg, iArg, bNC, xFunc) \
- {nArg, SQLITE_UTF8, bNC, 0, SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, #zName}
-
-#define LIKEFUNC(zName, nArg, arg, flags) \
- {nArg, SQLITE_UTF8, 0, flags, (void *)arg, 0, likeFunc, 0, 0, #zName}
-
-#define AGGREGATE(zName, nArg, arg, nc, xStep, xFinal) \
- {nArg, SQLITE_UTF8, nc, 0, SQLITE_INT_TO_PTR(arg), 0, 0, xStep,xFinal, #zName}
-
-#endif
-
-/*
-** This array of FuncDef structures contains most of the "built-in" functions
-** and aggregates. Function users (the other routines in the SQL compiler)
-** call the following function to access the FuncDef structures stored in
-** this array:
-**
-** int sqlite3GetBuiltinFunction(const char *z, int n, FuncDef **paFunc);
-**
-** The caller passes the name of the required function and its length
-** in parameters z and n, respectively. The value returned is the number
-** of FuncDef structures found in the aBuiltinFunc[] array that match
-** the requested name. If no match is found, 0 is returned. *paFunc is
-** set to point at a static array containing that subset of aBuiltinFunc[]
-** before returning.
-**
-** The implementation of sqlite3GetBuiltinFunction() is generated by
-** the program found in tool/mkfunction.c, which is compiled and executed
-** as part of the build process. The routine generated by this program
-** assumes that if there are two or more entries in the aBuiltinFunc[]
-** array with the same name (i.e. two versions of the "max" function),
-** then they must be stored in adjacent slots.
+** The array cannot be constant since changes are made to the
+** FuncDef.pHash elements at start-time. The elements of this array
+** are read-only after initialization is complete.
*/
static FuncDef aBuiltinFunc[] = {
FUNCTION(ltrim, 1, 1, 0, trimFunc ),
};
/*
-** Build up the global built-in function table at initialization
-** time.
+** All all of the FuncDef structures in the aBuiltinFunc[] array above
+** to the global function hash table. This occurs at start-time (as
+** a consequence of calling sqlite3_initialize()).
+**
+** After this routine runs
*/
void sqlite3RegisterGlobalFunctions(void){
int i;
for(i=0; i<ArraySize(aBuiltinFunc); i++){
- sqlite3FuncDefInsert(&sqlite3FuncBuiltins, &aBuiltinFunc[i]);
+ sqlite3FuncDefInsert(&sqlite3GlobalFunctions, &aBuiltinFunc[i]);
}
+ sqlite3RegisterDateTimeFunctions();
}
**
** This file contains definitions of global variables and contants.
**
-** $Id: global.c,v 1.5 2008/08/21 18:49:28 drh Exp $
+** $Id: global.c,v 1.6 2008/08/21 20:21:35 drh Exp $
*/
#include "sqliteInt.h"
** database connections. After initialization, this table is
** read-only.
*/
-FuncDefHash sqlite3FuncBuiltins;
+FuncDefHash sqlite3GlobalFunctions;
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
-** $Id: main.c,v 1.492 2008/08/21 18:49:28 drh Exp $
+** $Id: main.c,v 1.493 2008/08/21 20:21:35 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
sqlite3_mutex_enter(sqlite3Config.pInitMutex);
if( sqlite3Config.isInit==0 && inProgress==0 ){
inProgress = 1;
- memset(&sqlite3FuncBuiltins, 0, sizeof(sqlite3FuncBuiltins));
+ memset(&sqlite3GlobalFunctions, 0, sizeof(sqlite3GlobalFunctions));
sqlite3RegisterGlobalFunctions();
rc = sqlite3_os_init();
if( rc==SQLITE_OK ){
*************************************************************************
** This file implements that page cache.
**
-** @(#) $Id: pcache.c,v 1.6 2008/08/21 15:54:01 danielk1977 Exp $
+** @(#) $Id: pcache.c,v 1.7 2008/08/21 20:21:35 drh Exp $
*/
#include "sqliteInt.h"
return nFree;
}
#endif /* SQLITE_ENABLE_MEMORY_MANAGEMENT */
-
** This header file defines the interface that the sqlite page cache
** subsystem.
**
-** @(#) $Id: pcache.h,v 1.2 2008/08/21 12:19:44 danielk1977 Exp $
+** @(#) $Id: pcache.h,v 1.3 2008/08/21 20:21:35 drh Exp $
*/
#ifndef _PCACHE_H_
int sqlite3PcacheReleaseMemory(int);
#endif /* _PCACHE_H_ */
-
*************************************************************************
** Internal interface definitions for SQLite.
**
-** @(#) $Id: sqliteInt.h,v 1.758 2008/08/21 18:49:28 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.759 2008/08/21 20:21:35 drh Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_
#define SQLITE_FUNC_CASE 0x02 /* Case-sensitive LIKE-type function */
#define SQLITE_FUNC_EPHEM 0x04 /* Ephermeral. Delete with VDBE */
+/*
+** The following three macros, FUNCTION(), LIKEFUNC() and AGGREGATE() are
+** used to create the initializers for the FuncDef structures.
+**
+** FUNCTION(zName, nArg, iArg, bNC, xFunc)
+** Used to create a scalar function definition of a function zName
+** implemented by C function xFunc that accepts nArg arguments. The
+** value passed as iArg is cast to a (void*) and made available
+** as the user-data (sqlite3_user_data()) for the function. If
+** argument bNC is true, then the FuncDef.needCollate flag is set.
+**
+** AGGREGATE(zName, nArg, iArg, bNC, xStep, xFinal)
+** Used to create an aggregate function definition implemented by
+** the C functions xStep and xFinal. The first four parameters
+** are interpreted in the same way as the first 4 parameters to
+** FUNCTION().
+**
+** LIKEFUNC(zName, nArg, pArg, flags)
+** Used to create a scalar function definition of a function zName
+** that accepts nArg arguments and is implemented by a call to C
+** function likeFunc. Argument pArg is cast to a (void *) and made
+** available as the function user-data (sqlite3_user_data()). The
+** FuncDef.flags variable is set to the value passed as the flags
+** parameter.
+*/
+#define FUNCTION(zName, nArg, iArg, bNC, xFunc) \
+ {nArg, SQLITE_UTF8, bNC, 0, SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, #zName}
+#define LIKEFUNC(zName, nArg, arg, flags) \
+ {nArg, SQLITE_UTF8, 0, flags, (void *)arg, 0, likeFunc, 0, 0, #zName}
+#define AGGREGATE(zName, nArg, arg, nc, xStep, xFinal) \
+ {nArg, SQLITE_UTF8, nc, 0, SQLITE_INT_TO_PTR(arg), 0, 0, xStep,xFinal, #zName}
+
+
/*
** Each SQLite module (virtual table definition) is defined by an
** instance of the following structure, stored in the sqlite3.aModule
void sqlite3FuncDefInsert(FuncDefHash*, FuncDef*);
FuncDef *sqlite3FindFunction(sqlite3*,const char*,int,int,u8,int);
void sqlite3RegisterBuiltinFunctions(sqlite3*);
-void sqlite3RegisterDateTimeFunctions(sqlite3*);
+void sqlite3RegisterDateTimeFunctions(void);
void sqlite3RegisterGlobalFunctions(void);
int sqlite3GetBuiltinFunction(const char *, int, FuncDef **);
#ifdef SQLITE_DEBUG
#ifndef SQLITE_AMALGAMATION
extern const unsigned char sqlite3UpperToLower[];
extern struct Sqlite3Config sqlite3Config;
-extern FuncDefHash sqlite3FuncBuiltins;
+extern FuncDefHash sqlite3GlobalFunctions;
#endif
void sqlite3RootPageMoved(Db*, int, int);
void sqlite3Reindex(Parse*, Token*, Token*);