mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Move date+time functions to start-time initialization. Additional
start-time function cleanup. (CVS 5585) FossilOrigin-Name: 80d6a31cb3851704c09ac9d99fe4bc241df3c180
This commit is contained in:
26
manifest
26
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Remove\sreferences\sto\sOP_MoveTo\sin\scomments\sof\svdbe.c\s-\sthat\sopcode\sno\nlonger\sexists.\s\sTicket\s#3327.\s(CVS\s5584)
|
C Move\sdate+time\sfunctions\sto\sstart-time\sinitialization.\s\sAdditional\nstart-time\sfunction\scleanup.\s(CVS\s5585)
|
||||||
D 2008-08-21T19:28:30
|
D 2008-08-21T20:21:35
|
||||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
||||||
F Makefile.in 51b727303f84cf055e29514d8248e5eaf9701379
|
F Makefile.in 51b727303f84cf055e29514d8248e5eaf9701379
|
||||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||||
@@ -100,14 +100,14 @@ F src/btree.c 3078f7a5c7cde1e74d884dfa57410125d21586fb
|
|||||||
F src/btree.h 6371c5e599fab391a150c96afbc10062b276d107
|
F src/btree.h 6371c5e599fab391a150c96afbc10062b276d107
|
||||||
F src/btreeInt.h ab18c7b4980314e9e4b402e5dcde09f3c2545576
|
F src/btreeInt.h ab18c7b4980314e9e4b402e5dcde09f3c2545576
|
||||||
F src/build.c 160c71acca8f643f436ed6c1ee2f684c88df4dfe
|
F src/build.c 160c71acca8f643f436ed6c1ee2f684c88df4dfe
|
||||||
F src/callback.c 26f18b3cb5e44120390a8d2d97907889feb47bc5
|
F src/callback.c 27e55dfafc66e97dd8e7343a1d7bb295f3afd736
|
||||||
F src/complete.c cb14e06dbe79dee031031f0d9e686ff306afe07c
|
F src/complete.c cb14e06dbe79dee031031f0d9e686ff306afe07c
|
||||||
F src/date.c 52a54811218a76da6235420f532ece841159a96d
|
F src/date.c 2373f20a91bec70e20e0e715520c8010d26ebb52
|
||||||
F src/delete.c 5105c67c741f934379722de5e11fdd73ea4d82b5
|
F src/delete.c 5105c67c741f934379722de5e11fdd73ea4d82b5
|
||||||
F src/expr.c 4651d08422474f7e4bcb9a35da00c33ebe719a2d
|
F src/expr.c 4651d08422474f7e4bcb9a35da00c33ebe719a2d
|
||||||
F src/fault.c 3638519d1e0b82bccfafcb9f5ff491918b28f8e1
|
F src/fault.c 3638519d1e0b82bccfafcb9f5ff491918b28f8e1
|
||||||
F src/func.c f52c6d1b5d08b94ea348059e1bd067580490dd60
|
F src/func.c f2e0b55f13e678a5c5ff94f0f225ed0a995acba7
|
||||||
F src/global.c 39350827d0bce0fe10cca8b13c5dfca3438b4f65
|
F src/global.c 239d03b6dbae6c985deb2ffb54ab919debb9f8d7
|
||||||
F src/hash.c eb64e48f3781100e5934f759fbe72a63a8fe78cb
|
F src/hash.c eb64e48f3781100e5934f759fbe72a63a8fe78cb
|
||||||
F src/hash.h 031cd9f915aff27e12262cb9eb570ac1b8326b53
|
F src/hash.h 031cd9f915aff27e12262cb9eb570ac1b8326b53
|
||||||
F src/hwtime.h 4a1d45f4cae1f402ea19686acf24acf4f0cb53cb
|
F src/hwtime.h 4a1d45f4cae1f402ea19686acf24acf4f0cb53cb
|
||||||
@@ -115,7 +115,7 @@ F src/insert.c 110cca7845ed5a66c08fdd413b02e706ae34455f
|
|||||||
F src/journal.c cffd2cd214e58c0e99c3ff632b3bee6c7cbb260e
|
F src/journal.c cffd2cd214e58c0e99c3ff632b3bee6c7cbb260e
|
||||||
F src/legacy.c aac57bd984e666059011ea01ec4383892a253be3
|
F src/legacy.c aac57bd984e666059011ea01ec4383892a253be3
|
||||||
F src/loadext.c eb1fe4f44d7c8ff53fc0c6a4388ab79fbd34cd64
|
F src/loadext.c eb1fe4f44d7c8ff53fc0c6a4388ab79fbd34cd64
|
||||||
F src/main.c 2513e9bb233a8ebc4aaa766a37528ef255cde7fb
|
F src/main.c 69dbacc8c605f19dd380b2eda8c947a2aac19671
|
||||||
F src/malloc.c 7ccc630b359f57a47b6034af54e42eb838eebd46
|
F src/malloc.c 7ccc630b359f57a47b6034af54e42eb838eebd46
|
||||||
F src/md5.c 008216bbb5d34c6fbab5357aa68575ad8a31516a
|
F src/md5.c 008216bbb5d34c6fbab5357aa68575ad8a31516a
|
||||||
F src/mem1.c 3a7fe31d8290baa3bb203af72f7dfd6323966bcd
|
F src/mem1.c 3a7fe31d8290baa3bb203af72f7dfd6323966bcd
|
||||||
@@ -138,8 +138,8 @@ F src/os_win.c aefe9ee26430678a19a058a874e4e2bd91398142
|
|||||||
F src/pager.c 3a4358c72c9c8415e8648001c776857e6952e2b4
|
F src/pager.c 3a4358c72c9c8415e8648001c776857e6952e2b4
|
||||||
F src/pager.h 3778bea71dfb9658b6c94394e18db4a5b27e6ded
|
F src/pager.h 3778bea71dfb9658b6c94394e18db4a5b27e6ded
|
||||||
F src/parse.y d0f76d2cb8d6883d5600dc20beb961a6022b94b8
|
F src/parse.y d0f76d2cb8d6883d5600dc20beb961a6022b94b8
|
||||||
F src/pcache.c 4668410008dda89ff5f0eb62b887cfb5e13903eb
|
F src/pcache.c f57227003d39d40fa7f9b5a86e36b99f74b93267
|
||||||
F src/pcache.h aef1dedd7ff6186f27052a2509fff437a8906977
|
F src/pcache.h d2becbe7255f6bf57fc9e0bf889a9ec73d50ee74
|
||||||
F src/pragma.c f5b271b090af7fcedd308d7c5807a5503f7a853d
|
F src/pragma.c f5b271b090af7fcedd308d7c5807a5503f7a853d
|
||||||
F src/prepare.c c197041e0c4770672cda75e6bfe10242f885e510
|
F src/prepare.c c197041e0c4770672cda75e6bfe10242f885e510
|
||||||
F src/printf.c 2e984b2507291a7e16d89dc9bb60582904f6247d
|
F src/printf.c 2e984b2507291a7e16d89dc9bb60582904f6247d
|
||||||
@@ -149,7 +149,7 @@ F src/select.c e71462393fe0f9d2bf41378763b96659e8780e43
|
|||||||
F src/shell.c d83b578a8ccdd3e0e7fef4388a0887ce9f810967
|
F src/shell.c d83b578a8ccdd3e0e7fef4388a0887ce9f810967
|
||||||
F src/sqlite.h.in 54e51c22e2294c5989156b0aec87aa44168ac1f0
|
F src/sqlite.h.in 54e51c22e2294c5989156b0aec87aa44168ac1f0
|
||||||
F src/sqlite3ext.h 1e3887c9bd3ae66cb599e922824b04cd0d0f2c3e
|
F src/sqlite3ext.h 1e3887c9bd3ae66cb599e922824b04cd0d0f2c3e
|
||||||
F src/sqliteInt.h 15096ac72b783de470c7f89888560e2ddaa83898
|
F src/sqliteInt.h ddf6c9eb90b295bcb7c600139227e5e2a16c8063
|
||||||
F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8
|
F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8
|
||||||
F src/status.c 8caa772cd9310bc297280f7cf0ede4d69ed5b801
|
F src/status.c 8caa772cd9310bc297280f7cf0ede4d69ed5b801
|
||||||
F src/table.c 22744786199c9195720c15a7a42cb97b2e2728d8
|
F src/table.c 22744786199c9195720c15a7a42cb97b2e2728d8
|
||||||
@@ -622,7 +622,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
|
|||||||
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
||||||
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
|
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
|
||||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||||
P ef6936e50adb9ebea39c890167403fff01bbb5ed
|
P 30077ece459b515338723ca0dab11c18b9f09d21
|
||||||
R 93e8a5c8f5b8731f0168db8793678abe
|
R e5f18970c2a651995955578eea70a847
|
||||||
U drh
|
U drh
|
||||||
Z fc276d4f825ababf0c32faa8e25a17cd
|
Z 9729df78d7652ca44708388f5fcbb37d
|
||||||
|
@@ -1 +1 @@
|
|||||||
30077ece459b515338723ca0dab11c18b9f09d21
|
80d6a31cb3851704c09ac9d99fe4bc241df3c180
|
@@ -13,7 +13,7 @@
|
|||||||
** This file contains functions used to access the internal hash tables
|
** This file contains functions used to access the internal hash tables
|
||||||
** of user defined functions and collation sequences.
|
** 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"
|
#include "sqliteInt.h"
|
||||||
@@ -357,7 +357,7 @@ FuncDef *sqlite3FindFunction(
|
|||||||
** function to use.
|
** function to use.
|
||||||
*/
|
*/
|
||||||
if( !createFlag && !pBest ){
|
if( !createFlag && !pBest ){
|
||||||
p = functionSearch(&sqlite3FuncBuiltins, h, zName, nName);
|
p = functionSearch(&sqlite3GlobalFunctions, h, zName, nName);
|
||||||
while( p ){
|
while( p ){
|
||||||
int score = matchQuality(p, nArg, enc);
|
int score = matchQuality(p, nArg, enc);
|
||||||
if( score>bestScore ){
|
if( score>bestScore ){
|
||||||
|
50
src/date.c
50
src/date.c
@@ -16,7 +16,7 @@
|
|||||||
** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
|
** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
|
||||||
** All other code has file scope.
|
** 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
|
** SQLite processes all times and dates as Julian Day numbers. The
|
||||||
** dates and times are stored as the number of days since noon
|
** dates and times are stored as the number of days since noon
|
||||||
@@ -1052,42 +1052,26 @@ static void currentTimeFunc(
|
|||||||
** functions. This should be the only routine in this file with
|
** functions. This should be the only routine in this file with
|
||||||
** external linkage.
|
** external linkage.
|
||||||
*/
|
*/
|
||||||
void sqlite3RegisterDateTimeFunctions(sqlite3 *db){
|
void sqlite3RegisterDateTimeFunctions(void){
|
||||||
|
static FuncDef aDateTimeFuncs[] = {
|
||||||
#ifndef SQLITE_OMIT_DATETIME_FUNCS
|
#ifndef SQLITE_OMIT_DATETIME_FUNCS
|
||||||
static const struct {
|
FUNCTION(julianday, -1, 0, 0, juliandayFunc ),
|
||||||
char *zName;
|
FUNCTION(date, -1, 0, 0, dateFunc ),
|
||||||
int nArg;
|
FUNCTION(time, -1, 0, 0, timeFunc ),
|
||||||
void (*xFunc)(sqlite3_context*,int,sqlite3_value**);
|
FUNCTION(datetime, -1, 0, 0, datetimeFunc ),
|
||||||
} aFuncs[] = {
|
FUNCTION(strftime, -1, 0, 0, strftimeFunc ),
|
||||||
{ "julianday", -1, juliandayFunc },
|
FUNCTION(current_time, 0, 0, 0, ctimeFunc ),
|
||||||
{ "date", -1, dateFunc },
|
FUNCTION(current_timestamp, 0, 0, 0, ctimestampFunc),
|
||||||
{ "time", -1, timeFunc },
|
FUNCTION(current_date, 0, 0, 0, cdateFunc ),
|
||||||
{ "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);
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
static const struct {
|
FUNCTION(current_time, 0, "%H:%M:%S", 0, currentTimeFunc),
|
||||||
char *zName;
|
FUNCTION(current_timestamp, 0, "%Y-%m-%d", 0, currentTimeFunc),
|
||||||
char *zFormat;
|
FUNCTION(current_date, 0, "%Y-%m-%d %H:%M:%S", 0, currentTimeFunc),
|
||||||
} aFuncs[] = {
|
#endif
|
||||||
{ "current_time", "%H:%M:%S" },
|
|
||||||
{ "current_date", "%Y-%m-%d" },
|
|
||||||
{ "current_timestamp", "%Y-%m-%d %H:%M:%S" }
|
|
||||||
};
|
};
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i=0; i<sizeof(aFuncs)/sizeof(aFuncs[0]); i++){
|
for(i=0; i<ArraySize(aDateTimeFuncs); i++){
|
||||||
sqlite3CreateFunc(db, aFuncs[i].zName, 0, SQLITE_UTF8,
|
sqlite3FuncDefInsert(&sqlite3GlobalFunctions, &aDateTimeFuncs[i]);
|
||||||
aFuncs[i].zFormat, currentTimeFunc, 0, 0);
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
79
src/func.c
79
src/func.c
@@ -16,11 +16,8 @@
|
|||||||
** 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.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 "sqliteInt.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -1222,7 +1219,6 @@ void sqlite3RegisterBuiltinFunctions(sqlite3 *db){
|
|||||||
#ifndef SQLITE_OMIT_PARSER
|
#ifndef SQLITE_OMIT_PARSER
|
||||||
sqlite3AttachFunctions(db);
|
sqlite3AttachFunctions(db);
|
||||||
#endif
|
#endif
|
||||||
sqlite3RegisterDateTimeFunctions(db);
|
|
||||||
if( !db->mallocFailed ){
|
if( !db->mallocFailed ){
|
||||||
int rc = sqlite3_overload_function(db, "MATCH", 2);
|
int rc = sqlite3_overload_function(db, "MATCH", 2);
|
||||||
assert( rc==SQLITE_NOMEM || rc==SQLITE_OK );
|
assert( rc==SQLITE_NOMEM || rc==SQLITE_OK );
|
||||||
@@ -1301,65 +1297,12 @@ int sqlite3IsLikeFunction(sqlite3 *db, Expr *pExpr, int *pIsNocase, char *aWc){
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** The following three macros, FUNCTION(), LIKEFUNC() and AGGREGATE() are
|
** The following array holds FuncDef structures for all of the functions
|
||||||
** used to create the literal values used for the FuncDef structures in
|
** defined in this file.
|
||||||
** the global aBuiltinFunc[] array (see below).
|
|
||||||
**
|
**
|
||||||
** FUNCTION(zName, nArg, iArg, bNC, xFunc)
|
** The array cannot be constant since changes are made to the
|
||||||
** Used to create a scalar function definition of a function zName
|
** FuncDef.pHash elements at start-time. The elements of this array
|
||||||
** implemented by C function xFunc that accepts nArg arguments. The
|
** are read-only after initialization is complete.
|
||||||
** 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.
|
|
||||||
**
|
|
||||||
** 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.
|
|
||||||
*/
|
*/
|
||||||
static FuncDef aBuiltinFunc[] = {
|
static FuncDef aBuiltinFunc[] = {
|
||||||
FUNCTION(ltrim, 1, 1, 0, trimFunc ),
|
FUNCTION(ltrim, 1, 1, 0, trimFunc ),
|
||||||
@@ -1423,12 +1366,16 @@ static FuncDef aBuiltinFunc[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Build up the global built-in function table at initialization
|
** All all of the FuncDef structures in the aBuiltinFunc[] array above
|
||||||
** time.
|
** 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){
|
void sqlite3RegisterGlobalFunctions(void){
|
||||||
int i;
|
int i;
|
||||||
for(i=0; i<ArraySize(aBuiltinFunc); i++){
|
for(i=0; i<ArraySize(aBuiltinFunc); i++){
|
||||||
sqlite3FuncDefInsert(&sqlite3FuncBuiltins, &aBuiltinFunc[i]);
|
sqlite3FuncDefInsert(&sqlite3GlobalFunctions, &aBuiltinFunc[i]);
|
||||||
}
|
}
|
||||||
|
sqlite3RegisterDateTimeFunctions();
|
||||||
}
|
}
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
**
|
**
|
||||||
** This file contains definitions of global variables and contants.
|
** 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"
|
#include "sqliteInt.h"
|
||||||
|
|
||||||
@@ -82,4 +82,4 @@ struct Sqlite3Config sqlite3Config = {
|
|||||||
** database connections. After initialization, this table is
|
** database connections. After initialization, this table is
|
||||||
** read-only.
|
** read-only.
|
||||||
*/
|
*/
|
||||||
FuncDefHash sqlite3FuncBuiltins;
|
FuncDefHash sqlite3GlobalFunctions;
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
** 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.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 "sqliteInt.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@@ -147,7 +147,7 @@ int sqlite3_initialize(void){
|
|||||||
sqlite3_mutex_enter(sqlite3Config.pInitMutex);
|
sqlite3_mutex_enter(sqlite3Config.pInitMutex);
|
||||||
if( sqlite3Config.isInit==0 && inProgress==0 ){
|
if( sqlite3Config.isInit==0 && inProgress==0 ){
|
||||||
inProgress = 1;
|
inProgress = 1;
|
||||||
memset(&sqlite3FuncBuiltins, 0, sizeof(sqlite3FuncBuiltins));
|
memset(&sqlite3GlobalFunctions, 0, sizeof(sqlite3GlobalFunctions));
|
||||||
sqlite3RegisterGlobalFunctions();
|
sqlite3RegisterGlobalFunctions();
|
||||||
rc = sqlite3_os_init();
|
rc = sqlite3_os_init();
|
||||||
if( rc==SQLITE_OK ){
|
if( rc==SQLITE_OK ){
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
*************************************************************************
|
*************************************************************************
|
||||||
** This file implements that page cache.
|
** 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"
|
#include "sqliteInt.h"
|
||||||
|
|
||||||
@@ -1213,4 +1213,3 @@ int sqlite3PcacheReleaseMemory(int nReq){
|
|||||||
return nFree;
|
return nFree;
|
||||||
}
|
}
|
||||||
#endif /* SQLITE_ENABLE_MEMORY_MANAGEMENT */
|
#endif /* SQLITE_ENABLE_MEMORY_MANAGEMENT */
|
||||||
|
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
** This header file defines the interface that the sqlite page cache
|
** This header file defines the interface that the sqlite page cache
|
||||||
** subsystem.
|
** 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_
|
#ifndef _PCACHE_H_
|
||||||
@@ -174,4 +174,3 @@ void sqlite3PcacheUnlock(PCache *);
|
|||||||
int sqlite3PcacheReleaseMemory(int);
|
int sqlite3PcacheReleaseMemory(int);
|
||||||
|
|
||||||
#endif /* _PCACHE_H_ */
|
#endif /* _PCACHE_H_ */
|
||||||
|
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
*************************************************************************
|
*************************************************************************
|
||||||
** Internal interface definitions for SQLite.
|
** 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_
|
#ifndef _SQLITEINT_H_
|
||||||
#define _SQLITEINT_H_
|
#define _SQLITEINT_H_
|
||||||
@@ -784,6 +784,39 @@ struct FuncDef {
|
|||||||
#define SQLITE_FUNC_CASE 0x02 /* Case-sensitive LIKE-type function */
|
#define SQLITE_FUNC_CASE 0x02 /* Case-sensitive LIKE-type function */
|
||||||
#define SQLITE_FUNC_EPHEM 0x04 /* Ephermeral. Delete with VDBE */
|
#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
|
** Each SQLite module (virtual table definition) is defined by an
|
||||||
** instance of the following structure, stored in the sqlite3.aModule
|
** instance of the following structure, stored in the sqlite3.aModule
|
||||||
@@ -2142,7 +2175,7 @@ Select *sqlite3SelectDup(sqlite3*,Select*);
|
|||||||
void sqlite3FuncDefInsert(FuncDefHash*, FuncDef*);
|
void sqlite3FuncDefInsert(FuncDefHash*, FuncDef*);
|
||||||
FuncDef *sqlite3FindFunction(sqlite3*,const char*,int,int,u8,int);
|
FuncDef *sqlite3FindFunction(sqlite3*,const char*,int,int,u8,int);
|
||||||
void sqlite3RegisterBuiltinFunctions(sqlite3*);
|
void sqlite3RegisterBuiltinFunctions(sqlite3*);
|
||||||
void sqlite3RegisterDateTimeFunctions(sqlite3*);
|
void sqlite3RegisterDateTimeFunctions(void);
|
||||||
void sqlite3RegisterGlobalFunctions(void);
|
void sqlite3RegisterGlobalFunctions(void);
|
||||||
int sqlite3GetBuiltinFunction(const char *, int, FuncDef **);
|
int sqlite3GetBuiltinFunction(const char *, int, FuncDef **);
|
||||||
#ifdef SQLITE_DEBUG
|
#ifdef SQLITE_DEBUG
|
||||||
@@ -2282,7 +2315,7 @@ void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8);
|
|||||||
#ifndef SQLITE_AMALGAMATION
|
#ifndef SQLITE_AMALGAMATION
|
||||||
extern const unsigned char sqlite3UpperToLower[];
|
extern const unsigned char sqlite3UpperToLower[];
|
||||||
extern struct Sqlite3Config sqlite3Config;
|
extern struct Sqlite3Config sqlite3Config;
|
||||||
extern FuncDefHash sqlite3FuncBuiltins;
|
extern FuncDefHash sqlite3GlobalFunctions;
|
||||||
#endif
|
#endif
|
||||||
void sqlite3RootPageMoved(Db*, int, int);
|
void sqlite3RootPageMoved(Db*, int, int);
|
||||||
void sqlite3Reindex(Parse*, Token*, Token*);
|
void sqlite3Reindex(Parse*, Token*, Token*);
|
||||||
|
Reference in New Issue
Block a user