diff --git a/manifest b/manifest index c898089ade..f3d1734bd5 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -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 @@ -28,16 +28,16 @@ F src/btree.c 51dfa34da5f42762b228d7360cf3273ee403bce8 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 @@ -54,11 +54,11 @@ F src/printf.c ef750e8e2398ca7e8b58be991075f08c6a7f0e53 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 @@ -71,8 +71,8 @@ F src/util.c 4c0adcbc9ce6678dd046931253e45d623c6d279f 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 @@ -202,7 +202,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604 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 diff --git a/manifest.uuid b/manifest.uuid index 5a8f300f1c..965de056eb 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4eccae03b4a7f37804fea30416579787c3584bb2 \ No newline at end of file +8f6b20c2938ded7ab9e400494c02370ecf7e9311 \ No newline at end of file diff --git a/src/date.c b/src/date.c index 27a05876bf..4eb2aba5ce 100644 --- a/src/date.c +++ b/src/date.c @@ -16,7 +16,7 @@ ** 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: ** @@ -664,7 +664,7 @@ static int isDate(int argc, sqlite3_value **argv, DateTime *p){ ** ** 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); @@ -677,7 +677,7 @@ static void juliandayFunc(sqlite_func *context, int argc, sqlite3_value **argv){ ** ** 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]; @@ -693,7 +693,7 @@ static void datetimeFunc(sqlite_func *context, int argc, sqlite3_value **argv){ ** ** 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]; @@ -708,7 +708,7 @@ static void timeFunc(sqlite_func *context, int argc, sqlite3_value **argv){ ** ** 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]; @@ -737,7 +737,7 @@ static void dateFunc(sqlite_func *context, int argc, sqlite3_value **argv){ ** %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; @@ -853,7 +853,7 @@ void sqlite3RegisterDateTimeFunctions(sqlite *db){ 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 }, diff --git a/src/func.c b/src/func.c index cf230489ea..5e63c3aa02 100644 --- a/src/func.c +++ b/src/func.c @@ -16,7 +16,7 @@ ** 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 #include @@ -29,7 +29,7 @@ /* ** 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*); @@ -59,7 +59,7 @@ static void minmaxFunc(sqlite_func *context, int argc, sqlite3_value **argv){ /* ** 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]) ){ @@ -75,7 +75,7 @@ static void typeofFunc(sqlite_func *context, int argc, sqlite3_value **argv){ /* ** 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; @@ -93,7 +93,7 @@ static void lengthFunc(sqlite_func *context, int argc, sqlite3_value **argv){ /* ** 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]); @@ -105,7 +105,7 @@ static void absFunc(sqlite_func *context, int argc, sqlite3_value **argv){ /* ** 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; @@ -151,7 +151,7 @@ static void substrFunc(sqlite_func *context, int argc, sqlite3_value **argv){ /* ** 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]; @@ -171,7 +171,7 @@ static void roundFunc(sqlite_func *context, int argc, sqlite3_value **argv){ /* ** 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; @@ -184,7 +184,7 @@ static void upperFunc(sqlite_func *context, int argc, sqlite3_value **argv){ 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; @@ -203,7 +203,7 @@ static void lowerFunc(sqlite_func *context, int argc, sqlite3_value **argv){ ** 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; isum += 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); } @@ -488,7 +488,7 @@ struct StdDevCtx { /* ** 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; @@ -500,7 +500,7 @@ static void stdDevStep(sqlite_func *context, int argc, const char **argv){ 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 ){ @@ -523,16 +523,16 @@ struct CountCtx { /* ** 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); } @@ -549,11 +549,11 @@ struct MinMaxCtx { /* ** 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; @@ -575,9 +575,9 @@ static void minmaxStep(sqlite_func *context, int argc, sqlite3_value **argv){ 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) ){ @@ -609,7 +609,7 @@ void sqlite3RegisterBuiltinFunctions(sqlite *db){ 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 }, @@ -650,8 +650,8 @@ void sqlite3RegisterBuiltinFunctions(sqlite *db){ 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 }, diff --git a/src/main.c b/src/main.c index 7d15fdb7aa..00880dc303 100644 --- a/src/main.c +++ b/src/main.c @@ -14,7 +14,7 @@ ** 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" @@ -861,7 +861,7 @@ int sqlite3_create_function( 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; @@ -882,8 +882,8 @@ int sqlite3_create_aggregate( 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; diff --git a/src/md5.c b/src/md5.c index 77f3d49945..571132cb6b 100644 --- a/src/md5.c +++ b/src/md5.c @@ -356,11 +356,11 @@ int Md5_Init(Tcl_Interp *interp){ ** 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); @@ -372,11 +372,11 @@ static void md5step(sqlite_func *context, int argc, sqlite3_value **argv){ } } } -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); diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 1df7ef43b9..978da19e7a 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -12,7 +12,7 @@ ** 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_ @@ -421,9 +421,10 @@ const char *sqlite3_libencoding(void); ** 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. @@ -432,15 +433,15 @@ int sqlite3_create_function( 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 */ ); @@ -464,24 +465,12 @@ int sqlite3_function_type( #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 @@ -1311,6 +1300,7 @@ long long int sqlite3_column_int(sqlite3_stmt*,int); */ 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, @@ -1382,9 +1372,17 @@ long long int sqlite3_value_int(sqlite3_value*); */ 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 diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 49ecb10b66..ad06d83b0d 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -11,7 +11,7 @@ ************************************************************************* ** 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" @@ -464,9 +464,9 @@ struct sqlite { ** 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 */ diff --git a/src/tclsqlite.c b/src/tclsqlite.c index a2b4983bdd..7cb5bf8dae 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -11,7 +11,7 @@ ************************************************************************* ** 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 */ @@ -379,7 +379,7 @@ static int DbCommitHandler(void *cd){ ** 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; diff --git a/src/test1.c b/src/test1.c index 1691187138..23646f9b3d 100644 --- a/src/test1.c +++ b/src/test1.c @@ -13,7 +13,7 @@ ** 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" @@ -307,7 +307,7 @@ static int sqlite_test_close( ** 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; in++; } } -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); } @@ -653,7 +653,7 @@ static int sqlite_abort( ** 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]); diff --git a/src/vdbeInt.h b/src/vdbeInt.h index 0061046877..0cd57ace59 100644 --- a/src/vdbeInt.h +++ b/src/vdbeInt.h @@ -237,7 +237,7 @@ typedef struct Mem Mem; ** 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 */ diff --git a/src/vdbeaux.c b/src/vdbeaux.c index 6ff1d6791e..5da2b95cb3 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -425,7 +425,7 @@ VdbeOp *sqlite3VdbeGetOp(Vdbe *p, int addr){ } /* -** 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){ @@ -439,10 +439,10 @@ 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 ){ @@ -460,10 +460,10 @@ void *sqlite3_aggregate_context(sqlite_func *p, int nByte){ ** 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; } @@ -731,7 +731,7 @@ void sqlite3VdbeAggReset(Agg *pAgg){ for(i=0; inMem; 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;