]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Use the new form of the sqlite3_create_function() API. (CVS 1460)
authordanielk1977 <danielk1977@noemail.net>
Wed, 26 May 2004 06:18:37 +0000 (06:18 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Wed, 26 May 2004 06:18:37 +0000 (06:18 +0000)
FossilOrigin-Name: 0317bef4b0c219ca2888c90553201e53230fb360

manifest
manifest.uuid
src/date.c
src/func.c
src/main.c
src/md5.c
src/select.c
src/sqlite.h.in
src/tclsqlite.c
src/test1.c
src/vdbe.c

index 3ecd3fe9fc50f61606b5859bc7de285b9435caab..6ccebcf07b652bc10d685baa98e5d5176f12c8f1 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Use\sthe\snew\sAPI\scalls\smore\sconsistently.\s(CVS\s1459)
-D 2004-05-26T02:04:57
+C Use\sthe\snew\sform\sof\sthe\ssqlite3_create_function()\sAPI.\s(CVS\s1460)
+D 2004-05-26T06:18:37
 F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a
 F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -28,17 +28,17 @@ F src/btree.c 6db76fbf63efd6008c5e6cb038ea40f94abffcf7
 F src/btree.h b65140b5ae891f30d2a39e64b9f0343225553545
 F src/build.c 35cbeb439b49cca5eb5e8a1de010a5194f4523e8
 F src/copy.c 3c4ee52cc6ab3dea44ddfa8426c19155b2bbf242
-F src/date.c 098aee0a006d6e14dcd8f3ad21733691790c4459
+F src/date.c 1a6a72549e1eb8454b8bacb1734892cdcd78cebb
 F src/delete.c f4a04c0c5c67852a44768c29f408ddda8cfeeab2
 F src/encode.c a876af473d1d636faa3dca51c7571f2e007eea37
 F src/expr.c 5b283e68bd6df365b7c2ad10bd04cc54c2b4b07c
-F src/func.c e67a36ae28ee3495d02261f74989a7bb192658fd
+F src/func.c ddd86cbd438e385123785b67bd6c37a40a3c92bd
 F src/hash.c 440c2f8cb373ee1b4e13a0988489c7cd95d55b6f
 F src/hash.h 762d95f1e567664d1eafc1687de755626be962fb
 F src/insert.c 48bb15bff280767684a0f9ee4ae5973c9504f880
 F src/legacy.c a856d2d5317ed2ac93c2c6cbba7d4faa564a5b20
-F src/main.c c9044ad6896e41aa9bab1957cfd4e9725e5efb01
-F src/md5.c 32ec4d879e9b34d6a597ae8bda684d8e395003f4
+F src/main.c bb49b5a4394e94a56ea25d71bfdfb924bd43b7b6
+F src/md5.c 833671b541a76fc0e62404433c9176706eeacdf0
 F src/os.h ab42f4a7c4c716f26b988e759b6e12085a3bfc67
 F src/os_common.h 744286a27de55c52f1b18921e8d17abbf7fafc0f
 F src/os_mac.c b823874690615ace0dd520d3ad1fe8bfd864b7e0
@@ -53,13 +53,13 @@ F src/parse.y 567718866b94d58a6c7681cc45ba7987771d583a
 F src/pragma.c 02b57adda458874eddc2bd71d56d02e496759a97
 F src/printf.c ef750e8e2398ca7e8b58be991075f08c6a7f0e53
 F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3
-F src/select.c 867cab23c0577d4ac0510c925a85b8e032cfe139
+F src/select.c 42996047868542619a8879bce3b446d92c81ead0
 F src/shell.c ed4d237b3e52a0a42512bfcc53530e46de20c28f
-F src/sqlite.h.in a9d71fd4f781cc61e586b8eabed4d271d88e31c2
+F src/sqlite.h.in c36ab3d4dc1b863ba0cf79905210180b8059a839
 F src/sqliteInt.h 6559811caeae0d1855e0b973e363a8c5141e566b
 F src/table.c af14284fa36c8d41f6829e3f2819dce07d3e2de2
-F src/tclsqlite.c a125a8b99d427e132cb6e728cf9310f6554b410b
-F src/test1.c a9f40903f6a14150ca1201da492d4f5a652a1c0c
+F src/tclsqlite.c 2700a35f494e8fc5ad2742bcae09d2cb66a295ab
+F src/test1.c d23bf61826665d1c6df0d1e565cdf0b7a065e6ce
 F src/test2.c 6195a1ca2c8d0d2d93644e86da3289b403486872
 F src/test3.c 5e4a6d596f982f6f47a5f9f75ede9b4a3b739968
 F src/test4.c 014478492bddb3f9b4a3151b05f9ac708fe279fb
@@ -70,7 +70,7 @@ F src/update.c 2b5ec85fa19020686ed2fc4a3fc43cbcefbfdfa7
 F src/utf.c 1d38da85bffb928fb0d9f301e7db913a6df486ce
 F src/util.c 4c0adcbc9ce6678dd046931253e45d623c6d279f
 F src/vacuum.c 8734f89742f246abd91dbd3e087fc153bddbfbad
-F src/vdbe.c 0c10b0036444f99eb625c6a003d007e3043187ef
+F src/vdbe.c 4db41e7cc51368614ce8bf428aee1400e471ef1b
 F src/vdbe.h ebd59ee7a988d39c58b27149593f09a432ad1410
 F src/vdbeInt.h c8706615ad49c7a5292daa31425dd1b0b24b3b9b
 F src/vdbeaux.c a792ac602eb81c15ebdea64931bd3fad85b025f2
@@ -203,7 +203,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
 F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
 F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
 F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
-P e83138250ce0a8caacbd1822eec2e06796d2f5f2
-R 2d9cfc7b0183db7d18c182936822729e
+P 17e7db488dac6b30d174f2272edf1046c2bb9990
+R 113d8544ffd910b3c5420bd788cff980
 U danielk1977
-Z a8211c11f21dbceb0c77c5b2788c41e4
+Z bc1bc018e744dabad71dcba7ffcd3363
index 1201a7037f1a088a94035192ada7a0d1da89fad1..7a699cdb7b6456b71b49ee8084ce46f9e6e1ebbb 100644 (file)
@@ -1 +1 @@
-17e7db488dac6b30d174f2272edf1046c2bb9990
\ No newline at end of file
+0317bef4b0c219ca2888c90553201e53230fb360
\ No newline at end of file
index 4eb2aba5ce31ed52a5a10982852d3557af926e79..935b08690964072b00a88331d25b532bed2d24d1 100644 (file)
@@ -16,7 +16,7 @@
 ** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
 ** All other code has file scope.
 **
-** $Id: date.c,v 1.23 2004/05/25 12:05:57 danielk1977 Exp $
+** $Id: date.c,v 1.24 2004/05/26 06:18:37 danielk1977 Exp $
 **
 ** NOTES:
 **
@@ -866,8 +866,8 @@ void sqlite3RegisterDateTimeFunctions(sqlite *db){
   int i;
 
   for(i=0; i<sizeof(aFuncs)/sizeof(aFuncs[0]); i++){
-    sqlite3_create_function(db, aFuncs[i].zName,
-           aFuncs[i].nArg, aFuncs[i].xFunc, 0);
+    sqlite3_create_function(db, aFuncs[i].zName, aFuncs[i].nArg, 0, 0, 0,
+        aFuncs[i].xFunc, 0, 0);
     if( aFuncs[i].xFunc ){
       sqlite3_function_type(db, aFuncs[i].zName, aFuncs[i].dataType);
     }
index 5e63c3aa02abefbad7b2848ac9fa1095585e6697..65789a6fbc1aee01be800aaf24e484f94160874f 100644 (file)
@@ -16,7 +16,7 @@
 ** sqliteRegisterBuildinFunctions() found at the bottom of the file.
 ** All other code has file scope.
 **
-** $Id: func.c,v 1.55 2004/05/25 12:05:57 danielk1977 Exp $
+** $Id: func.c,v 1.56 2004/05/26 06:18:37 danielk1977 Exp $
 */
 #include <ctype.h>
 #include <math.h>
@@ -668,16 +668,16 @@ void sqlite3RegisterBuiltinFunctions(sqlite *db){
 
   for(i=0; i<sizeof(aFuncs)/sizeof(aFuncs[0]); i++){
     void *pArg = aFuncs[i].argType==2 ? (void*)(-1) : db;
-    sqlite3_create_function(db, aFuncs[i].zName,
-           aFuncs[i].nArg, aFuncs[i].xFunc, pArg);
+    sqlite3_create_function(db, aFuncs[i].zName, aFuncs[i].nArg, 0, 0,
+        pArg, aFuncs[i].xFunc, 0, 0);
     if( aFuncs[i].xFunc ){
       sqlite3_function_type(db, aFuncs[i].zName, aFuncs[i].dataType);
     }
   }
   for(i=0; i<sizeof(aAggs)/sizeof(aAggs[0]); i++){
     void *pArg = aAggs[i].argType==2 ? (void*)(-1) : db;
-    sqlite3_create_aggregate(db, aAggs[i].zName,
-           aAggs[i].nArg, aAggs[i].xStep, aAggs[i].xFinalize, pArg);
+    sqlite3_create_function(db, aAggs[i].zName, aAggs[i].nArg, 0, 0, pArg,
+        0, aAggs[i].xStep, aAggs[i].xFinalize);
     sqlite3_function_type(db, aAggs[i].zName, aAggs[i].dataType);
   }
 
index 79525bb87a83bfcb5de3d31e7e77961c04804c83..d2479aba598f23ec7caaa186d3c69935da80ff05 100644 (file)
@@ -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.190 2004/05/26 02:04:57 danielk1977 Exp $
+** $Id: main.c,v 1.191 2004/05/26 06:18:37 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include "os.h"
@@ -641,62 +641,65 @@ void sqlite3_freemem(void *p){ free(p); }
 const char *sqlite3_libversion(void){ return sqlite3_version; }
 const char *sqlite3_libencoding(void){ return sqlite3_encoding; }
 
-/*
-** Create new user-defined functions.  The sqlite3_create_function()
-** routine creates a regular function and sqlite3_create_aggregate()
-** creates an aggregate function.
-**
-** Passing a NULL xFunc argument or NULL xStep and xFinalize arguments
-** disables the function.  Calling sqlite3_create_function() with the
-** same name and number of arguments as a prior call to
-** sqlite3_create_aggregate() disables the prior call to
-** sqlite3_create_aggregate(), and vice versa.
-**
-** If nArg is -1 it means that this function will accept any number
-** of arguments, including 0.  The maximum allowed value of nArg is 127.
-*/
 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)(sqlite3_context*,int,sqlite3_value **), /* The implementation */
-  void *pUserData      /* User data */
+  sqlite3 *db,
+  const char *zFunctionName,
+  int nArg,
+  int eTextRep,
+  int iCollateArg,
+  void *pUserData,
+  void (*xFunc)(sqlite3_context*,int,sqlite3_value **),
+  void (*xStep)(sqlite3_context*,int,sqlite3_value **),
+  void (*xFinal)(sqlite3_context*)
 ){
   FuncDef *p;
   int nName;
-  if( db==0 || zName==0 || sqlite3SafetyCheck(db) ) return 1;
-  if( nArg<-1 || nArg>127 ) return 1;
-  nName = strlen(zName);
-  if( nName>255 ) return 1;
-  p = sqlite3FindFunction(db, zName, nName, nArg, 1);
+
+  if( db==0 || zFunctionName==0 || sqlite3SafetyCheck(db) ){
+    return SQLITE_ERROR;
+  }
+  if( (xFunc && (xFinal || xStep)) || (!xFunc && (!xFinal && !xStep)) ){
+    return SQLITE_ERROR;
+  }
+  if( nArg<-1 || nArg>127 ){
+    return SQLITE_ERROR;
+  }
+
+  nName = strlen(zFunctionName);
+  if( nName>255 ){
+    return SQLITE_ERROR;
+  }
+
+  p = sqlite3FindFunction(db, zFunctionName, nName, nArg, 1);
   if( p==0 ) return 1;
   p->xFunc = xFunc;
-  p->xStep = 0;
-  p->xFinalize = 0;
+  p->xStep = xStep;
+  p->xFinalize = xFinal;
   p->pUserData = pUserData;
-  return 0;
+  return SQLITE_OK;
 }
-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)(sqlite3_context*,int,sqlite3_value**), /* The step function */
-  void (*xFinalize)(sqlite3_context*),              /* The finalizer */
-  void *pUserData      /* User data */
+
+int sqlite3_create_function16(
+  sqlite3 *db,
+  const void *zFunctionName,
+  int nArg,
+  int eTextRep,
+  int iCollateArg,
+  void *pUserData,
+  void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
+  void (*xStep)(sqlite3_context*,int,sqlite3_value**),
+  void (*xFinal)(sqlite3_context*)
 ){
-  FuncDef *p;
-  int nName;
-  if( db==0 || zName==0 || sqlite3SafetyCheck(db) ) return 1;
-  if( nArg<-1 || nArg>127 ) return 1;
-  nName = strlen(zName);
-  if( nName>255 ) return 1;
-  p = sqlite3FindFunction(db, zName, nName, nArg, 1);
-  if( p==0 ) return 1;
-  p->xFunc = 0;
-  p->xStep = xStep;
-  p->xFinalize = xFinalize;
-  p->pUserData = pUserData;
-  return 0;
+  int rc;
+  char *zFunctionName8;
+  zFunctionName8 = sqlite3utf16to8(zFunctionName, -1, SQLITE3_BIGENDIAN);
+  if( !zFunctionName8 ){
+    return SQLITE_NOMEM;
+  }
+  rc = sqlite3_create_function(db, zFunctionName8, nArg, eTextRep, 
+      iCollateArg, pUserData, xFunc, xStep, xFinal);
+  sqliteFree(zFunctionName8);
+  return rc;
 }
 
 /*
index 571132cb6bdd0a256259f61f650db38c4a8d238f..ee5cb552e890da0ffaefea67ac2c23bd44c687e7 100644 (file)
--- a/src/md5.c
+++ b/src/md5.c
@@ -382,7 +382,7 @@ static void md5finalize(sqlite3_context *context){
   sqlite3_result_text(context, zBuf, -1, 1);
 }
 void Md5_Register(sqlite *db){
-  sqlite3_create_aggregate(db, "md5sum", -1, md5step, md5finalize, 0);
+  sqlite3_create_function(db, "md5sum", -1, 0, 0, 0, 0, md5step, md5finalize);
 }
 
 
index f9bd39fe1689ebb2182497cf63158ec76031b2d3..52c35ebce5d905c5920c3556a8b5a77a264b511f 100644 (file)
@@ -12,7 +12,7 @@
 ** This file contains C code routines that are called by the parser
 ** to handle SELECT statements in SQLite.
 **
-** $Id: select.c,v 1.175 2004/05/25 23:35:19 danielk1977 Exp $
+** $Id: select.c,v 1.176 2004/05/26 06:18:38 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 
@@ -1272,9 +1272,9 @@ static int multiSelect(
   int rc = SQLITE_OK;  /* Success code from a subroutine */
   Select *pPrior;     /* Another SELECT immediately to our left */
   Vdbe *v;            /* Generate code to this VDBE */
+#if 0 /* NOT USED */
   char *affStr = 0;
 
-#if 0 /* NOT USED */
   if( !aff ){
     int len;
     rc = fillInColumnList(pParse, p);
index 3d8ee52387cea72904de1c52ee1c51637dc52ce8..a1d8f7649939530056b7a5228fa37886891f1174 100644 (file)
@@ -12,7 +12,7 @@
 ** This header file defines the interface that the SQLite library
 ** presents to client programs.
 **
-** @(#) $Id: sqlite.h.in,v 1.79 2004/05/26 02:04:57 danielk1977 Exp $
+** @(#) $Id: sqlite.h.in,v 1.80 2004/05/26 06:18:38 danielk1977 Exp $
 */
 #ifndef _SQLITE_H_
 #define _SQLITE_H_
@@ -57,6 +57,8 @@ extern const char sqlite3_encoding[];
 ** following opaque structure.
 */
 typedef struct sqlite sqlite;
+typedef struct sqlite sqlite3;
+
 
 /*
 ** A function to close the database.
@@ -417,61 +419,6 @@ void sqlite3_freemem(void *p);
 const char *sqlite3_libversion(void);
 const char *sqlite3_libencoding(void);
 
-/*
-** A pointer to the following structure is used to communicate with
-** the implementations of user-defined functions.
-*/
-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.
-*/
-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)(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)(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 */
-);
-
-/*
-** Use the following routine to define the datatype returned by a
-** user-defined function.  The second argument can be one of the
-** constants SQLITE_NUMERIC, SQLITE_TEXT, or SQLITE_ARGS or it
-** can be an integer greater than or equal to zero.  When the datatype
-** parameter is non-negative, the type of the result will be the
-** same as the datatype-th argument.  If datatype==SQLITE_NUMERIC
-** then the result is always numeric.  If datatype==SQLITE_TEXT then
-** the result is always text.  If datatype==SQLITE_ARGS then the result
-** is numeric if any argument is numeric and is text otherwise.
-*/
-int sqlite3_function_type(
-  sqlite *db,               /* The database there the function is registered */
-  const char *zName,        /* Name of the function */
-  int datatype              /* The datatype for this function */
-);
-#define SQLITE_NUMERIC     (-1)
-#define SQLITE_TEXT        (-2)
-#define SQLITE_ARGS        (-3)
-
-/*
-** 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(sqlite3_context*);
-
 /*
 ** This routine registers a callback with the SQLite library.  The
 ** callback is invoked (at compile-time, not at run-time) for each
@@ -647,123 +594,47 @@ int sqlite_encode_binary(const unsigned char *in, int n, unsigned char *out);
 */
 int sqlite_decode_binary(const unsigned char *in, unsigned char *out);
 
-
-typedef sqlite sqlite3;
-
-typedef struct sqlite3_stmt sqlite3_stmt;
-
-/*
-** This routine is used to bind a 32-bit integer value to a variable
-** in an SQL statement compiled by sqlite3_prepare(). See comments for
-** sqlite3_prepare() for more details on SQL statement variables.
-**
-** The first argument is a pointer to an SQL statement previously
-** obtained from a call to sqlite3_prepare(). The second parameter "i"
-** determines the parameter to bind the value "iValue" to.
-*/
-int sqlite3_bind_int32(sqlite3_stmt*, int i, int iValue);
-
 /*
-** This routine is used to bind a 64-bit integer value to a variable
-** in an SQL statement compiled by sqlite3_prepare(). See comments for
-** sqlite3_prepare() for more details on SQL statement variables.
-**
-** The first argument is a pointer to an SQL statement previously
-** obtained from a call to sqlite3_prepare(). The second parameter "i"
-** determines the parameter to bind the value "iValue" to.
-*/
-int sqlite3_bind_int64(sqlite3_stmt*, int i, long long int iValue);
-
-/*
-** This routine is used to bind a real (floating point) value to a variable
-** in an SQL statement compiled by sqlite3_prepare(). See comments for
-** sqlite3_prepare() for more details on SQL statement variables.
-**
-** The first argument is a pointer to an SQL statement previously obtained
-** from a call to sqlite3_prepare(). The second parameter "i" determines
-** the parameter to bind the value "iValue" to. Internally, SQLite will
-** manipulate the value as a 64-bit IEEE float.
-*/
-int sqlite3_bind_double(sqlite3_stmt*, int i, double iValue);
-
-/*
-** This routine is used to bind a NULL value to a variable in an SQL
-** statement compiled by sqlite3_prepare(). See comments for
-** sqlite3_prepare() for more details on SQL statement variables.
-**
-** The first argument is a pointer to an SQL statement previously obtained
-** from a call to sqlite3_prepare(). The second parameter "i" determines
-** the parameter to bind the NULL value to.
-*/
-int sqlite3_bind_null(sqlite3_stmt*, int i);
-
-/*
-** This routine is used to bind a UTF-8 string value to a variable in an
-** SQL statement compiled by sqlite3_prepare(). See comments for
-** sqlite3_prepare() for more details on SQL statement variables.
-**
-** The first argument is a pointer to an SQL statement previously obtained
-** from a call to sqlite3_prepare(). The second parameter "i" determines
-** the parameter to bind the value to. Parameter three "z" is a pointer
-** to the UTF-8 string. 
-**
-** The fourth "n" parameter is the number of bytes (not characters) in the
-** string pointed to by "z". "n" may or may not include any nul terminator
-** character. If "n" is less than zero, then SQLite assumes that "z" is
-** a nul terminated string.
-**
-** If paramater "eCopy" is true, then SQLite makes a copy of the string
-** pointed to by "z". If "eCopy" is false, then SQLite stores a pointer to
-** the original string data. In this case the caller must ensure that the
-** string data remains stable until after the SQL statement has been
-** finalised or another value bound to variable "i".
-*/
-int sqlite3_bind_text(sqlite3_stmt*, int i, const char* z, int n, int eCopy);
-
-/*
-** This routine is used to bind a UTF-16 string value to a variable in an
-** SQL statement compiled by sqlite3_prepare(). See comments for
-** sqlite3_prepare() for more details on SQL statement variables.
-**
-** The first argument is a pointer to an SQL statement previously obtained
-** from a call to sqlite3_prepare(). The second parameter "i" determines
-** the parameter to bind the value to. Parameter three "z" is a pointer to
-** the UTF-16 string. If the string does not begin with a byte-order-mark,
-** it is assumed to be encoded in the native byte order of the machine.
+** Open the sqlite database file "filename", where "filename" is UTF-8
+** encoded. An sqlite3* handle is returned in *ppDb, even if an error 
+** occurs. If the database is opened (or created) successfully, then 
+** SQLITE_OK is returned. Otherwise an error code is returned and the
+** sqlite3_errmsg() function may be used to obtain an English language
+** explanation of the error.
 **
-** The fourth "n" parameter is the number of bytes (not characters) in the
-** string pointed to by "z". "n" may or may not include any nul terminator
-** character. If "n" is less than zero, then SQLite assumes that "z" is
-** terminated by a pair of 0x00 characters.
+** If the database file does not exist, then a new database is created
+** using UTF-8 text encoding.
 **
-** If paramater "eCopy" is true, then SQLite makes a copy of the string
-** pointed to by "z". If "eCopy" is false, then SQLite stores a pointer to
-** the original string data. In this case the caller must ensure that the
-** string data remains stable until after the SQL statement has been
-** finalised or another value bound to variable "i".
+** Whether or not an error occurs when it is opened, resources associated
+** with the sqlite3* handle should be released by passing it to
+** sqlite3_close() when it is no longer required.
 */
-int sqlite3_bind_text16(sqlite3_stmt*, int i, const void *z, int, int eCopy);
+int sqlite3_open(
+  const char *filename,   /* Database filename (UTF-8) */
+  sqlite3 **ppDb,         /* OUT: SQLite db handle */
+  const char **args       /* Null terminated array of option strings */
+);
 
 /*
-** This routine is used to bind a blob value to a variable in an
-** SQL statement compiled by sqlite3_prepare(). See comments for
-** sqlite3_prepare() for more details on SQL statement variables.
-**
-** The first argument is a pointer to an SQL statement previously obtained
-** from a call to sqlite3_prepare(). The second parameter "i" determines
-** the parameter to bind the value to. Parameter three "z" is a pointer to
-** the blob of data.
+** Open the sqlite database file "filename", where "filename" is native
+** byte order UTF-16 encoded. An sqlite3* handle is returned in *ppDb, even
+** if an error occurs. If the database is opened (or created) successfully,
+** then SQLITE_OK is returned. Otherwise an error code is returned and the
+** sqlite3_errmsg() function may be used to obtain an English language
+** explanation of the error.
 **
-** The fourth "n" parameter is the number of bytes in the blob pointed to
-** by "z". "n" may not be less than zero.
+** If the database file does not exist, then a new database is created
+** using UTF-16 text encoding in the machines native byte order.
 **
-** If paramater "eCopy" is true, then SQLite makes a copy of the blob
-** pointed to by "z". If "eCopy" is false, then SQLite stores a pointer to
-** the original blob data. In this case the caller must ensure that the
-** blob data remains stable until after the SQL statement has been
-** finalised or another value bound to variable "i".
+** Whether or not an error occurs when it is opened, resources associated
+** with the sqlite3* handle should be released by passing it to
+** sqlite3_close() when it is no longer required.
 */
-int sqlite3_bind_blob(sqlite3_stmt*, int i, const void *z, int n, int eCopy);
+int sqlite3_open16(
+  const void *filename,   /* Database filename (UTF-16) */
+  sqlite3 **ppDb,         /* OUT: SQLite db handle */
+  const char **args       /* Null terminated array of option strings */
+);
 
 /*
 ** Return the error code for the most recent sqlite3_* API call associated
@@ -772,24 +643,9 @@ int sqlite3_bind_blob(sqlite3_stmt*, int i, const void *z, int n, int eCopy);
 **
 ** Calls to many sqlite3_* functions set the error code and string returned
 ** by sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16()
-** (overwriting the previous values). A complete list of functions that set
-** the error code and string returned by these functions follows. Note that
-** calls to sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16()
-** themselves do not affect the results of future invocations.
-**
-** sqlite3_bind_int32
-** sqlite3_bind_int64
-** sqlite3_bind_double
-** sqlite3_bind_null
-** sqlite3_bind_text
-** sqlite3_bind_text16
-** sqlite3_bind_blob
-** sqlite3_open
-** sqlite3_open16
-** sqlite3_prepare
-** sqlite3_prepare16
-** sqlite3_step
-** sqlite3_finalize
+** (overwriting the previous values). Note that calls to sqlite3_errcode(),
+** sqlite3_errmsg() and sqlite3_errmsg16() themselves do not affect the
+** results of future invocations.
 **
 ** Assuming no other intervening sqlite3_* API calls are made, the error
 ** code returned by this function is associated with the same error as
@@ -817,14 +673,25 @@ const char *sqlite3_errmsg(sqlite3*);
 */
 const void *sqlite3_errmsg16(sqlite3*);
 
+/*
+** An instance of the following opaque structure is used to represent
+** a compiled SQL statment.
+*/
+typedef struct sqlite3_stmt sqlite3_stmt;
+
 /*
 ** To execute an SQL query, it must first be compiled into a byte-code
-** program using this routine. The first parameter "db" is an SQLite
-** database handle. The second parameter "zSql" is the statement
-** to be compiled, encoded as UTF-8 text. If the next parameter, "nBytes",
-** is less than zero, then zSql is read up to the first nul terminator.
-** If "nBytes" is not less than zero, then it is the length of the
-** string zSql in bytes (not characters).
+** program using one of the following routines. The only difference between
+** them is that the second argument, specifying the SQL statement to
+** compile, is assumed to be encoded in UTF-8 for the sqlite3_prepare()
+** function and UTF-16 for sqlite3_prepare16().
+**
+** The first parameter "db" is an SQLite database handle. The second
+** parameter "zSql" is the statement to be compiled, encoded as either
+** UTF-8 or UTF-16 (see above). If the next parameter, "nBytes", is less
+** than zero, then zSql is read up to the first nul terminator.  If
+** "nBytes" is not less than zero, then it is the length of the string zSql
+** in bytes (not characters).
 **
 ** *pzTail is made to point to the first byte past the end of the first
 ** SQL statement in zSql.  This routine only compiles the first statement
@@ -836,7 +703,6 @@ const void *sqlite3_errmsg16(sqlite3*);
 ** empty string or a comment) then *ppStmt is set to NULL.
 **
 ** On success, SQLITE_OK is returned.  Otherwise an error code is returned.
-** 
 */
 int sqlite3_prepare(
   sqlite3 *db,            /* Database handle */
@@ -845,28 +711,6 @@ int sqlite3_prepare(
   sqlite3_stmt **ppStmt,  /* OUT: Statement handle */
   const char **pzTail     /* OUT: Pointer to unused portion of zSql */
 );
-
-/*
-** To execute an SQL query, it must first be compiled into a byte-code
-** program using this routine. The first parameter "db" is an SQLite
-** database handle. The second parameter "zSql" is the statement
-** to be compiled, encoded as UTF-16 text. If the next parameter, "nBytes",
-** is less than zero, then zSql is read up to the first pair of successive
-** 0x00 bytes.  If "nBytes" is not less than zero, then it is the length of
-** the string zSql in bytes (not characters).
-**
-** *pzTail is made to point to the first byte past the end of the first
-** SQL statement in zSql.  This routine only compiles the first statement
-** in zSql, so *pzTail is left pointing to what remains uncompiled.
-**
-** *ppStmt is left pointing to a compiled SQL statement that can be
-** executed using sqlite3_step().  Or if there is an error, *ppStmt may be
-** set to NULL.  If the input text contained no SQL (if the input is and
-** empty string or a comment) then *ppStmt is set to NULL.
-**
-** On success, SQLITE_OK is returned.  Otherwise an error code is returned.
-** 
-*/
 int sqlite3_prepare16(
   sqlite3 *db,            /* Database handle */
   const void *zSql,       /* SQL statement, UTF-16 encoded */
@@ -936,6 +780,119 @@ const char *sqlite3_column_decltype(sqlite3_stmt *, int i);
 */
 const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
 
+/*
+** This routine is used to bind a 32-bit integer value to a variable
+** in an SQL statement compiled by sqlite3_prepare(). See comments for
+** sqlite3_prepare() for more details on SQL statement variables.
+**
+** The first argument is a pointer to an SQL statement previously
+** obtained from a call to sqlite3_prepare(). The second parameter "i"
+** determines the parameter to bind the value "iValue" to.
+*/
+int sqlite3_bind_int32(sqlite3_stmt*, int i, int iValue);
+
+/*
+** This routine is used to bind a 64-bit integer value to a variable
+** in an SQL statement compiled by sqlite3_prepare(). See comments for
+** sqlite3_prepare() for more details on SQL statement variables.
+**
+** The first argument is a pointer to an SQL statement previously
+** obtained from a call to sqlite3_prepare(). The second parameter "i"
+** determines the parameter to bind the value "iValue" to.
+*/
+int sqlite3_bind_int64(sqlite3_stmt*, int i, long long int iValue);
+
+/*
+** This routine is used to bind a real (floating point) value to a variable
+** in an SQL statement compiled by sqlite3_prepare(). See comments for
+** sqlite3_prepare() for more details on SQL statement variables.
+**
+** The first argument is a pointer to an SQL statement previously obtained
+** from a call to sqlite3_prepare(). The second parameter "i" determines
+** the parameter to bind the value "iValue" to. Internally, SQLite will
+** manipulate the value as a 64-bit IEEE float.
+*/
+int sqlite3_bind_double(sqlite3_stmt*, int i, double iValue);
+
+/*
+** This routine is used to bind a NULL value to a variable in an SQL
+** statement compiled by sqlite3_prepare(). See comments for
+** sqlite3_prepare() for more details on SQL statement variables.
+**
+** The first argument is a pointer to an SQL statement previously obtained
+** from a call to sqlite3_prepare(). The second parameter "i" determines
+** the parameter to bind the NULL value to.
+*/
+int sqlite3_bind_null(sqlite3_stmt*, int i);
+
+/*
+** This routine is used to bind a UTF-8 string value to a variable in an
+** SQL statement compiled by sqlite3_prepare(). See comments for
+** sqlite3_prepare() for more details on SQL statement variables.
+**
+** The first argument is a pointer to an SQL statement previously obtained
+** from a call to sqlite3_prepare(). The second parameter "i" determines
+** the parameter to bind the value to. Parameter three "z" is a pointer
+** to the UTF-8 string. 
+**
+** The fourth "n" parameter is the number of bytes (not characters) in the
+** string pointed to by "z". "n" may or may not include any nul terminator
+** character. If "n" is less than zero, then SQLite assumes that "z" is
+** a nul terminated string.
+**
+** If paramater "eCopy" is true, then SQLite makes a copy of the string
+** pointed to by "z". If "eCopy" is false, then SQLite stores a pointer to
+** the original string data. In this case the caller must ensure that the
+** string data remains stable until after the SQL statement has been
+** finalised or another value bound to variable "i".
+*/
+int sqlite3_bind_text(sqlite3_stmt*, int i, const char* z, int n, int eCopy);
+
+/*
+** This routine is used to bind a UTF-16 string value to a variable in an
+** SQL statement compiled by sqlite3_prepare(). See comments for
+** sqlite3_prepare() for more details on SQL statement variables.
+**
+** The first argument is a pointer to an SQL statement previously obtained
+** from a call to sqlite3_prepare(). The second parameter "i" determines
+** the parameter to bind the value to. Parameter three "z" is a pointer to
+** the UTF-16 string. If the string does not begin with a byte-order-mark,
+** it is assumed to be encoded in the native byte order of the machine.
+**
+** The fourth "n" parameter is the number of bytes (not characters) in the
+** string pointed to by "z". "n" may or may not include any nul terminator
+** character. If "n" is less than zero, then SQLite assumes that "z" is
+** terminated by a pair of 0x00 characters.
+**
+** If paramater "eCopy" is true, then SQLite makes a copy of the string
+** pointed to by "z". If "eCopy" is false, then SQLite stores a pointer to
+** the original string data. In this case the caller must ensure that the
+** string data remains stable until after the SQL statement has been
+** finalised or another value bound to variable "i".
+*/
+int sqlite3_bind_text16(sqlite3_stmt*, int i, const void *z, int, int eCopy);
+
+/*
+** This routine is used to bind a blob value to a variable in an
+** SQL statement compiled by sqlite3_prepare(). See comments for
+** sqlite3_prepare() for more details on SQL statement variables.
+**
+** The first argument is a pointer to an SQL statement previously obtained
+** from a call to sqlite3_prepare(). The second parameter "i" determines
+** the parameter to bind the value to. Parameter three "z" is a pointer to
+** the blob of data.
+**
+** The fourth "n" parameter is the number of bytes in the blob pointed to
+** by "z". "n" may not be less than zero.
+**
+** If paramater "eCopy" is true, then SQLite makes a copy of the blob
+** pointed to by "z". If "eCopy" is false, then SQLite stores a pointer to
+** the original blob data. In this case the caller must ensure that the
+** blob data remains stable until after the SQL statement has been
+** finalised or another value bound to variable "i".
+*/
+int sqlite3_bind_blob(sqlite3_stmt*, int i, const void *z, int n, int eCopy);
+
 /* 
 ** After an SQL query has been compiled with a call to either
 ** sqlite3_prepare() or sqlite3_prepare16(), then this function must be
@@ -970,74 +927,6 @@ const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
 */
 int sqlite3_step(sqlite3_stmt*);
 
-
-/*
-** The sqlite3_finalize() function is called to delete a compiled
-** SQL statement obtained by a previous call to sqlite3_prepare()
-** or sqlite3_prepare16(). If the statement was executed successfully, or
-** not executed at all, then SQLITE_OK is returned. If execution of the
-** statement failed then an error code is returned. 
-**
-** This routine can be called at any point during the execution of the
-** virtual machine.  If the virtual machine has not completed execution
-** when this routine is called, that is like encountering an error or
-** an interrupt.  (See sqlite3_interrupt().)  Incomplete updates may be
-** rolled back and transactions cancelled,  depending on the circumstances,
-** and the result code returned will be SQLITE_ABORT.
-*/
-int sqlite3_finalize(sqlite3_stmt *pStmt);
-
-/*
-** The sqlite3_reset() function is called to reset a compiled SQL
-** statement obtained by a previous call to sqlite3_prepare() or
-** sqlite3_prepare16() back to it's initial state, ready to be re-executed.
-** Any SQL statement variables that had values bound to them using
-** the sqlite3_bind_*() API retain their values.
-*/
-int sqlite3_reset(sqlite3_stmt *pStmt);
-
-/*
-** Open the sqlite database file "filename", where "filename" is UTF-8
-** encoded. An sqlite3* handle is returned in *ppDb, even if an error 
-** occurs. If the database is opened (or created) successfully, then 
-** SQLITE_OK is returned. Otherwise an error code is returned and the
-** sqlite3_errmsg() function may be used to obtain an English language
-** explanation of the error.
-**
-** If the database file does not exist, then a new database is created
-** using UTF-8 text encoding.
-**
-** Whether or not an error occurs when it is opened, resources associated
-** with the sqlite3* handle should be released by passing it to
-** sqlite3_close() when it is no longer required.
-*/
-int sqlite3_open(
-  const char *filename,   /* Database filename (UTF-8) */
-  sqlite3 **ppDb,         /* OUT: SQLite db handle */
-  const char **args       /* Null terminated array of option strings */
-);
-
-/*
-** Open the sqlite database file "filename", where "filename" is native
-** byte order UTF-16 encoded. An sqlite3* handle is returned in *ppDb, even
-** if an error occurs. If the database is opened (or created) successfully,
-** then SQLITE_OK is returned. Otherwise an error code is returned and the
-** sqlite3_errmsg() function may be used to obtain an English language
-** explanation of the error.
-**
-** If the database file does not exist, then a new database is created
-** using UTF-16 text encoding in the machines native byte order.
-**
-** Whether or not an error occurs when it is opened, resources associated
-** with the sqlite3* handle should be released by passing it to
-** sqlite3_close() when it is no longer required.
-*/
-int sqlite3_open16(
-  const void *filename,   /* Database filename (UTF-16) */
-  sqlite3 **ppDb,         /* OUT: SQLite db handle */
-  const char **args       /* Null terminated array of option strings */
-);
-
 /*
 ** Return the number of values in the current row of the result set.
 **
@@ -1152,6 +1041,116 @@ long long int sqlite3_column_int(sqlite3_stmt*,int);
 */
 double sqlite3_column_float(sqlite3_stmt*,int);
 
+/*
+** The sqlite3_finalize() function is called to delete a compiled
+** SQL statement obtained by a previous call to sqlite3_prepare()
+** or sqlite3_prepare16(). If the statement was executed successfully, or
+** not executed at all, then SQLITE_OK is returned. If execution of the
+** statement failed then an error code is returned. 
+**
+** This routine can be called at any point during the execution of the
+** virtual machine.  If the virtual machine has not completed execution
+** when this routine is called, that is like encountering an error or
+** an interrupt.  (See sqlite3_interrupt().)  Incomplete updates may be
+** rolled back and transactions cancelled,  depending on the circumstances,
+** and the result code returned will be SQLITE_ABORT.
+*/
+int sqlite3_finalize(sqlite3_stmt *pStmt);
+
+/*
+** The sqlite3_reset() function is called to reset a compiled SQL
+** statement obtained by a previous call to sqlite3_prepare() or
+** sqlite3_prepare16() back to it's initial state, ready to be re-executed.
+** Any SQL statement variables that had values bound to them using
+** the sqlite3_bind_*() API retain their values.
+*/
+int sqlite3_reset(sqlite3_stmt *pStmt);
+
+/*
+** Pointers to the following two opaque structures are used to communicate
+** with the implementations of user-defined functions.
+*/
+typedef struct sqlite3_context sqlite3_context;
+typedef struct Mem sqlite3_value;
+
+/*
+** The following two functions are used to add user functions or aggregates
+** implemented in C to the SQL langauge interpreted by SQLite. The
+** difference only between the two is that the second parameter, the
+** name of the (scalar) function or aggregate, is encoded in UTF-8 for
+** sqlite3_create_function() and UTF-16 for sqlite3_create_function16().
+**
+** The first argument is the database handle that the new function or
+** aggregate is to be added to. If a single program uses more than one
+** database handle internally, then user functions or aggregates must 
+** be added individually to each database handle with which they will be
+** used.
+**
+** The third parameter is the number of arguments that the function or
+** aggregate takes. If this parameter is negative, then the function or
+** aggregate may take any number of arguments.
+**
+** The seventh, eighth and ninth parameters, xFunc, xStep and xFinal, are
+** pointers to user implemented C functions that implement the user
+** function or aggregate. A scalar function requires an implementation of
+** the xFunc callback only, NULL pointers should be passed as the xStep
+** and xFinal parameters. An aggregate function requires an implementation
+** of xStep and xFinal, but NULL should be passed for xFunc. To delete an
+** existing user function or aggregate, pass NULL for all three function
+** callback. Specifying an inconstent set of callback values, such as an
+** xFunc and an xFinal, or an xStep but no xFinal, SQLITE_ERROR is
+** returned.
+*/
+int sqlite3_create_function(
+  sqlite3 *,
+  const char *zFunctionName,
+  int nArg,
+  int eTextRep,
+  int iCollateArg,
+  void*,
+  void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
+  void (*xStep)(sqlite3_context*,int,sqlite3_value**),
+  void (*xFinal)(sqlite3_context*)
+);
+int sqlite3_create_function16(
+  sqlite3*,
+  const void *zFunctionName,
+  int nArg,
+  int eTextRep,
+  int iCollateArg,
+  void*,
+  void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
+  void (*xStep)(sqlite3_context*,int,sqlite3_value**),
+  void (*xFinal)(sqlite3_context*)
+);
+
+/*
+** Use the following routine to define the datatype returned by a
+** user-defined function.  The second argument can be one of the
+** constants SQLITE_NUMERIC, SQLITE_TEXT, or SQLITE_ARGS or it
+** can be an integer greater than or equal to zero.  When the datatype
+** parameter is non-negative, the type of the result will be the
+** same as the datatype-th argument.  If datatype==SQLITE_NUMERIC
+** then the result is always numeric.  If datatype==SQLITE_TEXT then
+** the result is always text.  If datatype==SQLITE_ARGS then the result
+** is numeric if any argument is numeric and is text otherwise.
+*/
+int sqlite3_function_type(
+  sqlite *db,               /* The database there the function is registered */
+  const char *zName,        /* Name of the function */
+  int datatype              /* The datatype for this function */
+);
+#define SQLITE_NUMERIC     (-1)
+#define SQLITE_TEXT        (-2)
+#define SQLITE_ARGS        (-3)
+
+/*
+** 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(sqlite3_context*);
+
 
 /*
 ** Return the type of the sqlite3_value* passed as the first argument. 
index 0b9437ddaa71d63a33a871a63709f86a3e49eeb4..877ee1056e0629b71efdd15d3de082b9e6ce12fa 100644 (file)
@@ -11,7 +11,7 @@
 *************************************************************************
 ** A TCL Interface to SQLite
 **
-** $Id: tclsqlite.c,v 1.70 2004/05/26 02:04:57 danielk1977 Exp $
+** $Id: tclsqlite.c,v 1.71 2004/05/26 06:18:38 danielk1977 Exp $
 */
 #ifndef NO_TCL     /* Omit this whole file if TCL is unavailable */
 
@@ -863,7 +863,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
     pFunc->pNext = pDb->pFunc;
     pFunc->zScript = (char*)&pFunc[1];
     strcpy(pFunc->zScript, zScript);
-    sqlite3_create_function(pDb->db, zName, -1, tclSqlFunc, pFunc);
+    sqlite3_create_function(pDb->db, zName, -1, 0, 0, pFunc, tclSqlFunc, 0, 0);
     sqlite3_function_type(pDb->db, zName, SQLITE_NUMERIC);
     break;
   }
index aa2a8209f376cfff8f106682d92af48c36679312..b9279d9aee1f400748ba6025cb55b7f4101ae1da 100644 (file)
@@ -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.54 2004/05/26 02:04:57 danielk1977 Exp $
+** $Id: test1.c,v 1.55 2004/05/26 06:18:38 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include "tcl.h"
@@ -408,8 +408,9 @@ static int test_create_function(
     return TCL_ERROR;
   }
   if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
-  sqlite3_create_function(db, "x_coalesce", -1, ifnullFunc, 0);
-  sqlite3_create_function(db, "x_sqlite3_exec", 1, sqlite3ExecFunc, db);
+  sqlite3_create_function(db, "x_coalesce", -1, 0, 0, 0, ifnullFunc, 0, 0);
+  sqlite3_create_function(db, "x_sqlite3_exec", 1, 0, 0, db,
+      sqlite3ExecFunc, 0, 0);
   return TCL_OK;
 }
 
@@ -457,8 +458,8 @@ static int test_create_aggregate(
     return TCL_ERROR;
   }
   if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
-  sqlite3_create_aggregate(db, "x_count", 0, countStep, countFinalize, 0);
-  sqlite3_create_aggregate(db, "x_count", 1, countStep, countFinalize, 0);
+  sqlite3_create_function(db, "x_count", 0, 0, 0, 0, 0,countStep,countFinalize);
+  sqlite3_create_function(db, "x_count", 1, 0, 0, 0, 0,countStep,countFinalize);
   return TCL_OK;
 }
 
@@ -686,7 +687,7 @@ static int test_register_func(
     return TCL_ERROR;
   }
   if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
-  rc = sqlite3_create_function(db, argv[2], -1, testFunc, 0);
+  rc = sqlite3_create_function(db, argv[2], -1, 0, 0, 0, testFunc, 0, 0);
   if( rc!=0 ){
     Tcl_AppendResult(interp, sqlite3_error_string(rc), 0);
     return TCL_ERROR;
@@ -1362,7 +1363,7 @@ static int test_step(
   rc = sqlite3_step(pStmt);
 
   if( rc!=SQLITE_DONE && rc!=SQLITE_ROW ) return TCL_ERROR;
-  Tcl_SetResult(interp, errorName(rc), 0);
+  Tcl_SetResult(interp, (char *)errorName(rc), 0);
   return TCL_OK;
 }
 
index 2d9a0b0c386765560d95efeb5763b91ce60a49cd..f971a03088391e821c2a64d69f19537721487773 100644 (file)
@@ -43,7 +43,7 @@
 ** in this file for details.  If in doubt, do not deviate from existing
 ** commenting and indentation practices when changing or adding code.
 **
-** $Id: vdbe.c,v 1.331 2004/05/26 02:04:58 danielk1977 Exp $
+** $Id: vdbe.c,v 1.332 2004/05/26 06:18:38 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include "os.h"
@@ -574,7 +574,7 @@ const unsigned char *sqlite3_column_data(sqlite3_stmt *pStmt, int i){
 ** If a translation fails because of a malloc() failure, a NULL pointer
 ** is returned.
 */
-const unsigned char *sqlite3_value_data(sqlite3_valuepVal){
+const unsigned char *sqlite3_value_data(sqlite3_value *pVal){
   if( pVal->flags&MEM_Null ){
     /* For a NULL return a NULL Pointer */
     return 0;