** 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_
** following opaque structure.
*/
typedef struct sqlite sqlite;
+typedef struct sqlite sqlite3;
+
/*
** A function to close the database.
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
*/
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
**
** 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
*/
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
** 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 */
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 */
*/
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
*/
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.
**
*/
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.