-C Use\sthe\snew\sAPI\sfor\sreturning\svalues\sand\serrors\sfrom\suser\sfunctions.\s(CVS\s1453)
-D 2004-05-25T11:47:25
+C Change\sa\scouple\sof\ssymbol\snames\sfor\sthe\snew\suser\sfunction\sAPI.\s(CVS\s1454)
+D 2004-05-25T12:05:57
F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
F src/btree.h b65140b5ae891f30d2a39e64b9f0343225553545
F src/build.c 35cbeb439b49cca5eb5e8a1de010a5194f4523e8
F src/copy.c 4d2038602fd0549d80c59bda27d96f13ea9b5e29
-F src/date.c b754dc0e1a84b408de0ccc727c792d46ccb66a69
+F src/date.c 098aee0a006d6e14dcd8f3ad21733691790c4459
F src/delete.c 2e1dda38345416a1ea1c0a6468589a7472334dac
F src/encode.c a876af473d1d636faa3dca51c7571f2e007eea37
F src/expr.c 5b283e68bd6df365b7c2ad10bd04cc54c2b4b07c
-F src/func.c c811d2b77f1f1d88db759cbd60b382463f5a3ae3
+F src/func.c e67a36ae28ee3495d02261f74989a7bb192658fd
F src/hash.c 440c2f8cb373ee1b4e13a0988489c7cd95d55b6f
F src/hash.h 762d95f1e567664d1eafc1687de755626be962fb
F src/insert.c e510d62d23b4de4d901e7ccbbe7833b7fb3b9570
-F src/main.c 8279e1160810410bb9ad6608f87b0140db5b1ce0
-F src/md5.c 8344ab774bed1bcf2f2fd4e130cc48536f37c414
+F src/main.c 6b308d6f181be8a07a34d79e10c527b43696c6ea
+F src/md5.c 32ec4d879e9b34d6a597ae8bda684d8e395003f4
F src/os.h ab42f4a7c4c716f26b988e759b6e12085a3bfc67
F src/os_common.h 744286a27de55c52f1b18921e8d17abbf7fafc0f
F src/os_mac.c b823874690615ace0dd520d3ad1fe8bfd864b7e0
F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3
F src/select.c 7d77a8bed7eeac23216d42fc1be006fb4352fcdc
F src/shell.c ed4d237b3e52a0a42512bfcc53530e46de20c28f
-F src/sqlite.h.in 5c9a7d2a4c438da8389382a4ecf145cad73a9238
-F src/sqliteInt.h 3ba18f1bbe85c69db1b4882ba899681b0bbac2ae
+F src/sqlite.h.in 53469b35d64de3248438709f50c769b08e2b64b2
+F src/sqliteInt.h 6559811caeae0d1855e0b973e363a8c5141e566b
F src/table.c af14284fa36c8d41f6829e3f2819dce07d3e2de2
-F src/tclsqlite.c 0c0600409dfc297ef026ca9c8dbdf8754e54d0c4
-F src/test1.c ae2886e9c130f0dcd49f78bd78ffa37c2cb2e7d0
+F src/tclsqlite.c 0b62e8df6da5abdddf49f3d9274a8103ee61fb63
+F src/test1.c cf86941c235c307549179d9ca38a16904b977655
F src/test2.c 6195a1ca2c8d0d2d93644e86da3289b403486872
F src/test3.c 5e4a6d596f982f6f47a5f9f75ede9b4a3b739968
F src/test4.c b9947c319a5c023c10c1e953e6610abd571c2283
F src/vacuum.c 8734f89742f246abd91dbd3e087fc153bddbfbad
F src/vdbe.c bf205ee831161cffc924c71307e24eb61b237230
F src/vdbe.h 391d5642a83af686f35c228fcd36cb4456d68f44
-F src/vdbeInt.h a9a105b9232d7305b41ab36eadd0355079ff01c3
-F src/vdbeaux.c dc4fdfce9cad48d47328d7733df2ee975da6c0a0
+F src/vdbeInt.h e500998a0ab3b10850c771c60d6b132037ff56e7
+F src/vdbeaux.c 051acd76f0afd30556288e3881f1838bc536e00c
F src/where.c efe5d25fe18cd7381722457898cd863e84097a0c
F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242
F test/attach.test cb9b884344e6cfa5e165965d5b1adea679a24c83
F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
-P b77c268ebebd5401c3f519a72cfb81438207368c
-R 4e71bf50ae3412040cd39e61cbbbc2a7
+P 4eccae03b4a7f37804fea30416579787c3584bb2
+R 53de2c4205311190b1b667f6c790aa60
U danielk1977
-Z c2a413dbfbef432d165e1d1b259db6f9
+Z 585412757c2c184bef9cb8e869c28219
-4eccae03b4a7f37804fea30416579787c3584bb2
\ No newline at end of file
+8f6b20c2938ded7ab9e400494c02370ecf7e9311
\ No newline at end of file
** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
** All other code has file scope.
**
-** $Id: date.c,v 1.22 2004/05/25 11:47:25 danielk1977 Exp $
+** $Id: date.c,v 1.23 2004/05/25 12:05:57 danielk1977 Exp $
**
** NOTES:
**
**
** Return the julian day number of the date specified in the arguments
*/
-static void juliandayFunc(sqlite_func *context, int argc, sqlite3_value **argv){
+static void juliandayFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
DateTime x;
if( isDate(argc, argv, &x)==0 ){
computeJD(&x);
**
** Return YYYY-MM-DD HH:MM:SS
*/
-static void datetimeFunc(sqlite_func *context, int argc, sqlite3_value **argv){
+static void datetimeFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
DateTime x;
if( isDate(argc, argv, &x)==0 ){
char zBuf[100];
**
** Return HH:MM:SS
*/
-static void timeFunc(sqlite_func *context, int argc, sqlite3_value **argv){
+static void timeFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
DateTime x;
if( isDate(argc, argv, &x)==0 ){
char zBuf[100];
**
** Return YYYY-MM-DD
*/
-static void dateFunc(sqlite_func *context, int argc, sqlite3_value **argv){
+static void dateFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
DateTime x;
if( isDate(argc, argv, &x)==0 ){
char zBuf[100];
** %Y year 0000-9999
** %% %
*/
-static void strftimeFunc(sqlite_func *context, int argc, sqlite3_value **argv){
+static void strftimeFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
DateTime x;
int n, i, j;
char *z;
char *zName;
int nArg;
int dataType;
- void (*xFunc)(sqlite_func*,int,sqlite3_value**);
+ void (*xFunc)(sqlite3_context*,int,sqlite3_value**);
} aFuncs[] = {
#ifndef SQLITE_OMIT_DATETIME_FUNCS
{ "julianday", -1, SQLITE_NUMERIC, juliandayFunc },
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
** All other code has file scope.
**
-** $Id: func.c,v 1.54 2004/05/25 11:47:25 danielk1977 Exp $
+** $Id: func.c,v 1.55 2004/05/25 12:05:57 danielk1977 Exp $
*/
#include <ctype.h>
#include <math.h>
/*
** Implementation of the non-aggregate min() and max() functions
*/
-static void minmaxFunc(sqlite_func *context, int argc, sqlite3_value **argv){
+static void minmaxFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
const char *zBest;
int i;
int (*xCompare)(const char*, const char*);
/*
** Return the type of the argument.
*/
-static void typeofFunc(sqlite_func *context, int argc, sqlite3_value **argv){
+static void typeofFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
const char *z = 0;
assert( argc==2 );
switch( sqlite3_value_type(argv[0]) ){
/*
** Implementation of the length() function
*/
-static void lengthFunc(sqlite_func *context, int argc, sqlite3_value **argv){
+static void lengthFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
const char *z;
int len;
/*
** Implementation of the abs() function
*/
-static void absFunc(sqlite_func *context, int argc, sqlite3_value **argv){
+static void absFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
const char *z;
assert( argc==1 );
z = sqlite3_value_data(argv[0]);
/*
** Implementation of the substr() function
*/
-static void substrFunc(sqlite_func *context, int argc, sqlite3_value **argv){
+static void substrFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
const char *z;
#ifdef SQLITE_UTF8
const char *z2;
/*
** Implementation of the round() function
*/
-static void roundFunc(sqlite_func *context, int argc, sqlite3_value **argv){
+static void roundFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
int n = 0;
double r;
char zBuf[100];
/*
** Implementation of the upper() and lower() SQL functions.
*/
-static void upperFunc(sqlite_func *context, int argc, sqlite3_value **argv){
+static void upperFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
char *z;
int i;
if( argc<1 || SQLITE3_NULL==sqlite3_value_type(argv[0]) ) return;
sqlite3_result_text(context, z, -1, 1);
sqliteFree(z);
}
-static void lowerFunc(sqlite_func *context, int argc, sqlite3_value **argv){
+static void lowerFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
char *z;
int i;
if( argc<1 || SQLITE3_NULL==sqlite3_value_type(argv[0]) ) return;
** All three do the same thing. They return the first non-NULL
** argument.
*/
-static void ifnullFunc(sqlite_func *context, int argc, sqlite3_value **argv){
+static void ifnullFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
int i;
for(i=0; i<argc; i++){
if( SQLITE3_NULL!=sqlite3_value_type(argv[i]) ){
/*
** Implementation of random(). Return a random integer.
*/
-static void randomFunc(sqlite_func *context, int argc, sqlite3_value **argv){
+static void randomFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
int r;
sqlite3Randomness(sizeof(r), &r);
sqlite3_result_int32(context, r);
** value is the same as the sqlite3_last_insert_rowid() API function.
*/
static void last_insert_rowid(
- sqlite_func *context,
+ sqlite3_context *context,
int arg,
sqlite3_value **argv
){
** Implementation of the change_count() SQL function. The return
** value is the same as the sqlite3_changes() API function.
*/
-static void change_count(sqlite_func *context, int arg, sqlite3_value **argv){
+static void change_count(sqlite3_context *context, int arg, sqlite3_value **argv){
sqlite *db = sqlite3_user_data(context);
sqlite3_result_int32(context, sqlite3_changes(db));
}
** function.
*/
static void last_statement_change_count(
- sqlite_func *context,
+ sqlite3_context *context,
int arg,
sqlite3_value **argv
){
** is implemented as like(A,B).
*/
static void likeFunc(
- sqlite_func *context,
+ sqlite3_context *context,
int argc,
sqlite3_value **argv
){
**
** is implemented as glob(A,B).
*/
-static void globFunc(sqlite_func *context, int arg, sqlite3_value **argv){
+static void globFunc(sqlite3_context *context, int arg, sqlite3_value **argv){
const unsigned char *zA = sqlite3_value_data(argv[0]);
const unsigned char *zB = sqlite3_value_data(argv[1]);
if( zA && zB ){
** argument if the arguments are different. The result is NULL if the
** arguments are equal to each other.
*/
-static void nullifFunc(sqlite_func *context, int argc, sqlite3_value **argv){
+static void nullifFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
const unsigned char *zX = sqlite3_value_data(argv[0]);
const unsigned char *zY = sqlite3_value_data(argv[1]);
if( zX!=0 && sqlite3Compare(zX, zY)!=0 ){
** Implementation of the VERSION(*) function. The result is the version
** of the SQLite library that is running.
*/
-static void versionFunc(sqlite_func *context, int argc, sqlite3_value **argv){
+static void versionFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
sqlite3_result_text(context, sqlite3_version, -1, 0);
}
** "NULL". Otherwise, the argument is enclosed in single quotes with
** single-quote escapes.
*/
-static void quoteFunc(sqlite_func *context, int argc, sqlite3_value **argv){
+static void quoteFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
const char *zArg = sqlite3_value_data(argv[0]);
if( argc<1 ) return;
if( zArg==0 ){
/*
** Compute the soundex encoding of a word.
*/
-static void soundexFunc(sqlite_func *context, int argc, sqlite3_value **argv){
+static void soundexFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
char zResult[8];
const char *zIn;
int i, j;
** This function generates a string of random characters. Used for
** generating test data.
*/
-static void randStr(sqlite_func *context, int argc, sqlite3_value **argv){
+static void randStr(sqlite3_context *context, int argc, sqlite3_value **argv){
static const unsigned char zSrc[] =
"abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
/*
** Routines used to compute the sum or average.
*/
-static void sumStep(sqlite_func *context, int argc, sqlite3_value **argv){
+static void sumStep(sqlite3_context *context, int argc, sqlite3_value **argv){
SumCtx *p;
if( argc<1 ) return;
- p = sqlite3_aggregate_context(context, sizeof(*p));
+ p = sqlite3_get_context(context, sizeof(*p));
if( p && SQLITE3_NULL!=sqlite3_value_type(argv[0]) ){
p->sum += sqlite3_value_float(argv[0]);
p->cnt++;
}
}
-static void sumFinalize(sqlite_func *context){
+static void sumFinalize(sqlite3_context *context){
SumCtx *p;
- p = sqlite3_aggregate_context(context, sizeof(*p));
+ p = sqlite3_get_context(context, sizeof(*p));
sqlite3_result_double(context, p ? p->sum : 0.0);
}
-static void avgFinalize(sqlite_func *context){
+static void avgFinalize(sqlite3_context *context){
SumCtx *p;
- p = sqlite3_aggregate_context(context, sizeof(*p));
+ p = sqlite3_get_context(context, sizeof(*p));
if( p && p->cnt>0 ){
sqlite3_result_double(context, p->sum/(double)p->cnt);
}
/*
** Routines used to compute the standard deviation as an aggregate.
*/
-static void stdDevStep(sqlite_func *context, int argc, const char **argv){
+static void stdDevStep(sqlite3_context *context, int argc, const char **argv){
StdDevCtx *p;
double x;
if( argc<1 ) return;
p->cnt++;
}
}
-static void stdDevFinalize(sqlite_func *context){
+static void stdDevFinalize(sqlite3_context *context){
double rN = sqlite3_aggregate_count(context);
StdDevCtx *p = sqlite3_aggregate_context(context, sizeof(*p));
if( p && p->cnt>1 ){
/*
** Routines to implement the count() aggregate function.
*/
-static void countStep(sqlite_func *context, int argc, sqlite3_value **argv){
+static void countStep(sqlite3_context *context, int argc, sqlite3_value **argv){
CountCtx *p;
- p = sqlite3_aggregate_context(context, sizeof(*p));
+ p = sqlite3_get_context(context, sizeof(*p));
if( (argc==0 || SQLITE3_NULL!=sqlite3_value_type(argv[0])) && p ){
p->n++;
}
}
-static void countFinalize(sqlite_func *context){
+static void countFinalize(sqlite3_context *context){
CountCtx *p;
- p = sqlite3_aggregate_context(context, sizeof(*p));
+ p = sqlite3_get_context(context, sizeof(*p));
sqlite3_result_int32(context, p ? p->n : 0);
}
/*
** Routines to implement min() and max() aggregate functions.
*/
-static void minmaxStep(sqlite_func *context, int argc, sqlite3_value **argv){
+static void minmaxStep(sqlite3_context *context, int argc, sqlite3_value **argv){
int max = 0;
int cmp = 0;
Mem *pArg = (Mem *)argv[0];
- Mem *pBest = (Mem *)sqlite3_aggregate_context(context, sizeof(*pBest));
+ Mem *pBest = (Mem *)sqlite3_get_context(context, sizeof(*pBest));
if( SQLITE3_NULL==sqlite3_value_type(argv[0]) ) return;
sqlite3VdbeMemCopy(pBest, pArg);
}
}
-static void minMaxFinalize(sqlite_func *context){
+static void minMaxFinalize(sqlite3_context *context){
sqlite3_value *pRes;
- pRes = (sqlite3_value *)sqlite3_aggregate_context(context, sizeof(Mem));
+ pRes = (sqlite3_value *)sqlite3_get_context(context, sizeof(Mem));
if( pRes->flags ){
switch( sqlite3_value_type(pRes) ){
signed char nArg;
signed char dataType;
u8 argType; /* 0: none. 1: db 2: (-1) */
- void (*xFunc)(sqlite_func*,int,sqlite3_value **);
+ void (*xFunc)(sqlite3_context*,int,sqlite3_value **);
} aFuncs[] = {
{ "min", -1, SQLITE_ARGS, 0, minmaxFunc },
{ "min", 0, 0, 0, 0 },
signed char nArg;
signed char dataType;
u8 argType;
- void (*xStep)(sqlite_func*,int,sqlite3_value**);
- void (*xFinalize)(sqlite_func*);
+ void (*xStep)(sqlite3_context*,int,sqlite3_value**);
+ void (*xFinalize)(sqlite3_context*);
} aAggs[] = {
{ "min", 1, 0, 0, minmaxStep, minMaxFinalize },
{ "max", 1, 0, 2, minmaxStep, minMaxFinalize },
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
-** $Id: main.c,v 1.187 2004/05/24 23:48:26 danielk1977 Exp $
+** $Id: main.c,v 1.188 2004/05/25 12:05:57 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
sqlite *db, /* Add the function to this database connection */
const char *zName, /* Name of the function to add */
int nArg, /* Number of arguments */
- void (*xFunc)(sqlite_func*,int,sqlite3_value **), /* The implementation */
+ void (*xFunc)(sqlite3_context*,int,sqlite3_value **), /* The implementation */
void *pUserData /* User data */
){
FuncDef *p;
sqlite *db, /* Add the function to this database connection */
const char *zName, /* Name of the function to add */
int nArg, /* Number of arguments */
- void (*xStep)(sqlite_func*,int,sqlite3_value**), /* The step function */
- void (*xFinalize)(sqlite_func*), /* The finalizer */
+ void (*xStep)(sqlite3_context*,int,sqlite3_value**), /* The step function */
+ void (*xFinalize)(sqlite3_context*), /* The finalizer */
void *pUserData /* User data */
){
FuncDef *p;
** During testing, the special md5sum() aggregate function is available.
** inside SQLite. The following routines implement that function.
*/
-static void md5step(sqlite_func *context, int argc, sqlite3_value **argv){
+static void md5step(sqlite3_context *context, int argc, sqlite3_value **argv){
MD5Context *p;
int i;
if( argc<1 ) return;
- p = sqlite3_aggregate_context(context, sizeof(*p));
+ p = sqlite3_get_context(context, sizeof(*p));
if( p==0 ) return;
if( sqlite3_aggregate_count(context)==1 ){
MD5Init(p);
}
}
}
-static void md5finalize(sqlite_func *context){
+static void md5finalize(sqlite3_context *context){
MD5Context *p;
unsigned char digest[16];
char zBuf[33];
- p = sqlite3_aggregate_context(context, sizeof(*p));
+ p = sqlite3_get_context(context, sizeof(*p));
MD5Final(digest,p);
DigestToBase16(digest, zBuf);
sqlite3_result_text(context, zBuf, -1, 1);
** This header file defines the interface that the SQLite library
** presents to client programs.
**
-** @(#) $Id: sqlite.h.in,v 1.75 2004/05/25 11:47:26 danielk1977 Exp $
+** @(#) $Id: sqlite.h.in,v 1.76 2004/05/25 12:05:57 danielk1977 Exp $
*/
#ifndef _SQLITE_H_
#define _SQLITE_H_
** A pointer to the following structure is used to communicate with
** the implementations of user-defined functions.
*/
-typedef struct sqlite_func sqlite_func;
+typedef struct sqlite3_context sqlite3_context;
typedef struct Mem sqlite3_value;
+
/*
** Use the following routines to create new user-defined functions. See
** the documentation for details.
sqlite*, /* Database where the new function is registered */
const char *zName, /* Name of the new function */
int nArg, /* Number of arguments. -1 means any number */
- void (*xFunc)(sqlite_func*,int,sqlite3_value **), /* C code to implement */
+ void (*xFunc)(sqlite3_context*,int,sqlite3_value **), /* C code to implement */
void *pUserData /* Available via the sqlite3_user_data() call */
);
int sqlite3_create_aggregate(
sqlite*, /* Database where the new function is registered */
const char *zName, /* Name of the function */
int nArg, /* Number of arguments */
- void (*xStep)(sqlite_func*,int,sqlite3_value**), /* Called for each row */
- void (*xFinalize)(sqlite_func*), /* Called once to get final result */
+ void (*xStep)(sqlite3_context*,int,sqlite3_value**), /* Called for each row */
+ void (*xFinalize)(sqlite3_context*), /* Called once to get final result */
void *pUserData /* Available via the sqlite3_user_data() call */
);
#define SQLITE_TEXT (-2)
#define SQLITE_ARGS (-3)
-/*
-** Aggregate functions use the following routine to allocate
-** a structure for storing their state. The first time this routine
-** is called for a particular aggregate, a new structure of size nBytes
-** is allocated, zeroed, and returned. On subsequent calls (for the
-** same aggregate instance) the same buffer is returned. The implementation
-** of the aggregate can use the returned buffer to accumulate data.
-**
-** The buffer allocated is freed automatically be SQLite.
-*/
-void *sqlite3_aggregate_context(sqlite_func*, int nBytes);
-
/*
** The next routine returns the number of calls to xStep for a particular
** aggregate function instance. The current call to xStep counts so this
** routine always returns at least 1.
*/
-int sqlite3_aggregate_count(sqlite_func*);
+int sqlite3_aggregate_count(sqlite3_context*);
/*
** This routine registers a callback with the SQLite library. The
*/
double sqlite3_column_float(sqlite3_stmt*,int);
+
/*
** Return the type of the sqlite3_value* passed as the first argument.
** The type is one of SQLITE3_NULL, SQLITE3_INTEGER, SQLITE3_FLOAT,
*/
double sqlite3_value_float(sqlite3_value*);
-typedef sqlite_func sqlite3_context;
-
-void *sqlite3_get_context(sqlite3_context*, int nbyte);
+/*
+** Aggregate functions use the following routine to allocate
+** a structure for storing their state. The first time this routine
+** is called for a particular aggregate, a new structure of size nBytes
+** is allocated, zeroed, and returned. On subsequent calls (for the
+** same aggregate instance) the same buffer is returned. The implementation
+** of the aggregate can use the returned buffer to accumulate data.
+**
+** The buffer allocated is freed automatically by SQLite.
+*/
+void *sqlite3_get_context(sqlite3_context*, int nBytes);
/*
** The pUserData parameter to the sqlite3_create_function() and
*************************************************************************
** Internal interface definitions for SQLite.
**
-** @(#) $Id: sqliteInt.h,v 1.250 2004/05/24 23:48:27 danielk1977 Exp $
+** @(#) $Id: sqliteInt.h,v 1.251 2004/05/25 12:05:57 danielk1977 Exp $
*/
#include "config.h"
#include "sqlite.h"
** points to a linked list of these structures.
*/
struct FuncDef {
- void (*xFunc)(sqlite_func*,int,sqlite3_value**); /* Regular function */
- void (*xStep)(sqlite_func*,int,sqlite3_value**); /* Aggregate function step */
- void (*xFinalize)(sqlite_func*); /* Aggregate function finializer */
+ void (*xFunc)(sqlite3_context*,int,sqlite3_value**); /* Regular function */
+ void (*xStep)(sqlite3_context*,int,sqlite3_value**); /* Aggregate function step */
+ void (*xFinalize)(sqlite3_context*); /* Aggregate function finializer */
signed char nArg; /* Number of arguments. -1 means unlimited */
signed char dataType; /* Arg that determines datatype. -1=NUMERIC, */
/* -2=TEXT. -3=SQLITE_ARGS */
*************************************************************************
** A TCL Interface to SQLite
**
-** $Id: tclsqlite.c,v 1.68 2004/05/25 11:47:26 danielk1977 Exp $
+** $Id: tclsqlite.c,v 1.69 2004/05/25 12:05:57 danielk1977 Exp $
*/
#ifndef NO_TCL /* Omit this whole file if TCL is unavailable */
** This routine is called to evaluate an SQL function implemented
** using TCL script.
*/
-static void tclSqlFunc(sqlite_func *context, int argc, sqlite3_value **argv){
+static void tclSqlFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
SqlFunc *p = sqlite3_user_data(context);
Tcl_DString cmd;
int i;
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
-** $Id: test1.c,v 1.50 2004/05/25 11:47:26 danielk1977 Exp $
+** $Id: test1.c,v 1.51 2004/05/25 12:05:57 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
** Implementation of the x_coalesce() function.
** Return the first argument non-NULL argument.
*/
-static void ifnullFunc(sqlite_func *context, int argc, sqlite3_value **argv){
+static void ifnullFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
int i;
for(i=0; i<argc; i++){
if( SQLITE3_NULL!=sqlite3_value_type(argv[i]) ){
** use the same database at the same time.
*/
static void sqlite3ExecFunc(
- sqlite_func *context,
+ sqlite3_context *context,
int argc,
sqlite3_value **argv
){
struct CountCtx {
int n;
};
-static void countStep(sqlite_func *context, int argc, sqlite3_value **argv){
+static void countStep(sqlite3_context *context, int argc, sqlite3_value **argv){
CountCtx *p;
- p = sqlite3_aggregate_context(context, sizeof(*p));
+ p = sqlite3_get_context(context, sizeof(*p));
if( (argc==0 || SQLITE3_NULL!=sqlite3_value_type(argv[0]) ) && p ){
p->n++;
}
}
-static void countFinalize(sqlite_func *context){
+static void countFinalize(sqlite3_context *context){
CountCtx *p;
- p = sqlite3_aggregate_context(context, sizeof(*p));
+ p = sqlite3_get_context(context, sizeof(*p));
sqlite3_result_int32(context, p ? p->n : 0);
}
** The following routine is a user-defined SQL function whose purpose
** is to test the sqlite_set_result() API.
*/
-static void testFunc(sqlite_func *context, int argc, sqlite3_value **argv){
+static void testFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
while( argc>=2 ){
const char *zArg0 = sqlite3_value_data(argv[0]);
const char *zArg1 = sqlite3_value_data(argv[1]);
** This structure is defined inside of vdbe.c because it uses substructures
** (Mem) which are only defined there.
*/
-struct sqlite_func {
+struct sqlite3_context {
FuncDef *pFunc; /* Pointer to function information. MUST BE FIRST */
Mem s; /* The return value is stored here */
void *pAgg; /* Aggregate context */
}
/*
-** Extract the user data from a sqlite_func structure and return a
+** Extract the user data from a sqlite3_context structure and return a
** pointer to it.
*/
void *sqlite3_user_data(sqlite3_context *p){
** same context that was returned on prior calls.
**
** This routine is defined here in vdbe.c because it depends on knowing
-** the internals of the sqlite_func structure which is only defined in
+** the internals of the sqlite3_context structure which is only defined in
** this source file.
*/
-void *sqlite3_aggregate_context(sqlite_func *p, int nByte){
+void *sqlite3_get_context(sqlite3_context *p, int nByte){
assert( p && p->pFunc && p->pFunc->xStep );
if( p->pAgg==0 ){
if( nByte<=NBFS ){
** called.
**
** This routine is defined here in vdbe.c because it depends on knowing
-** the internals of the sqlite_func structure which is only defined in
+** the internals of the sqlite3_context structure which is only defined in
** this source file.
*/
-int sqlite3_aggregate_count(sqlite_func *p){
+int sqlite3_aggregate_count(sqlite3_context *p){
assert( p && p->pFunc && p->pFunc->xStep );
return p->cnt;
}
for(i=0; i<pAgg->nMem; i++){
Mem *pMem = &pElem->aMem[i];
if( pAgg->apFunc[i] && (pMem->flags & MEM_AggCtx)!=0 ){
- sqlite_func ctx;
+ sqlite3_context ctx;
ctx.pFunc = pAgg->apFunc[i];
ctx.s.flags = MEM_Null;
ctx.pAgg = pMem->z;