extensions/sqlite/sqlite-source/sqlite3.h
changeset 1203 633c25ce6405
child 1645 27307df4d711
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/extensions/sqlite/sqlite-source/sqlite3.h	Sun Jul 29 01:15:31 2007 +0000
     1.3 @@ -0,0 +1,2702 @@
     1.4 +/*
     1.5 +** 2001 September 15
     1.6 +**
     1.7 +** The author disclaims copyright to this source code.  In place of
     1.8 +** a legal notice, here is a blessing:
     1.9 +**
    1.10 +**    May you do good and not evil.
    1.11 +**    May you find forgiveness for yourself and forgive others.
    1.12 +**    May you share freely, never taking more than you give.
    1.13 +**
    1.14 +*************************************************************************
    1.15 +** This header file defines the interface that the SQLite library
    1.16 +** presents to client programs.  If a C-function, structure, datatype,
    1.17 +** or constant definition does not appear in this file, then it is
    1.18 +** not a published API of SQLite, is subject to change without
    1.19 +** notice, and should not be referenced by programs that use SQLite.
    1.20 +**
    1.21 +** Some of the definitions that are in this file are marked as
    1.22 +** "experimental".  Experimental interfaces are normally new
    1.23 +** features recently added to SQLite.  We do not anticipate changes 
    1.24 +** to experimental interfaces but reserve to make minor changes if
    1.25 +** experience from use "in the wild" suggest such changes are prudent.
    1.26 +**
    1.27 +** The official C-language API documentation for SQLite is derived
    1.28 +** from comments in this file.  This file is the authoritative source
    1.29 +** on how SQLite interfaces are suppose to operate.
    1.30 +**
    1.31 +** The name of this file under configuration management is "sqlite.h.in".
    1.32 +** The makefile makes some minor changes to this file (such as inserting
    1.33 +** the version number) and changes its name to "sqlite3.h" as
    1.34 +** part of the build process.
    1.35 +**
    1.36 +** @(#) $Id$
    1.37 +*/
    1.38 +#ifndef _SQLITE3_H_
    1.39 +#define _SQLITE3_H_
    1.40 +#include <stdarg.h>     /* Needed for the definition of va_list */
    1.41 +
    1.42 +/*
    1.43 +** Make sure we can call this stuff from C++.
    1.44 +*/
    1.45 +#ifdef __cplusplus
    1.46 +extern "C" {
    1.47 +#endif
    1.48 +
    1.49 +/*
    1.50 +** Make sure these symbols where not defined by some previous header
    1.51 +** file.
    1.52 +*/
    1.53 +#ifdef SQLITE_VERSION
    1.54 +# undef SQLITE_VERSION
    1.55 +#endif
    1.56 +#ifdef SQLITE_VERSION_NUMBER
    1.57 +# undef SQLITE_VERSION_NUMBER
    1.58 +#endif
    1.59 +
    1.60 +/*
    1.61 +** CAPI3REF: Compile-Time Library Version Numbers
    1.62 +**
    1.63 +** The version of the SQLite library is contained in the sqlite3.h
    1.64 +** header file in a #define named SQLITE_VERSION.  The SQLITE_VERSION
    1.65 +** macro resolves to a string constant.
    1.66 +**
    1.67 +** The format of the version string is "X.Y.Z", where
    1.68 +** X is the major version number, Y is the minor version number and Z
    1.69 +** is the release number.  The X.Y.Z might be followed by "alpha" or "beta".
    1.70 +** For example "3.1.1beta".
    1.71 +**
    1.72 +** The X value is always 3 in SQLite.  The X value only changes when
    1.73 +** backwards compatibility is broken and we intend to never break
    1.74 +** backwards compatibility.  The Y value only changes when
    1.75 +** there are major feature enhancements that are forwards compatible
    1.76 +** but not backwards compatible.  The Z value is incremented with
    1.77 +** each release but resets back to 0 when Y is incremented.
    1.78 +**
    1.79 +** The SQLITE_VERSION_NUMBER is an integer with the value 
    1.80 +** (X*1000000 + Y*1000 + Z). For example, for version "3.1.1beta", 
    1.81 +** SQLITE_VERSION_NUMBER is set to 3001001. To detect if they are using 
    1.82 +** version 3.1.1 or greater at compile time, programs may use the test 
    1.83 +** (SQLITE_VERSION_NUMBER>=3001001).
    1.84 +**
    1.85 +** See also: [sqlite3_libversion()] and [sqlite3_libversion_number()].
    1.86 +*/
    1.87 +#define SQLITE_VERSION         "3.4.1"
    1.88 +#define SQLITE_VERSION_NUMBER 3004001
    1.89 +
    1.90 +/*
    1.91 +** CAPI3REF: Run-Time Library Version Numbers
    1.92 +**
    1.93 +** These routines return values equivalent to the header constants
    1.94 +** [SQLITE_VERSION] and [SQLITE_VERSION_NUMBER].  The values returned
    1.95 +** by this routines should only be different from the header values
    1.96 +** if you compile your program using an sqlite3.h header from a
    1.97 +** different version of SQLite that the version of the library you
    1.98 +** link against.
    1.99 +**
   1.100 +** The sqlite3_version[] string constant contains the text of the
   1.101 +** [SQLITE_VERSION] string.  The sqlite3_libversion() function returns
   1.102 +** a poiner to the sqlite3_version[] string constant.  The function
   1.103 +** is provided for DLL users who can only access functions and not
   1.104 +** constants within the DLL.
   1.105 +*/
   1.106 +extern const char sqlite3_version[];
   1.107 +const char *sqlite3_libversion(void);
   1.108 +int sqlite3_libversion_number(void);
   1.109 +
   1.110 +/*
   1.111 +** CAPI3REF: Database Connection Handle
   1.112 +**
   1.113 +** Each open SQLite database is represented by pointer to an instance of the
   1.114 +** opaque structure named "sqlite3".  It is useful to think of an sqlite3
   1.115 +** pointer as an object.  The [sqlite3_open] interface is its constructor
   1.116 +** and [sqlite3_close] is its destructor.  There are many other interfaces
   1.117 +** (such as [sqlite3_prepare_v2], [sqlite3_create_function], and
   1.118 +** [sqlite3_busy_timeout] to name but three) that are methods on this
   1.119 +** object.
   1.120 +*/
   1.121 +typedef struct sqlite3 sqlite3;
   1.122 +
   1.123 +
   1.124 +/*
   1.125 +** CAPI3REF: 64-Bit Integer Types
   1.126 +**
   1.127 +** Some compilers do not support the "long long" datatype.  So we have
   1.128 +** to do compiler-specific typedefs for 64-bit signed and unsigned integers.
   1.129 +**
   1.130 +** Many SQLite interface functions require a 64-bit integer arguments.
   1.131 +** Those interfaces are declared using this typedef.
   1.132 +*/
   1.133 +#ifdef SQLITE_INT64_TYPE
   1.134 +  typedef SQLITE_INT64_TYPE sqlite_int64;
   1.135 +  typedef unsigned SQLITE_INT64_TYPE sqlite_uint64;
   1.136 +#elif defined(_MSC_VER) || defined(__BORLANDC__)
   1.137 +  typedef __int64 sqlite_int64;
   1.138 +  typedef unsigned __int64 sqlite_uint64;
   1.139 +#else
   1.140 +  typedef long long int sqlite_int64;
   1.141 +  typedef unsigned long long int sqlite_uint64;
   1.142 +#endif
   1.143 +
   1.144 +/*
   1.145 +** If compiling for a processor that lacks floating point support,
   1.146 +** substitute integer for floating-point
   1.147 +*/
   1.148 +#ifdef SQLITE_OMIT_FLOATING_POINT
   1.149 +# define double sqlite_int64
   1.150 +#endif
   1.151 +
   1.152 +/*
   1.153 +** CAPI3REF: Closing A Database Connection
   1.154 +**
   1.155 +** Call this function with a pointer to a structure that was previously
   1.156 +** returned from [sqlite3_open()] and the corresponding database will by
   1.157 +** closed.
   1.158 +**
   1.159 +** All SQL statements prepared using [sqlite3_prepare_v2()] or
   1.160 +** [sqlite3_prepare16_v2()] must be destroyed using [sqlite3_finalize()]
   1.161 +** before this routine is called. Otherwise, SQLITE_BUSY is returned and the
   1.162 +** database connection remains open.
   1.163 +*/
   1.164 +int sqlite3_close(sqlite3 *);
   1.165 +
   1.166 +/*
   1.167 +** The type for a callback function.
   1.168 +** This is legacy and deprecated.  It is included for historical
   1.169 +** compatibility and is not documented.
   1.170 +*/
   1.171 +typedef int (*sqlite3_callback)(void*,int,char**, char**);
   1.172 +
   1.173 +/*
   1.174 +** CAPI3REF: One-Step Query Execution Interface
   1.175 +**
   1.176 +** This interface is used to do a one-time evaluatation of zero
   1.177 +** or more SQL statements.  UTF-8 text of the SQL statements to
   1.178 +** be evaluted is passed in as the second parameter.  The statements
   1.179 +** are prepared one by one using [sqlite3_prepare()], evaluated
   1.180 +** using [sqlite3_step()], then destroyed using [sqlite3_finalize()].
   1.181 +**
   1.182 +** If one or more of the SQL statements are queries, then
   1.183 +** the callback function specified by the 3rd parameter is
   1.184 +** invoked once for each row of the query result.  This callback
   1.185 +** should normally return 0.  If the callback returns a non-zero
   1.186 +** value then the query is aborted, all subsequent SQL statements
   1.187 +** are skipped and the sqlite3_exec() function returns the SQLITE_ABORT.
   1.188 +**
   1.189 +** The 4th parameter to this interface is an arbitrary pointer that is
   1.190 +** passed through to the callback function as its first parameter.
   1.191 +**
   1.192 +** The 2nd parameter to the callback function is the number of
   1.193 +** columns in the query result.  The 3rd parameter to the callback
   1.194 +** is an array of strings holding the values for each column
   1.195 +** as extracted using [sqlite3_column_text()].
   1.196 +** The 4th parameter to the callback is an array of strings
   1.197 +** obtained using [sqlite3_column_name()] and holding
   1.198 +** the names of each column.
   1.199 +**
   1.200 +** The callback function may be NULL, even for queries.  A NULL
   1.201 +** callback is not an error.  It just means that no callback
   1.202 +** will be invoked.
   1.203 +**
   1.204 +** If an error occurs while parsing or evaluating the SQL (but
   1.205 +** not while executing the callback) then an appropriate error
   1.206 +** message is written into memory obtained from [sqlite3_malloc()] and
   1.207 +** *errmsg is made to point to that message.  The calling function
   1.208 +** is responsible for freeing the memory that holds the error
   1.209 +** message.   Use [sqlite3_free()] for this.  If errmsg==NULL,
   1.210 +** then no error message is ever written.
   1.211 +**
   1.212 +** The return value is is SQLITE_OK if there are no errors and
   1.213 +** some other [SQLITE_OK | return code] if there is an error.  
   1.214 +** The particular return value depends on the type of error. 
   1.215 +**
   1.216 +*/
   1.217 +int sqlite3_exec(
   1.218 +  sqlite3*,                                  /* An open database */
   1.219 +  const char *sql,                           /* SQL to be evaluted */
   1.220 +  int (*callback)(void*,int,char**,char**),  /* Callback function */
   1.221 +  void *,                                    /* 1st argument to callback */
   1.222 +  char **errmsg                              /* Error msg written here */
   1.223 +);
   1.224 +
   1.225 +/*
   1.226 +** CAPI3REF: Result Codes
   1.227 +** KEYWORDS: SQLITE_OK
   1.228 +**
   1.229 +** Many SQLite functions return an integer result code from the set shown
   1.230 +** above in order to indicates success or failure.
   1.231 +**
   1.232 +** The result codes above are the only ones returned by SQLite in its
   1.233 +** default configuration.  However, the [sqlite3_extended_result_codes()]
   1.234 +** API can be used to set a database connectoin to return more detailed
   1.235 +** result codes.
   1.236 +**
   1.237 +** See also: [SQLITE_IOERR_READ | extended result codes]
   1.238 +**
   1.239 +*/
   1.240 +#define SQLITE_OK           0   /* Successful result */
   1.241 +/* beginning-of-error-codes */
   1.242 +#define SQLITE_ERROR        1   /* SQL error or missing database */
   1.243 +#define SQLITE_INTERNAL     2   /* NOT USED. Internal logic error in SQLite */
   1.244 +#define SQLITE_PERM         3   /* Access permission denied */
   1.245 +#define SQLITE_ABORT        4   /* Callback routine requested an abort */
   1.246 +#define SQLITE_BUSY         5   /* The database file is locked */
   1.247 +#define SQLITE_LOCKED       6   /* A table in the database is locked */
   1.248 +#define SQLITE_NOMEM        7   /* A malloc() failed */
   1.249 +#define SQLITE_READONLY     8   /* Attempt to write a readonly database */
   1.250 +#define SQLITE_INTERRUPT    9   /* Operation terminated by sqlite3_interrupt()*/
   1.251 +#define SQLITE_IOERR       10   /* Some kind of disk I/O error occurred */
   1.252 +#define SQLITE_CORRUPT     11   /* The database disk image is malformed */
   1.253 +#define SQLITE_NOTFOUND    12   /* NOT USED. Table or record not found */
   1.254 +#define SQLITE_FULL        13   /* Insertion failed because database is full */
   1.255 +#define SQLITE_CANTOPEN    14   /* Unable to open the database file */
   1.256 +#define SQLITE_PROTOCOL    15   /* NOT USED. Database lock protocol error */
   1.257 +#define SQLITE_EMPTY       16   /* Database is empty */
   1.258 +#define SQLITE_SCHEMA      17   /* The database schema changed */
   1.259 +#define SQLITE_TOOBIG      18   /* String or BLOB exceeds size limit */
   1.260 +#define SQLITE_CONSTRAINT  19   /* Abort due to contraint violation */
   1.261 +#define SQLITE_MISMATCH    20   /* Data type mismatch */
   1.262 +#define SQLITE_MISUSE      21   /* Library used incorrectly */
   1.263 +#define SQLITE_NOLFS       22   /* Uses OS features not supported on host */
   1.264 +#define SQLITE_AUTH        23   /* Authorization denied */
   1.265 +#define SQLITE_FORMAT      24   /* Auxiliary database format error */
   1.266 +#define SQLITE_RANGE       25   /* 2nd parameter to sqlite3_bind out of range */
   1.267 +#define SQLITE_NOTADB      26   /* File opened that is not a database file */
   1.268 +#define SQLITE_ROW         100  /* sqlite3_step() has another row ready */
   1.269 +#define SQLITE_DONE        101  /* sqlite3_step() has finished executing */
   1.270 +/* end-of-error-codes */
   1.271 +
   1.272 +/*
   1.273 +** CAPI3REF: Extended Result Codes
   1.274 +**
   1.275 +** In its default configuration, SQLite API routines return one of 26 integer
   1.276 +** result codes described at result-codes.  However, experience has shown that
   1.277 +** many of these result codes are too course-grained.  They do not provide as
   1.278 +** much information about problems as users might like.  In an effort to
   1.279 +** address this, newer versions of SQLite (version 3.3.8 and later) include
   1.280 +** support for additional result codes that provide more detailed information
   1.281 +** about errors.  The extended result codes are enabled (or disabled) for 
   1.282 +** each database
   1.283 +** connection using the [sqlite3_extended_result_codes()] API.
   1.284 +** 
   1.285 +** Some of the available extended result codes are listed above.
   1.286 +** We expect the number of extended result codes will be expand
   1.287 +** over time.  Software that uses extended result codes should expect
   1.288 +** to see new result codes in future releases of SQLite.
   1.289 +** 
   1.290 +** The symbolic name for an extended result code always contains a related
   1.291 +** primary result code as a prefix.  Primary result codes contain a single
   1.292 +** "_" character.  Extended result codes contain two or more "_" characters.
   1.293 +** The numeric value of an extended result code can be converted to its
   1.294 +** corresponding primary result code by masking off the lower 8 bytes.
   1.295 +**
   1.296 +** The SQLITE_OK result code will never be extended.  It will always
   1.297 +** be exactly zero.
   1.298 +*/
   1.299 +#define SQLITE_IOERR_READ          (SQLITE_IOERR | (1<<8))
   1.300 +#define SQLITE_IOERR_SHORT_READ    (SQLITE_IOERR | (2<<8))
   1.301 +#define SQLITE_IOERR_WRITE         (SQLITE_IOERR | (3<<8))
   1.302 +#define SQLITE_IOERR_FSYNC         (SQLITE_IOERR | (4<<8))
   1.303 +#define SQLITE_IOERR_DIR_FSYNC     (SQLITE_IOERR | (5<<8))
   1.304 +#define SQLITE_IOERR_TRUNCATE      (SQLITE_IOERR | (6<<8))
   1.305 +#define SQLITE_IOERR_FSTAT         (SQLITE_IOERR | (7<<8))
   1.306 +#define SQLITE_IOERR_UNLOCK        (SQLITE_IOERR | (8<<8))
   1.307 +#define SQLITE_IOERR_RDLOCK        (SQLITE_IOERR | (9<<8))
   1.308 +#define SQLITE_IOERR_DELETE        (SQLITE_IOERR | (10<<8))
   1.309 +#define SQLITE_IOERR_BLOCKED       (SQLITE_IOERR | (11<<8))
   1.310 +
   1.311 +/*
   1.312 +** CAPI3REF: Enable Or Disable Extended Result Codes
   1.313 +**
   1.314 +** This routine enables or disables the
   1.315 +** [SQLITE_IOERR_READ | extended result codes] feature.
   1.316 +** By default, SQLite API routines return one of only 26 integer
   1.317 +** [SQLITE_OK | result codes].  When extended result codes
   1.318 +** are enabled by this routine, the repetoire of result codes can be
   1.319 +** much larger and can (hopefully) provide more detailed information
   1.320 +** about the cause of an error.
   1.321 +**
   1.322 +** The second argument is a boolean value that turns extended result
   1.323 +** codes on and off.  Extended result codes are off by default for
   1.324 +** backwards compatibility with older versions of SQLite.
   1.325 +*/
   1.326 +int sqlite3_extended_result_codes(sqlite3*, int onoff);
   1.327 +
   1.328 +/*
   1.329 +** CAPI3REF: Last Insert Rowid
   1.330 +**
   1.331 +** Each entry in an SQLite table has a unique 64-bit signed integer key
   1.332 +** called the "rowid". The rowid is always available as an undeclared
   1.333 +** column named ROWID, OID, or _ROWID_.  If the table has a column of
   1.334 +** type INTEGER PRIMARY KEY then that column is another an alias for the
   1.335 +** rowid.
   1.336 +**
   1.337 +** This routine returns the rowid of the most recent INSERT into
   1.338 +** the database from the database connection given in the first 
   1.339 +** argument.  If no inserts have ever occurred on this database
   1.340 +** connection, zero is returned.
   1.341 +**
   1.342 +** If an INSERT occurs within a trigger, then the rowid of the
   1.343 +** inserted row is returned by this routine as long as the trigger
   1.344 +** is running.  But once the trigger terminates, the value returned
   1.345 +** by this routine reverts to the last value inserted before the
   1.346 +** trigger fired.
   1.347 +*/
   1.348 +sqlite_int64 sqlite3_last_insert_rowid(sqlite3*);
   1.349 +
   1.350 +/*
   1.351 +** CAPI3REF: Count The Number Of Rows Modified
   1.352 +**
   1.353 +** This function returns the number of database rows that were changed
   1.354 +** (or inserted or deleted) by the most recent SQL statement.  Only
   1.355 +** changes that are directly specified by the INSERT, UPDATE, or
   1.356 +** DELETE statement are counted.  Auxiliary changes caused by
   1.357 +** triggers are not counted.  Use the [sqlite3_total_changes()] function
   1.358 +** to find the total number of changes including changes caused by triggers.
   1.359 +**
   1.360 +** Within the body of a trigger, the sqlite3_changes() interface can be
   1.361 +** called to find the number of
   1.362 +** changes in the most recently completed INSERT, UPDATE, or DELETE
   1.363 +** statement within the body of the trigger.
   1.364 +**
   1.365 +** All changes are counted, even if they were later undone by a
   1.366 +** ROLLBACK or ABORT.  Except, changes associated with creating and
   1.367 +** dropping tables are not counted.
   1.368 +**
   1.369 +** If a callback invokes [sqlite3_exec()] or [sqlite3_step()] recursively,
   1.370 +** then the changes in the inner, recursive call are counted together
   1.371 +** with the changes in the outer call.
   1.372 +**
   1.373 +** SQLite implements the command "DELETE FROM table" without a WHERE clause
   1.374 +** by dropping and recreating the table.  (This is much faster than going
   1.375 +** through and deleting individual elements from the table.)  Because of
   1.376 +** this optimization, the change count for "DELETE FROM table" will be
   1.377 +** zero regardless of the number of elements that were originally in the
   1.378 +** table. To get an accurate count of the number of rows deleted, use
   1.379 +** "DELETE FROM table WHERE 1" instead.
   1.380 +*/
   1.381 +int sqlite3_changes(sqlite3*);
   1.382 +
   1.383 +/*
   1.384 +** CAPI3REF: Total Number Of Rows Modified
   1.385 +***
   1.386 +** This function returns the number of database rows that have been
   1.387 +** modified by INSERT, UPDATE or DELETE statements since the database handle
   1.388 +** was opened. This includes UPDATE, INSERT and DELETE statements executed
   1.389 +** as part of trigger programs. All changes are counted as soon as the
   1.390 +** statement that makes them is completed (when the statement handle is
   1.391 +** passed to [sqlite3_reset()] or [sqlite_finalise()]).
   1.392 +**
   1.393 +** See also the [sqlite3_change()] interface.
   1.394 +**
   1.395 +** SQLite implements the command "DELETE FROM table" without a WHERE clause
   1.396 +** by dropping and recreating the table.  (This is much faster than going
   1.397 +** through and deleting individual elements form the table.)  Because of
   1.398 +** this optimization, the change count for "DELETE FROM table" will be
   1.399 +** zero regardless of the number of elements that were originally in the
   1.400 +** table. To get an accurate count of the number of rows deleted, use
   1.401 +** "DELETE FROM table WHERE 1" instead.
   1.402 +*/
   1.403 +int sqlite3_total_changes(sqlite3*);
   1.404 +
   1.405 +/*
   1.406 +** CAPI3REF: Interrupt A Long-Running Query
   1.407 +**
   1.408 +** This function causes any pending database operation to abort and
   1.409 +** return at its earliest opportunity.  This routine is typically
   1.410 +** called in response to a user action such as pressing "Cancel"
   1.411 +** or Ctrl-C where the user wants a long query operation to halt
   1.412 +** immediately.
   1.413 +**
   1.414 +** It is safe to call this routine from a thread different from the
   1.415 +** thread that is currently running the database operation.
   1.416 +**
   1.417 +** The SQL operation that is interrupted will return [SQLITE_INTERRUPT].
   1.418 +** If an interrupted operation was an update that is inside an
   1.419 +** explicit transaction, then the entire transaction will be rolled
   1.420 +** back automatically.
   1.421 +*/
   1.422 +void sqlite3_interrupt(sqlite3*);
   1.423 +
   1.424 +/*
   1.425 +** CAPI3REF: Determine If An SQL Statement Is Complete
   1.426 +**
   1.427 +** These functions return true if the given input string comprises
   1.428 +** one or more complete SQL statements. For the sqlite3_complete() call,
   1.429 +** the parameter must be a nul-terminated UTF-8 string. For
   1.430 +** sqlite3_complete16(), a nul-terminated machine byte order UTF-16 string
   1.431 +** is required.
   1.432 +**
   1.433 +** These routines are useful for command-line input to determine if the
   1.434 +** currently entered text forms one or more complete SQL statements or
   1.435 +** if additional input is needed before sending the statements into
   1.436 +** SQLite for parsing. The algorithm is simple.  If the 
   1.437 +** last token other than spaces and comments is a semicolon, then return 
   1.438 +** true.  Actually, the algorithm is a little more complicated than that
   1.439 +** in order to deal with triggers, but the basic idea is the same:  the
   1.440 +** statement is not complete unless it ends in a semicolon.
   1.441 +*/
   1.442 +int sqlite3_complete(const char *sql);
   1.443 +int sqlite3_complete16(const void *sql);
   1.444 +
   1.445 +/*
   1.446 +** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors
   1.447 +**
   1.448 +** This routine identifies a callback function that might be invoked
   1.449 +** whenever an attempt is made to open a database table 
   1.450 +** that another thread or process has locked.
   1.451 +** If the busy callback is NULL, then [SQLITE_BUSY]
   1.452 +** (or sometimes [SQLITE_IOERR_BLOCKED])
   1.453 +** is returned immediately upon encountering the lock.
   1.454 +** If the busy callback is not NULL, then the
   1.455 +** callback will be invoked with two arguments.  The
   1.456 +** first argument to the handler is a copy of the void* pointer which
   1.457 +** is the third argument to this routine.  The second argument to
   1.458 +** the handler is the number of times that the busy handler has
   1.459 +** been invoked for this locking event. If the
   1.460 +** busy callback returns 0, then no additional attempts are made to
   1.461 +** access the database and [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED] is returned.
   1.462 +** If the callback returns non-zero, then another attempt is made to open the
   1.463 +** database for reading and the cycle repeats.
   1.464 +**
   1.465 +** The presence of a busy handler does not guarantee that
   1.466 +** it will be invoked when there is lock contention.
   1.467 +** If SQLite determines that invoking the busy handler could result in
   1.468 +** a deadlock, it will return [SQLITE_BUSY] instead.
   1.469 +** Consider a scenario where one process is holding a read lock that
   1.470 +** it is trying to promote to a reserved lock and
   1.471 +** a second process is holding a reserved lock that it is trying
   1.472 +** to promote to an exclusive lock.  The first process cannot proceed
   1.473 +** because it is blocked by the second and the second process cannot
   1.474 +** proceed because it is blocked by the first.  If both processes
   1.475 +** invoke the busy handlers, neither will make any progress.  Therefore,
   1.476 +** SQLite returns [SQLITE_BUSY] for the first process, hoping that this
   1.477 +** will induce the first process to release its read lock and allow
   1.478 +** the second process to proceed.
   1.479 +**
   1.480 +** The default busy callback is NULL.
   1.481 +**
   1.482 +** The [SQLITE_BUSY] error is converted to [SQLITE_IOERR_BLOCKED] when
   1.483 +** SQLite is in the middle of a large transaction where all the
   1.484 +** changes will not fit into the in-memory cache.  SQLite will
   1.485 +** already hold a RESERVED lock on the database file, but it needs
   1.486 +** to promote this lock to EXCLUSIVE so that it can spill cache
   1.487 +** pages into the database file without harm to concurrent
   1.488 +** readers.  If it is unable to promote the lock, then the in-memory
   1.489 +** cache will be left in an inconsistent state and so the error
   1.490 +** code is promoted from the relatively benign [SQLITE_BUSY] to
   1.491 +** the more severe [SQLITE_IOERR_BLOCKED].  This error code promotion
   1.492 +** forces an automatic rollback of the changes. See the
   1.493 +** <a href="http://www.sqlite.org/cvstrac/wiki?p=CorruptionFollowingBusyError">
   1.494 +** CorruptionFollowingBusyError</a> wiki page for a discussion of why
   1.495 +** this is important.
   1.496 +**	
   1.497 +** Sqlite is re-entrant, so the busy handler may start a new query. 
   1.498 +** (It is not clear why anyone would every want to do this, but it
   1.499 +** is allowed, in theory.)  But the busy handler may not close the
   1.500 +** database.  Closing the database from a busy handler will delete 
   1.501 +** data structures out from under the executing query and will 
   1.502 +** probably result in a segmentation fault or other runtime error.
   1.503 +**
   1.504 +** There can only be a single busy handler defined for each database
   1.505 +** connection.  Setting a new busy handler clears any previous one.
   1.506 +** Note that calling [sqlite3_busy_timeout()] will also set or clear
   1.507 +** the busy handler.
   1.508 +*/
   1.509 +int sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*);
   1.510 +
   1.511 +/*
   1.512 +** CAPI3REF: Set A Busy Timeout
   1.513 +**
   1.514 +** This routine sets a busy handler that sleeps for a while when a
   1.515 +** table is locked.  The handler will sleep multiple times until 
   1.516 +** at least "ms" milliseconds of sleeping have been done.  After
   1.517 +** "ms" milliseconds of sleeping, the handler returns 0 which
   1.518 +** causes [sqlite3_step()] to return [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED].
   1.519 +**
   1.520 +** Calling this routine with an argument less than or equal to zero
   1.521 +** turns off all busy handlers.
   1.522 +**
   1.523 +** There can only be a single busy handler for a particular database
   1.524 +** connection.  If another busy handler was defined  
   1.525 +** (using [sqlite3_busy_handler()]) prior to calling
   1.526 +** this routine, that other busy handler is cleared.
   1.527 +*/
   1.528 +int sqlite3_busy_timeout(sqlite3*, int ms);
   1.529 +
   1.530 +/*
   1.531 +** CAPI3REF: Convenience Routines For Running Queries
   1.532 +**
   1.533 +** This next routine is a convenience wrapper around [sqlite3_exec()].
   1.534 +** Instead of invoking a user-supplied callback for each row of the
   1.535 +** result, this routine remembers each row of the result in memory
   1.536 +** obtained from [sqlite3_malloc()], then returns all of the result after the
   1.537 +** query has finished. 
   1.538 +**
   1.539 +** As an example, suppose the query result where this table:
   1.540 +**
   1.541 +** <pre>
   1.542 +**        Name        | Age
   1.543 +**        -----------------------
   1.544 +**        Alice       | 43
   1.545 +**        Bob         | 28
   1.546 +**        Cindy       | 21
   1.547 +** </pre>
   1.548 +**
   1.549 +** If the 3rd argument were &azResult then after the function returns
   1.550 +** azResult will contain the following data:
   1.551 +**
   1.552 +** <pre>
   1.553 +**        azResult[0] = "Name";
   1.554 +**        azResult[1] = "Age";
   1.555 +**        azResult[2] = "Alice";
   1.556 +**        azResult[3] = "43";
   1.557 +**        azResult[4] = "Bob";
   1.558 +**        azResult[5] = "28";
   1.559 +**        azResult[6] = "Cindy";
   1.560 +**        azResult[7] = "21";
   1.561 +** </pre>
   1.562 +**
   1.563 +** Notice that there is an extra row of data containing the column
   1.564 +** headers.  But the *nrow return value is still 3.  *ncolumn is
   1.565 +** set to 2.  In general, the number of values inserted into azResult
   1.566 +** will be ((*nrow) + 1)*(*ncolumn).
   1.567 +**
   1.568 +** After the calling function has finished using the result, it should 
   1.569 +** pass the result data pointer to sqlite3_free_table() in order to 
   1.570 +** release the memory that was malloc-ed.  Because of the way the 
   1.571 +** [sqlite3_malloc()] happens, the calling function must not try to call 
   1.572 +** [sqlite3_free()] directly.  Only [sqlite3_free_table()] is able to release 
   1.573 +** the memory properly and safely.
   1.574 +**
   1.575 +** The return value of this routine is the same as from [sqlite3_exec()].
   1.576 +*/
   1.577 +int sqlite3_get_table(
   1.578 +  sqlite3*,              /* An open database */
   1.579 +  const char *sql,       /* SQL to be executed */
   1.580 +  char ***resultp,       /* Result written to a char *[]  that this points to */
   1.581 +  int *nrow,             /* Number of result rows written here */
   1.582 +  int *ncolumn,          /* Number of result columns written here */
   1.583 +  char **errmsg          /* Error msg written here */
   1.584 +);
   1.585 +void sqlite3_free_table(char **result);
   1.586 +
   1.587 +/*
   1.588 +** CAPI3REF: Formatted String Printing Functions
   1.589 +**
   1.590 +** These routines are workalikes of the "printf()" family of functions
   1.591 +** from the standard C library.
   1.592 +**
   1.593 +** The sqlite3_mprintf() and sqlite3_vmprintf() routines write their
   1.594 +** results into memory obtained from [sqlite_malloc()].
   1.595 +** The strings returned by these two routines should be
   1.596 +** released by [sqlite3_free()].  Both routines return a
   1.597 +** NULL pointer if [sqlite3_malloc()] is unable to allocate enough
   1.598 +** memory to hold the resulting string.
   1.599 +**
   1.600 +** In sqlite3_snprintf() routine is similar to "snprintf()" from
   1.601 +** the standard C library.  The result is written into the
   1.602 +** buffer supplied as the second parameter whose size is given by
   1.603 +** the first parameter.  Note that the order of the
   1.604 +** first two parameters is reversed from snprintf().  This is an
   1.605 +** historical accident that cannot be fixed without breaking
   1.606 +** backwards compatibility.  Note also that sqlite3_snprintf()
   1.607 +** returns a pointer to its buffer instead of the number of
   1.608 +** characters actually written into the buffer.  We admit that
   1.609 +** the number of characters written would be a more useful return
   1.610 +** value but we cannot change the implementation of sqlite3_snprintf()
   1.611 +** now without breaking compatibility.
   1.612 +**
   1.613 +** As long as the buffer size is greater than zero, sqlite3_snprintf()
   1.614 +** guarantees that the buffer is always zero-terminated.  The first
   1.615 +** parameter "n" is the total size of the buffer, including space for
   1.616 +** the zero terminator.  So the longest string that can be completely
   1.617 +** written will be n-1 characters.
   1.618 +**
   1.619 +** These routines all implement some additional formatting
   1.620 +** options that are useful for constructing SQL statements.
   1.621 +** All of the usual printf formatting options apply.  In addition, there
   1.622 +** is are "%q" and "%Q" options.
   1.623 +**
   1.624 +** The %q option works like %s in that it substitutes a null-terminated
   1.625 +** string from the argument list.  But %q also doubles every '\'' character.
   1.626 +** %q is designed for use inside a string literal.  By doubling each '\''
   1.627 +** character it escapes that character and allows it to be inserted into
   1.628 +** the string.
   1.629 +**
   1.630 +** For example, so some string variable contains text as follows:
   1.631 +**
   1.632 +** <blockquote><pre>
   1.633 +**  char *zText = "It's a happy day!";
   1.634 +** </pre></blockquote>
   1.635 +**
   1.636 +** One can use this text in an SQL statement as follows:
   1.637 +**
   1.638 +** <blockquote><pre>
   1.639 +**  char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES('%q')", zText);
   1.640 +**  sqlite3_exec(db, zSQL, 0, 0, 0);
   1.641 +**  sqlite3_free(zSQL);
   1.642 +** </pre></blockquote>
   1.643 +**
   1.644 +** Because the %q format string is used, the '\'' character in zText
   1.645 +** is escaped and the SQL generated is as follows:
   1.646 +**
   1.647 +** <blockquote><pre>
   1.648 +**  INSERT INTO table1 VALUES('It''s a happy day!')
   1.649 +** </pre></blockquote>
   1.650 +**
   1.651 +** This is correct.  Had we used %s instead of %q, the generated SQL
   1.652 +** would have looked like this:
   1.653 +**
   1.654 +** <blockquote><pre>
   1.655 +**  INSERT INTO table1 VALUES('It's a happy day!');
   1.656 +** </pre></blockquote>
   1.657 +**
   1.658 +** This second example is an SQL syntax error.  As a general rule you
   1.659 +** should always use %q instead of %s when inserting text into a string 
   1.660 +** literal.
   1.661 +**
   1.662 +** The %Q option works like %q except it also adds single quotes around
   1.663 +** the outside of the total string.  Or if the parameter in the argument
   1.664 +** list is a NULL pointer, %Q substitutes the text "NULL" (without single
   1.665 +** quotes) in place of the %Q option.  So, for example, one could say:
   1.666 +**
   1.667 +** <blockquote><pre>
   1.668 +**  char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES(%Q)", zText);
   1.669 +**  sqlite3_exec(db, zSQL, 0, 0, 0);
   1.670 +**  sqlite3_free(zSQL);
   1.671 +** </pre></blockquote>
   1.672 +**
   1.673 +** The code above will render a correct SQL statement in the zSQL
   1.674 +** variable even if the zText variable is a NULL pointer.
   1.675 +*/
   1.676 +char *sqlite3_mprintf(const char*,...);
   1.677 +char *sqlite3_vmprintf(const char*, va_list);
   1.678 +char *sqlite3_snprintf(int,char*,const char*, ...);
   1.679 +
   1.680 +/*
   1.681 +** CAPI3REF: Memory Allocation Functions
   1.682 +**
   1.683 +** SQLite uses its own memory allocator.  On some installations, this
   1.684 +** memory allocator is identical to the standard malloc()/realloc()/free()
   1.685 +** and can be used interchangable.  On others, the implementations are
   1.686 +** different.  For maximum portability, it is best not to mix calls
   1.687 +** to the standard malloc/realloc/free with the sqlite versions.
   1.688 +*/
   1.689 +void *sqlite3_malloc(int);
   1.690 +void *sqlite3_realloc(void*, int);
   1.691 +void sqlite3_free(void*);
   1.692 +
   1.693 +/*
   1.694 +** CAPI3REF: Compile-Time Authorization Callbacks
   1.695 +***
   1.696 +** This routine registers a authorizer callback with the SQLite library.  
   1.697 +** The authorizer callback is invoked as SQL statements are being compiled
   1.698 +** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()],
   1.699 +** [sqlite3_prepare16()] and [sqlite3_prepare16_v2()].  At various
   1.700 +** points during the compilation process, as logic is being created
   1.701 +** to perform various actions, the authorizer callback is invoked to
   1.702 +** see if those actions are allowed.  The authorizer callback should
   1.703 +** return SQLITE_OK to allow the action, [SQLITE_IGNORE] to disallow the
   1.704 +** specific action but allow the SQL statement to continue to be
   1.705 +** compiled, or [SQLITE_DENY] to cause the entire SQL statement to be
   1.706 +** rejected with an error.  
   1.707 +**
   1.708 +** Depending on the action, the [SQLITE_IGNORE] and [SQLITE_DENY] return
   1.709 +** codes might mean something different or they might mean the same
   1.710 +** thing.  If the action is, for example, to perform a delete opertion,
   1.711 +** then [SQLITE_IGNORE] and [SQLITE_DENY] both cause the statement compilation
   1.712 +** to fail with an error.  But if the action is to read a specific column
   1.713 +** from a specific table, then [SQLITE_DENY] will cause the entire
   1.714 +** statement to fail but [SQLITE_IGNORE] will cause a NULL value to be
   1.715 +** read instead of the actual column value.
   1.716 +**
   1.717 +** The first parameter to the authorizer callback is a copy of
   1.718 +** the third parameter to the sqlite3_set_authorizer() interface.
   1.719 +** The second parameter to the callback is an integer 
   1.720 +** [SQLITE_COPY | action code] that specifies the particular action
   1.721 +** to be authorized.  The available action codes are
   1.722 +** [SQLITE_COPY | documented separately].  The third through sixth
   1.723 +** parameters to the callback are strings that contain additional
   1.724 +** details about the action to be authorized.
   1.725 +**
   1.726 +** An authorizer is used when preparing SQL statements from an untrusted
   1.727 +** source, to ensure that the SQL statements do not try to access data
   1.728 +** that they are not allowed to see, or that they do not try to
   1.729 +** execute malicious statements that damage the database.  For
   1.730 +** example, an application may allow a user to enter arbitrary
   1.731 +** SQL queries for evaluation by a database.  But the application does
   1.732 +** not want the user to be able to make arbitrary changes to the
   1.733 +** database.  An authorizer could then be put in place while the
   1.734 +** user-entered SQL is being prepared that disallows everything
   1.735 +** except SELECT statements.  
   1.736 +**
   1.737 +** Only a single authorizer can be in place on a database connection
   1.738 +** at a time.  Each call to sqlite3_set_authorizer overrides the
   1.739 +** previous call.  A NULL authorizer means that no authorization
   1.740 +** callback is invoked.  The default authorizer is NULL.
   1.741 +**
   1.742 +** Note that the authorizer callback is invoked only during 
   1.743 +** [sqlite3_prepare()] or its variants.  Authorization is not
   1.744 +** performed during statement evaluation in [sqlite3_step()].
   1.745 +*/
   1.746 +int sqlite3_set_authorizer(
   1.747 +  sqlite3*,
   1.748 +  int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),
   1.749 +  void *pUserData
   1.750 +);
   1.751 +
   1.752 +/*
   1.753 +** CAPI3REF: Authorizer Return Codes
   1.754 +**
   1.755 +** The [sqlite3_set_authorizer | authorizer callback function] must
   1.756 +** return either [SQLITE_OK] or one of these two constants in order
   1.757 +** to signal SQLite whether or not the action is permitted.  See the
   1.758 +** [sqlite3_set_authorizer | authorizer documentation] for additional
   1.759 +** information.
   1.760 +*/
   1.761 +#define SQLITE_DENY   1   /* Abort the SQL statement with an error */
   1.762 +#define SQLITE_IGNORE 2   /* Don't allow access, but don't generate an error */
   1.763 +
   1.764 +/*
   1.765 +** CAPI3REF: Authorizer Action Codes
   1.766 +**
   1.767 +** The [sqlite3_set_authorizer()] interface registers a callback function
   1.768 +** that is invoked to authorizer certain SQL statement actions.  The
   1.769 +** second parameter to the callback is an integer code that specifies
   1.770 +** what action is being authorized.  These are the integer action codes that
   1.771 +** the authorizer callback may be passed.
   1.772 +**
   1.773 +** These action code values signify what kind of operation is to be 
   1.774 +** authorized.  The 3rd and 4th parameters to the authorization callback
   1.775 +** function will be parameters or NULL depending on which of these
   1.776 +** codes is used as the second parameter.  The 5th parameter to the
   1.777 +** authorizer callback is the name of the database ("main", "temp", 
   1.778 +** etc.) if applicable.  The 6th parameter to the authorizer callback
   1.779 +** is the name of the inner-most trigger or view that is responsible for
   1.780 +** the access attempt or NULL if this access attempt is directly from 
   1.781 +** top-level SQL code.
   1.782 +*/
   1.783 +/******************************************* 3rd ************ 4th ***********/
   1.784 +#define SQLITE_CREATE_INDEX          1   /* Index Name      Table Name      */
   1.785 +#define SQLITE_CREATE_TABLE          2   /* Table Name      NULL            */
   1.786 +#define SQLITE_CREATE_TEMP_INDEX     3   /* Index Name      Table Name      */
   1.787 +#define SQLITE_CREATE_TEMP_TABLE     4   /* Table Name      NULL            */
   1.788 +#define SQLITE_CREATE_TEMP_TRIGGER   5   /* Trigger Name    Table Name      */
   1.789 +#define SQLITE_CREATE_TEMP_VIEW      6   /* View Name       NULL            */
   1.790 +#define SQLITE_CREATE_TRIGGER        7   /* Trigger Name    Table Name      */
   1.791 +#define SQLITE_CREATE_VIEW           8   /* View Name       NULL            */
   1.792 +#define SQLITE_DELETE                9   /* Table Name      NULL            */
   1.793 +#define SQLITE_DROP_INDEX           10   /* Index Name      Table Name      */
   1.794 +#define SQLITE_DROP_TABLE           11   /* Table Name      NULL            */
   1.795 +#define SQLITE_DROP_TEMP_INDEX      12   /* Index Name      Table Name      */
   1.796 +#define SQLITE_DROP_TEMP_TABLE      13   /* Table Name      NULL            */
   1.797 +#define SQLITE_DROP_TEMP_TRIGGER    14   /* Trigger Name    Table Name      */
   1.798 +#define SQLITE_DROP_TEMP_VIEW       15   /* View Name       NULL            */
   1.799 +#define SQLITE_DROP_TRIGGER         16   /* Trigger Name    Table Name      */
   1.800 +#define SQLITE_DROP_VIEW            17   /* View Name       NULL            */
   1.801 +#define SQLITE_INSERT               18   /* Table Name      NULL            */
   1.802 +#define SQLITE_PRAGMA               19   /* Pragma Name     1st arg or NULL */
   1.803 +#define SQLITE_READ                 20   /* Table Name      Column Name     */
   1.804 +#define SQLITE_SELECT               21   /* NULL            NULL            */
   1.805 +#define SQLITE_TRANSACTION          22   /* NULL            NULL            */
   1.806 +#define SQLITE_UPDATE               23   /* Table Name      Column Name     */
   1.807 +#define SQLITE_ATTACH               24   /* Filename        NULL            */
   1.808 +#define SQLITE_DETACH               25   /* Database Name   NULL            */
   1.809 +#define SQLITE_ALTER_TABLE          26   /* Database Name   Table Name      */
   1.810 +#define SQLITE_REINDEX              27   /* Index Name      NULL            */
   1.811 +#define SQLITE_ANALYZE              28   /* Table Name      NULL            */
   1.812 +#define SQLITE_CREATE_VTABLE        29   /* Table Name      Module Name     */
   1.813 +#define SQLITE_DROP_VTABLE          30   /* Table Name      Module Name     */
   1.814 +#define SQLITE_FUNCTION             31   /* Function Name   NULL            */
   1.815 +#define SQLITE_COPY                  0   /* No longer used */
   1.816 +
   1.817 +/*
   1.818 +** CAPI3REF: Tracing And Profiling Functions
   1.819 +**
   1.820 +** These routines register callback functions that can be used for
   1.821 +** tracing and profiling the execution of SQL statements.
   1.822 +** The callback function registered by sqlite3_trace() is invoked
   1.823 +** at the first [sqlite3_step()] for the evaluation of an SQL statement.
   1.824 +** The callback function registered by sqlite3_profile() is invoked
   1.825 +** as each SQL statement finishes and includes
   1.826 +** information on how long that statement ran.
   1.827 +**
   1.828 +** The sqlite3_profile() API is currently considered experimental and
   1.829 +** is subject to change.
   1.830 +*/
   1.831 +void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*);
   1.832 +void *sqlite3_profile(sqlite3*,
   1.833 +   void(*xProfile)(void*,const char*,sqlite_uint64), void*);
   1.834 +
   1.835 +/*
   1.836 +** CAPI3REF: Query Progress Callbacks
   1.837 +**
   1.838 +** This routine configures a callback function - the progress callback - that
   1.839 +** is invoked periodically during long running calls to [sqlite3_exec()],
   1.840 +** [sqlite3_step()] and [sqlite3_get_table()].  An example use for this 
   1.841 +** interface is to keep a GUI updated during a large query.
   1.842 +**
   1.843 +** The progress callback is invoked once for every N virtual machine opcodes,
   1.844 +** where N is the second argument to this function. The progress callback
   1.845 +** itself is identified by the third argument to this function. The fourth
   1.846 +** argument to this function is a void pointer passed to the progress callback
   1.847 +** function each time it is invoked.
   1.848 +**
   1.849 +** If a call to [sqlite3_exec()], [sqlite3_step()], or [sqlite3_get_table()]
   1.850 +** results in fewer than N opcodes being executed, then the progress 
   1.851 +** callback is never invoked.
   1.852 +** 
   1.853 +** Only a single progress callback function may be registered for each
   1.854 +** open database connection.  Every call to sqlite3_progress_handler()
   1.855 +** overwrites the results of the previous call.
   1.856 +** To remove the progress callback altogether, pass NULL as the third
   1.857 +** argument to this function.
   1.858 +**
   1.859 +** If the progress callback returns a result other than 0, then the current 
   1.860 +** query is immediately terminated and any database changes rolled back.
   1.861 +** The containing [sqlite3_exec()], [sqlite3_step()], or
   1.862 +** [sqlite3_get_table()] call returns SQLITE_INTERRUPT.   This feature
   1.863 +** can be used, for example, to implement the "Cancel" button on a
   1.864 +** progress dialog box in a GUI.
   1.865 +*/
   1.866 +void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
   1.867 +
   1.868 +/*
   1.869 +** CAPI3REF: Opening A New Database Connection
   1.870 +**
   1.871 +** Open the sqlite database file "filename".  The "filename" is UTF-8
   1.872 +** encoded for sqlite3_open() and UTF-16 encoded in the native byte order
   1.873 +** for sqlite3_open16().  An [sqlite3*] handle is returned in *ppDb, even
   1.874 +** if an error occurs. If the database is opened (or created) successfully,
   1.875 +** then SQLITE_OK is returned. Otherwise an error code is returned. The
   1.876 +** sqlite3_errmsg() or sqlite3_errmsg16()  routines can be used to obtain
   1.877 +** an English language description of the error.
   1.878 +**
   1.879 +** If the database file does not exist, then a new database will be created
   1.880 +** as needed.  The default encoding for the database will be UTF-8 if
   1.881 +** sqlite3_open() is called and UTF-16 if sqlite3_open16 is used.
   1.882 +**
   1.883 +** Whether or not an error occurs when it is opened, resources associated
   1.884 +** with the [sqlite3*] handle should be released by passing it to
   1.885 +** sqlite3_close() when it is no longer required.
   1.886 +**
   1.887 +** Note to windows users:  The encoding used for the filename argument
   1.888 +** of sqlite3_open() must be UTF-8, not whatever codepage is currently
   1.889 +** defined.  Filenames containing international characters must be converted
   1.890 +** to UTF-8 prior to passing them into sqlite3_open().
   1.891 +*/
   1.892 +int sqlite3_open(
   1.893 +  const char *filename,   /* Database filename (UTF-8) */
   1.894 +  sqlite3 **ppDb          /* OUT: SQLite db handle */
   1.895 +);
   1.896 +int sqlite3_open16(
   1.897 +  const void *filename,   /* Database filename (UTF-16) */
   1.898 +  sqlite3 **ppDb          /* OUT: SQLite db handle */
   1.899 +);
   1.900 +
   1.901 +/*
   1.902 +** CAPI3REF: Error Codes And Messages
   1.903 +**
   1.904 +** The sqlite3_errcode() interface returns the numeric
   1.905 +** [SQLITE_OK | result code] or [SQLITE_IOERR_READ | extended result code]
   1.906 +** for the most recent failed sqlite3_* API call associated
   1.907 +** with [sqlite3] handle 'db'.  If a prior API call failed but the
   1.908 +** most recent API call succeeded, the return value from sqlite3_errcode()
   1.909 +** is undefined. 
   1.910 +**
   1.911 +** The sqlite3_errmsg() and sqlite3_errmsg16() return English-langauge
   1.912 +** text that describes the error, as either UTF8 or UTF16 respectively.
   1.913 +** Memory to hold the error message string is managed internally.  The 
   1.914 +** string may be overwritten or deallocated by subsequent calls to SQLite
   1.915 +** interface functions.
   1.916 +**
   1.917 +** Calls to many sqlite3_* functions set the error code and string returned
   1.918 +** by [sqlite3_errcode()], [sqlite3_errmsg()], and [sqlite3_errmsg16()]
   1.919 +** (overwriting the previous values). Note that calls to [sqlite3_errcode()],
   1.920 +** [sqlite3_errmsg()], and [sqlite3_errmsg16()] themselves do not affect the
   1.921 +** results of future invocations.  Calls to API routines that do not return
   1.922 +** an error code (examples: [sqlite3_data_count()] or [sqlite3_mprintf()]) do
   1.923 +** not change the error code returned by this routine.
   1.924 +**
   1.925 +** Assuming no other intervening sqlite3_* API calls are made, the error
   1.926 +** code returned by this function is associated with the same error as
   1.927 +** the strings returned by [sqlite3_errmsg()] and [sqlite3_errmsg16()].
   1.928 +*/
   1.929 +int sqlite3_errcode(sqlite3 *db);
   1.930 +const char *sqlite3_errmsg(sqlite3*);
   1.931 +const void *sqlite3_errmsg16(sqlite3*);
   1.932 +
   1.933 +/*
   1.934 +** CAPI3REF: SQL Statement Object
   1.935 +**
   1.936 +** Instance of this object represent single SQL statements.  This
   1.937 +** is variously known as a "prepared statement" or a 
   1.938 +** "compiled SQL statement" or simply as a "statement".
   1.939 +** 
   1.940 +** The life of a statement object goes something like this:
   1.941 +**
   1.942 +** <ol>
   1.943 +** <li> Create the object using [sqlite3_prepare_v2()] or a related
   1.944 +**      function.
   1.945 +** <li> Bind values to host parameters using
   1.946 +**      [sqlite3_bind_blob | sqlite3_bind_* interfaces].
   1.947 +** <li> Run the SQL by calling [sqlite3_step()] one or more times.
   1.948 +** <li> Reset the statement using [sqlite3_reset()] then go back
   1.949 +**      to step 2.  Do this zero or more times.
   1.950 +** <li> Destroy the object using [sqlite3_finalize()].
   1.951 +** </ol>
   1.952 +**
   1.953 +** Refer to documentation on individual methods above for additional
   1.954 +** information.
   1.955 +*/
   1.956 +typedef struct sqlite3_stmt sqlite3_stmt;
   1.957 +
   1.958 +/*
   1.959 +** CAPI3REF: Compiling An SQL Statement
   1.960 +**
   1.961 +** To execute an SQL query, it must first be compiled into a byte-code
   1.962 +** program using one of these routines. 
   1.963 +**
   1.964 +** The first argument "db" is an [sqlite3 | SQLite database handle] 
   1.965 +** obtained from a prior call to [sqlite3_open()] or [sqlite3_open16()].
   1.966 +** The second argument "zSql" is the statement to be compiled, encoded
   1.967 +** as either UTF-8 or UTF-16.  The sqlite3_prepare() and sqlite3_prepare_v2()
   1.968 +** interfaces uses UTF-8 and sqlite3_prepare16() and sqlite3_prepare16_v2()
   1.969 +** use UTF-16.
   1.970 +**
   1.971 +** If the nByte argument is less
   1.972 +** than zero, then zSql is read up to the first zero terminator.  If
   1.973 +** nByte is non-negative, then it is the maximum number of 
   1.974 +** bytes read from zSql.  When nByte is non-negative, the
   1.975 +** zSql string ends at either the first '\000' character or 
   1.976 +** until the nByte-th byte, whichever comes first.
   1.977 +**
   1.978 +** *pzTail is made to point to the first byte past the end of the first
   1.979 +** SQL statement in zSql.  This routine only compiles the first statement
   1.980 +** in zSql, so *pzTail is left pointing to what remains uncompiled.
   1.981 +**
   1.982 +** *ppStmt is left pointing to a compiled 
   1.983 +** [sqlite3_stmt | SQL statement structure] that can be
   1.984 +** executed using [sqlite3_step()].  Or if there is an error, *ppStmt may be
   1.985 +** set to NULL.  If the input text contained no SQL (if the input is and
   1.986 +** empty string or a comment) then *ppStmt is set to NULL.  The calling
   1.987 +** procedure is responsible for deleting the compiled SQL statement
   1.988 +** using [sqlite3_finalize()] after it has finished with it.
   1.989 +**
   1.990 +** On success, [SQLITE_OK] is returned.  Otherwise an 
   1.991 +** [SQLITE_ERROR | error code] is returned.
   1.992 +**
   1.993 +** The sqlite3_prepare_v2() and sqlite3_prepare16_v2() interfaces are
   1.994 +** recommended for all new programs. The two older interfaces are retained
   1.995 +** for backwards compatibility, but their use is discouraged.
   1.996 +** In the "v2" interfaces, the prepared statement
   1.997 +** that is returned (the [sqlite3_stmt] object) contains a copy of the 
   1.998 +** original SQL text. This causes the [sqlite3_step()] interface to
   1.999 +** behave a differently in two ways:
  1.1000 +**
  1.1001 +** <ol>
  1.1002 +** <li>
  1.1003 +** If the database schema changes, instead of returning [SQLITE_SCHEMA] as it
  1.1004 +** always used to do, [sqlite3_step()] will automatically recompile the SQL
  1.1005 +** statement and try to run it again.  If the schema has changed in a way
  1.1006 +** that makes the statement no longer valid, [sqlite3_step()] will still
  1.1007 +** return [SQLITE_SCHEMA].  But unlike the legacy behavior, [SQLITE_SCHEMA] is
  1.1008 +** now a fatal error.  Calling [sqlite3_prepare_v2()] again will not make the
  1.1009 +** error go away.  Note: use [sqlite3_errmsg()] to find the text of the parsing
  1.1010 +** error that results in an [SQLITE_SCHEMA] return.
  1.1011 +** </li>
  1.1012 +**
  1.1013 +** <li>
  1.1014 +** When an error occurs, 
  1.1015 +** [sqlite3_step()] will return one of the detailed 
  1.1016 +** [SQLITE_ERROR | result codes] or
  1.1017 +** [SQLITE_IOERR_READ | extended result codes] such as directly.
  1.1018 +** The legacy behavior was that [sqlite3_step()] would only return a generic
  1.1019 +** [SQLITE_ERROR] result code and you would have to make a second call to
  1.1020 +** [sqlite3_reset()] in order to find the underlying cause of the problem.
  1.1021 +** With the "v2" prepare interfaces, the underlying reason for the error is
  1.1022 +** returned immediately.
  1.1023 +** </li>
  1.1024 +** </ol>
  1.1025 +*/
  1.1026 +int sqlite3_prepare(
  1.1027 +  sqlite3 *db,            /* Database handle */
  1.1028 +  const char *zSql,       /* SQL statement, UTF-8 encoded */
  1.1029 +  int nByte,              /* Maximum length of zSql in bytes. */
  1.1030 +  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */
  1.1031 +  const char **pzTail     /* OUT: Pointer to unused portion of zSql */
  1.1032 +);
  1.1033 +int sqlite3_prepare_v2(
  1.1034 +  sqlite3 *db,            /* Database handle */
  1.1035 +  const char *zSql,       /* SQL statement, UTF-8 encoded */
  1.1036 +  int nByte,              /* Maximum length of zSql in bytes. */
  1.1037 +  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */
  1.1038 +  const char **pzTail     /* OUT: Pointer to unused portion of zSql */
  1.1039 +);
  1.1040 +int sqlite3_prepare16(
  1.1041 +  sqlite3 *db,            /* Database handle */
  1.1042 +  const void *zSql,       /* SQL statement, UTF-16 encoded */
  1.1043 +  int nByte,              /* Maximum length of zSql in bytes. */
  1.1044 +  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */
  1.1045 +  const void **pzTail     /* OUT: Pointer to unused portion of zSql */
  1.1046 +);
  1.1047 +int sqlite3_prepare16_v2(
  1.1048 +  sqlite3 *db,            /* Database handle */
  1.1049 +  const void *zSql,       /* SQL statement, UTF-16 encoded */
  1.1050 +  int nByte,              /* Maximum length of zSql in bytes. */
  1.1051 +  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */
  1.1052 +  const void **pzTail     /* OUT: Pointer to unused portion of zSql */
  1.1053 +);
  1.1054 +
  1.1055 +/*
  1.1056 +** CAPI3REF:  Dynamically Typed Value Object
  1.1057 +**
  1.1058 +** SQLite uses dynamic typing for the values it stores.  Values can 
  1.1059 +** be integers, floating point values, strings, BLOBs, or NULL.  When
  1.1060 +** passing around values internally, each value is represented as
  1.1061 +** an instance of the sqlite3_value object.
  1.1062 +*/
  1.1063 +typedef struct Mem sqlite3_value;
  1.1064 +
  1.1065 +/*
  1.1066 +** CAPI3REF:  SQL Function Context Object
  1.1067 +**
  1.1068 +** The context in which an SQL function executes is stored in an
  1.1069 +** sqlite3_context object.  A pointer to such an object is the
  1.1070 +** first parameter to user-defined SQL functions.
  1.1071 +*/
  1.1072 +typedef struct sqlite3_context sqlite3_context;
  1.1073 +
  1.1074 +/*
  1.1075 +** CAPI3REF:  Binding Values To Prepared Statements
  1.1076 +**
  1.1077 +** In the SQL strings input to [sqlite3_prepare_v2()] and its variants,
  1.1078 +** one or more literals can be replace by a parameter in one of these
  1.1079 +** forms:
  1.1080 +**
  1.1081 +** <ul>
  1.1082 +** <li>  ?
  1.1083 +** <li>  ?NNN
  1.1084 +** <li>  :AAA
  1.1085 +** <li>  @AAA
  1.1086 +** <li>  $VVV
  1.1087 +** </ul>
  1.1088 +**
  1.1089 +** In the parameter forms shown above NNN is an integer literal,
  1.1090 +** AAA is an alphanumeric identifier and VVV is a variable name according
  1.1091 +** to the syntax rules of the TCL programming language.
  1.1092 +** The values of these parameters (also called "host parameter names")
  1.1093 +** can be set using the sqlite3_bind_*() routines defined here.
  1.1094 +**
  1.1095 +** The first argument to the sqlite3_bind_*() routines always is a pointer
  1.1096 +** to the [sqlite3_stmt] object returned from [sqlite3_prepare_v2()] or
  1.1097 +** its variants.  The second
  1.1098 +** argument is the index of the parameter to be set.  The first parameter has
  1.1099 +** an index of 1. When the same named parameter is used more than once, second
  1.1100 +** and subsequent
  1.1101 +** occurrences have the same index as the first occurrence.  The index for
  1.1102 +** named parameters can be looked up using the
  1.1103 +** [sqlite3_bind_parameter_name()] API if desired.  The index for "?NNN"
  1.1104 +** parametes is the value of NNN.
  1.1105 +** The NNN value must be between 1 and the compile-time
  1.1106 +** parameter SQLITE_MAX_VARIABLE_NUMBER (default value: 999).
  1.1107 +** See <a href="limits.html">limits.html</a> for additional information.
  1.1108 +**
  1.1109 +** The third argument is the value to bind to the parameter.
  1.1110 +**
  1.1111 +** In those
  1.1112 +** routines that have a fourth argument, its value is the number of bytes
  1.1113 +** in the parameter.  To be clear: the value is the number of bytes in the
  1.1114 +** string, not the number of characters.  The number
  1.1115 +** of bytes does not include the zero-terminator at the end of strings.
  1.1116 +** If the fourth parameter is negative, the length of the string is
  1.1117 +** number of bytes up to the first zero terminator.
  1.1118 +**
  1.1119 +** The fifth argument to sqlite3_bind_blob(), sqlite3_bind_text(), and
  1.1120 +** sqlite3_bind_text16() is a destructor used to dispose of the BLOB or
  1.1121 +** text after SQLite has finished with it.  If the fifth argument is the
  1.1122 +** special value [SQLITE_STATIC], then the library assumes that the information
  1.1123 +** is in static, unmanaged space and does not need to be freed.  If the
  1.1124 +** fifth argument has the value [SQLITE_TRANSIENT], then SQLite makes its
  1.1125 +** own private copy of the data immediately, before the sqlite3_bind_*()
  1.1126 +** routine returns.
  1.1127 +**
  1.1128 +** The sqlite3_bind_zeroblob() routine binds a BLOB of length n that
  1.1129 +** is filled with zeros.  A zeroblob uses a fixed amount of memory
  1.1130 +** (just an integer to hold it size) while it is being processed.
  1.1131 +** Zeroblobs are intended to serve as place-holders for BLOBs whose
  1.1132 +** content is later written using 
  1.1133 +** [sqlite3_blob_open | increment BLOB I/O] routines.
  1.1134 +**
  1.1135 +** The sqlite3_bind_*() routines must be called after
  1.1136 +** [sqlite3_prepare_v2()] (and its variants) or [sqlite3_reset()] and
  1.1137 +** before [sqlite3_step()].
  1.1138 +** Bindings are not cleared by the [sqlite3_reset()] routine.
  1.1139 +** Unbound parameters are interpreted as NULL.
  1.1140 +**
  1.1141 +** These routines return [SQLITE_OK] on success or an error code if
  1.1142 +** anything goes wrong.  [SQLITE_RANGE] is returned if the parameter
  1.1143 +** index is out of range.  [SQLITE_NOMEM] is returned if malloc fails.
  1.1144 +** [SQLITE_MISUSE] is returned if these routines are called on a virtual
  1.1145 +** machine that is the wrong state or which has already been finalized.
  1.1146 +*/
  1.1147 +int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));
  1.1148 +int sqlite3_bind_double(sqlite3_stmt*, int, double);
  1.1149 +int sqlite3_bind_int(sqlite3_stmt*, int, int);
  1.1150 +int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite_int64);
  1.1151 +int sqlite3_bind_null(sqlite3_stmt*, int);
  1.1152 +int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int n, void(*)(void*));
  1.1153 +int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*));
  1.1154 +int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
  1.1155 +int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
  1.1156 +
  1.1157 +/*
  1.1158 +** CAPI3REF: Number Of Host Parameters
  1.1159 +**
  1.1160 +** Return the largest host parameter index in the precompiled statement given
  1.1161 +** as the argument.  When the host parameters are of the forms like ":AAA"
  1.1162 +** or "?", then they are assigned sequential increasing numbers beginning
  1.1163 +** with one, so the value returned is the number of parameters.  However
  1.1164 +** if the same host parameter name is used multiple times, each occurrance
  1.1165 +** is given the same number, so the value returned in that case is the number
  1.1166 +** of unique host parameter names.  If host parameters of the form "?NNN"
  1.1167 +** are used (where NNN is an integer) then there might be gaps in the
  1.1168 +** numbering and the value returned by this interface is the index of the
  1.1169 +** host parameter with the largest index value.
  1.1170 +*/
  1.1171 +int sqlite3_bind_parameter_count(sqlite3_stmt*);
  1.1172 +
  1.1173 +/*
  1.1174 +** CAPI3REF: Name Of A Host Parameter
  1.1175 +**
  1.1176 +** This routine returns a pointer to the name of the n-th parameter in a 
  1.1177 +** [sqlite3_stmt | prepared statement].
  1.1178 +** Host parameters of the form ":AAA" or "@AAA" or "$VVV" have a name
  1.1179 +** which is the string ":AAA" or "@AAA" or "$VVV".  
  1.1180 +** In other words, the initial ":" or "$" or "@"
  1.1181 +** is included as part of the name.
  1.1182 +** Parameters of the form "?" or "?NNN" have no name.
  1.1183 +**
  1.1184 +** The first bound parameter has an index of 1, not 0.
  1.1185 +**
  1.1186 +** If the value n is out of range or if the n-th parameter is nameless,
  1.1187 +** then NULL is returned.  The returned string is always in the
  1.1188 +** UTF-8 encoding even if the named parameter was originally specified
  1.1189 +** as UTF-16 in [sqlite3_prepare16()] or [sqlite3_prepare16_v2()].
  1.1190 +*/
  1.1191 +const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int);
  1.1192 +
  1.1193 +/*
  1.1194 +** CAPI3REF: Index Of A Parameter With A Given Name
  1.1195 +**
  1.1196 +** This routine returns the index of a host parameter with the given name.
  1.1197 +** The name must match exactly.  If no parameter with the given name is 
  1.1198 +** found, return 0.  Parameter names must be UTF8.
  1.1199 +*/
  1.1200 +int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName);
  1.1201 +
  1.1202 +/*
  1.1203 +** CAPI3REF: Reset All Bindings On A Prepared Statement
  1.1204 +**
  1.1205 +** Contrary to the intuition of many, [sqlite3_reset()] does not
  1.1206 +** reset the [sqlite3_bind_blob | bindings] on a 
  1.1207 +** [sqlite3_stmt | prepared statement].  Use this routine to
  1.1208 +** reset all host parameters to NULL.
  1.1209 +*/
  1.1210 +int sqlite3_clear_bindings(sqlite3_stmt*);
  1.1211 +
  1.1212 +/*
  1.1213 +** CAPI3REF: Number Of Columns In A Result Set
  1.1214 +**
  1.1215 +** Return the number of columns in the result set returned by the 
  1.1216 +** [sqlite3_stmt | compiled SQL statement]. This routine returns 0
  1.1217 +** if pStmt is an SQL statement that does not return data (for 
  1.1218 +** example an UPDATE).
  1.1219 +*/
  1.1220 +int sqlite3_column_count(sqlite3_stmt *pStmt);
  1.1221 +
  1.1222 +/*
  1.1223 +** CAPI3REF: Column Names In A Result Set
  1.1224 +**
  1.1225 +** These routines return the name assigned to a particular column
  1.1226 +** in the result set of a SELECT statement.  The sqlite3_column_name()
  1.1227 +** interface returns a pointer to a UTF8 string and sqlite3_column_name16()
  1.1228 +** returns a pointer to a UTF16 string.  The first parameter is the
  1.1229 +** [sqlite_stmt | prepared statement] that implements the SELECT statement.
  1.1230 +** The second parameter is the column number.  The left-most column is
  1.1231 +** number 0.
  1.1232 +**
  1.1233 +** The returned string pointer is valid until either the 
  1.1234 +** [sqlite_stmt | prepared statement] is destroyed by [sqlite3_finalize()]
  1.1235 +** or until the next call sqlite3_column_name() or sqlite3_column_name16()
  1.1236 +** on the same column.
  1.1237 +*/
  1.1238 +const char *sqlite3_column_name(sqlite3_stmt*, int N);
  1.1239 +const void *sqlite3_column_name16(sqlite3_stmt*, int N);
  1.1240 +
  1.1241 +/*
  1.1242 +** CAPI3REF: Source Of Data In A Query Result
  1.1243 +**
  1.1244 +** These routines provide a means to determine what column of what
  1.1245 +** table in which database a result of a SELECT statement comes from.
  1.1246 +** The name of the database or table or column can be returned as
  1.1247 +** either a UTF8 or UTF16 string.  The _database_ routines return
  1.1248 +** the database name, the _table_ routines return the table name, and
  1.1249 +** the origin_ routines return the column name.
  1.1250 +** The returned string is valid until
  1.1251 +** the [sqlite3_stmt | prepared statement] is destroyed using
  1.1252 +** [sqlite3_finalize()] or until the same information is requested
  1.1253 +** again in a different encoding.
  1.1254 +**
  1.1255 +** The names returned are the original un-aliased names of the
  1.1256 +** database, table, and column.
  1.1257 +**
  1.1258 +** The first argument to the following calls is a 
  1.1259 +** [sqlite3_stmt | compiled SQL statement].
  1.1260 +** These functions return information about the Nth column returned by 
  1.1261 +** the statement, where N is the second function argument.
  1.1262 +**
  1.1263 +** If the Nth column returned by the statement is an expression
  1.1264 +** or subquery and is not a column value, then all of these functions
  1.1265 +** return NULL. Otherwise, they return the 
  1.1266 +** name of the attached database, table and column that query result
  1.1267 +** column was extracted from.
  1.1268 +**
  1.1269 +** As with all other SQLite APIs, those postfixed with "16" return UTF-16
  1.1270 +** encoded strings, the other functions return UTF-8.
  1.1271 +**
  1.1272 +** These APIs are only available if the library was compiled with the 
  1.1273 +** SQLITE_ENABLE_COLUMN_METADATA preprocessor symbol defined.
  1.1274 +*/
  1.1275 +const char *sqlite3_column_database_name(sqlite3_stmt*,int);
  1.1276 +const void *sqlite3_column_database_name16(sqlite3_stmt*,int);
  1.1277 +const char *sqlite3_column_table_name(sqlite3_stmt*,int);
  1.1278 +const void *sqlite3_column_table_name16(sqlite3_stmt*,int);
  1.1279 +const char *sqlite3_column_origin_name(sqlite3_stmt*,int);
  1.1280 +const void *sqlite3_column_origin_name16(sqlite3_stmt*,int);
  1.1281 +
  1.1282 +/*
  1.1283 +** CAPI3REF: Declared Datatype Of A Query Result
  1.1284 +**
  1.1285 +** The first parameter is a [sqlite3_stmt | compiled SQL statement]. 
  1.1286 +** If this statement is a SELECT statement and the Nth column of the 
  1.1287 +** returned result set  of that SELECT is a table column (not an
  1.1288 +** expression or subquery) then the declared type of the table
  1.1289 +** column is returned. If the Nth column of the result set is an
  1.1290 +** expression or subquery, then a NULL pointer is returned.
  1.1291 +** The returned string is always UTF-8 encoded. For example, in
  1.1292 +** the database schema:
  1.1293 +**
  1.1294 +** CREATE TABLE t1(c1 VARIANT);
  1.1295 +**
  1.1296 +** And the following statement compiled:
  1.1297 +**
  1.1298 +** SELECT c1 + 1, c1 FROM t1;
  1.1299 +**
  1.1300 +** Then this routine would return the string "VARIANT" for the second
  1.1301 +** result column (i==1), and a NULL pointer for the first result column
  1.1302 +** (i==0).
  1.1303 +**
  1.1304 +** SQLite uses dynamic run-time typing.  So just because a column
  1.1305 +** is declared to contain a particular type does not mean that the
  1.1306 +** data stored in that column is of the declared type.  SQLite is
  1.1307 +** strongly typed, but the typing is dynamic not static.  Type
  1.1308 +** is associated with individual values, not with the containers
  1.1309 +** used to hold those values.
  1.1310 +*/
  1.1311 +const char *sqlite3_column_decltype(sqlite3_stmt *, int i);
  1.1312 +const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
  1.1313 +
  1.1314 +/* 
  1.1315 +** CAPI3REF:  Evaluate An SQL Statement
  1.1316 +**
  1.1317 +** After an [sqlite3_stmt | SQL statement] has been prepared with a call
  1.1318 +** to either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] or to one of
  1.1319 +** the legacy interfaces [sqlite3_prepare()] or [sqlite3_prepare16()],
  1.1320 +** then this function must be called one or more times to evaluate the 
  1.1321 +** statement.
  1.1322 +**
  1.1323 +** The details of the behavior of this sqlite3_step() interface depend
  1.1324 +** on whether the statement was prepared using the newer "v2" interface
  1.1325 +** [sqlite3_prepare_v2()] and [sqlite3_prepare16_v2()] or the older legacy
  1.1326 +** interface [sqlite3_prepare()] and [sqlite3_prepare16()].  The use of the
  1.1327 +** new "v2" interface is recommended for new applications but the legacy
  1.1328 +** interface will continue to be supported.
  1.1329 +**
  1.1330 +** In the lagacy interface, the return value will be either [SQLITE_BUSY], 
  1.1331 +** [SQLITE_DONE], [SQLITE_ROW], [SQLITE_ERROR], or [SQLITE_MISUSE].
  1.1332 +** With the "v2" interface, any of the other [SQLITE_OK | result code]
  1.1333 +** or [SQLITE_IOERR_READ | extended result code] might be returned as
  1.1334 +** well.
  1.1335 +**
  1.1336 +** [SQLITE_BUSY] means that the database engine was unable to acquire the
  1.1337 +** database locks it needs to do its job.  If the statement is a COMMIT
  1.1338 +** or occurs outside of an explicit transaction, then you can retry the
  1.1339 +** statement.  If the statement is not a COMMIT and occurs within a
  1.1340 +** explicit transaction then you should rollback the transaction before
  1.1341 +** continuing.
  1.1342 +**
  1.1343 +** [SQLITE_DONE] means that the statement has finished executing
  1.1344 +** successfully.  sqlite3_step() should not be called again on this virtual
  1.1345 +** machine without first calling [sqlite3_reset()] to reset the virtual
  1.1346 +** machine back to its initial state.
  1.1347 +**
  1.1348 +** If the SQL statement being executed returns any data, then 
  1.1349 +** [SQLITE_ROW] is returned each time a new row of data is ready
  1.1350 +** for processing by the caller. The values may be accessed using
  1.1351 +** the [sqlite3_column_int | column access functions].
  1.1352 +** sqlite3_step() is called again to retrieve the next row of data.
  1.1353 +** 
  1.1354 +** [SQLITE_ERROR] means that a run-time error (such as a constraint
  1.1355 +** violation) has occurred.  sqlite3_step() should not be called again on
  1.1356 +** the VM. More information may be found by calling [sqlite3_errmsg()].
  1.1357 +** With the legacy interface, a more specific error code (example:
  1.1358 +** [SQLITE_INTERRUPT], [SQLITE_SCHEMA], [SQLITE_CORRUPT], and so forth)
  1.1359 +** can be obtained by calling [sqlite3_reset()] on the
  1.1360 +** [sqlite_stmt | prepared statement].  In the "v2" interface,
  1.1361 +** the more specific error code is returned directly by sqlite3_step().
  1.1362 +**
  1.1363 +** [SQLITE_MISUSE] means that the this routine was called inappropriately.
  1.1364 +** Perhaps it was called on a [sqlite_stmt | prepared statement] that has
  1.1365 +** already been [sqlite3_finalize | finalized] or on one that had 
  1.1366 +** previously returned [SQLITE_ERROR] or [SQLITE_DONE].  Or it could
  1.1367 +** be the case that the same database connection is being used by two or
  1.1368 +** more threads at the same moment in time.
  1.1369 +**
  1.1370 +** <b>Goofy Interface Alert:</b>
  1.1371 +** In the legacy interface, 
  1.1372 +** the sqlite3_step() API always returns a generic error code,
  1.1373 +** [SQLITE_ERROR], following any error other than [SQLITE_BUSY]
  1.1374 +** and [SQLITE_MISUSE].  You must call [sqlite3_reset()] or
  1.1375 +** [sqlite3_finalize()] in order to find one of the specific
  1.1376 +** [SQLITE_ERROR | result codes] that better describes the error.
  1.1377 +** We admit that this is a goofy design.  The problem has been fixed
  1.1378 +** with the "v2" interface.  If you prepare all of your SQL statements
  1.1379 +** using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] instead
  1.1380 +** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()], then the 
  1.1381 +** more specific [SQLITE_ERROR | result codes] are returned directly
  1.1382 +** by sqlite3_step().  The use of the "v2" interface is recommended.
  1.1383 +*/
  1.1384 +int sqlite3_step(sqlite3_stmt*);
  1.1385 +
  1.1386 +/*
  1.1387 +** CAPI3REF:
  1.1388 +**
  1.1389 +** Return the number of values in the current row of the result set.
  1.1390 +**
  1.1391 +** After a call to [sqlite3_step()] that returns [SQLITE_ROW], this routine
  1.1392 +** will return the same value as the [sqlite3_column_count()] function.
  1.1393 +** After [sqlite3_step()] has returned an [SQLITE_DONE], [SQLITE_BUSY], or
  1.1394 +** a [SQLITE_ERROR | error code], or before [sqlite3_step()] has been 
  1.1395 +** called on the [sqlite_stmt | prepared statement] for the first time,
  1.1396 +** this routine returns zero.
  1.1397 +*/
  1.1398 +int sqlite3_data_count(sqlite3_stmt *pStmt);
  1.1399 +
  1.1400 +/*
  1.1401 +** CAPI3REF: Fundamental Datatypes
  1.1402 +**
  1.1403 +** Every value in SQLite has one of five fundamental datatypes:
  1.1404 +**
  1.1405 +** <ul>
  1.1406 +** <li> 64-bit signed integer
  1.1407 +** <li> 64-bit IEEE floating point number
  1.1408 +** <li> string
  1.1409 +** <li> BLOB
  1.1410 +** <li> NULL
  1.1411 +** </ul>
  1.1412 +**
  1.1413 +** These constants are codes for each of those types.
  1.1414 +**
  1.1415 +** Note that the SQLITE_TEXT constant was also used in SQLite version 2
  1.1416 +** for a completely different meaning.  Software that links against both
  1.1417 +** SQLite version 2 and SQLite version 3 should use SQLITE3_TEXT not
  1.1418 +** SQLITE_TEXT.
  1.1419 +*/
  1.1420 +#define SQLITE_INTEGER  1
  1.1421 +#define SQLITE_FLOAT    2
  1.1422 +#define SQLITE_BLOB     4
  1.1423 +#define SQLITE_NULL     5
  1.1424 +#ifdef SQLITE_TEXT
  1.1425 +# undef SQLITE_TEXT
  1.1426 +#else
  1.1427 +# define SQLITE_TEXT     3
  1.1428 +#endif
  1.1429 +#define SQLITE3_TEXT     3
  1.1430 +
  1.1431 +/*
  1.1432 +** CAPI3REF: Results Values From A Query
  1.1433 +**
  1.1434 +** These routines return information about the information
  1.1435 +** in a single column of the current result row of a query.  In every
  1.1436 +** case the first argument is a pointer to the 
  1.1437 +** [sqlite3_stmt | SQL statement] that is being
  1.1438 +** evaluate (the [sqlite_stmt*] that was returned from 
  1.1439 +** [sqlite3_prepare_v2()] or one of its variants) and
  1.1440 +** the second argument is the index of the column for which information 
  1.1441 +** should be returned.  The left-most column has an index of 0.
  1.1442 +**
  1.1443 +** If the SQL statement is not currently point to a valid row, or if the
  1.1444 +** the column index is out of range, the result is undefined.
  1.1445 +**
  1.1446 +** The sqlite3_column_type() routine returns 
  1.1447 +** [SQLITE_INTEGER | datatype code] for the initial data type
  1.1448 +** of the result column.  The returned value is one of [SQLITE_INTEGER],
  1.1449 +** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].  The value
  1.1450 +** returned by sqlite3_column_type() is only meaningful if no type
  1.1451 +** conversions have occurred as described below.  After a type conversion,
  1.1452 +** the value returned by sqlite3_column_type() is undefined.  Future
  1.1453 +** versions of SQLite may change the behavior of sqlite3_column_type()
  1.1454 +** following a type conversion.
  1.1455 +**
  1.1456 +** If the result is a BLOB or UTF-8 string then the sqlite3_column_bytes() 
  1.1457 +** routine returns the number of bytes in that BLOB or string.
  1.1458 +** If the result is a UTF-16 string, then sqlite3_column_bytes() converts
  1.1459 +** the string to UTF-8 and then returns the number of bytes.
  1.1460 +** If the result is a numeric value then sqlite3_column_bytes() uses
  1.1461 +** [sqlite3_snprintf()] to convert that value to a UTF-8 string and returns
  1.1462 +** the number of bytes in that string.
  1.1463 +** The value returned does not include the zero terminator at the end
  1.1464 +** of the string.  For clarity: the value returned is the number of
  1.1465 +** bytes in the string, not the number of characters.
  1.1466 +**
  1.1467 +** The sqlite3_column_bytes16() routine is similar to sqlite3_column_bytes()
  1.1468 +** but leaves the result in UTF-16 instead of UTF-8.  
  1.1469 +** The zero terminator is not included in this count.
  1.1470 +**
  1.1471 +** These routines attempt to convert the value where appropriate.  For
  1.1472 +** example, if the internal representation is FLOAT and a text result
  1.1473 +** is requested, [sqlite3_snprintf()] is used internally to do the conversion
  1.1474 +** automatically.  The following table details the conversions that
  1.1475 +** are applied:
  1.1476 +**
  1.1477 +** <blockquote>
  1.1478 +** <table border="1">
  1.1479 +** <tr><th> Internal <th> Requested <th> 
  1.1480 +** <tr><th>  Type    <th>    Type   <th> Conversion
  1.1481 +**
  1.1482 +** <tr><td>  NULL    <td> INTEGER   <td> Result is 0
  1.1483 +** <tr><td>  NULL    <td>  FLOAT    <td> Result is 0.0
  1.1484 +** <tr><td>  NULL    <td>   TEXT    <td> Result is NULL pointer
  1.1485 +** <tr><td>  NULL    <td>   BLOB    <td> Result is NULL pointer
  1.1486 +** <tr><td> INTEGER  <td>  FLOAT    <td> Convert from integer to float
  1.1487 +** <tr><td> INTEGER  <td>   TEXT    <td> ASCII rendering of the integer
  1.1488 +** <tr><td> INTEGER  <td>   BLOB    <td> Same as for INTEGER->TEXT
  1.1489 +** <tr><td>  FLOAT   <td> INTEGER   <td> Convert from float to integer
  1.1490 +** <tr><td>  FLOAT   <td>   TEXT    <td> ASCII rendering of the float
  1.1491 +** <tr><td>  FLOAT   <td>   BLOB    <td> Same as FLOAT->TEXT
  1.1492 +** <tr><td>  TEXT    <td> INTEGER   <td> Use atoi()
  1.1493 +** <tr><td>  TEXT    <td>  FLOAT    <td> Use atof()
  1.1494 +** <tr><td>  TEXT    <td>   BLOB    <td> No change
  1.1495 +** <tr><td>  BLOB    <td> INTEGER   <td> Convert to TEXT then use atoi()
  1.1496 +** <tr><td>  BLOB    <td>  FLOAT    <td> Convert to TEXT then use atof()
  1.1497 +** <tr><td>  BLOB    <td>   TEXT    <td> Add a zero terminator if needed
  1.1498 +** </table>
  1.1499 +** </blockquote>
  1.1500 +**
  1.1501 +** The table above makes reference to standard C library functions atoi()
  1.1502 +** and atof().  SQLite does not really use these functions.  It has its
  1.1503 +** on equavalent internal routines.  The atoi() and atof() names are
  1.1504 +** used in the table for brevity and because they are familiar to most
  1.1505 +** C programmers.
  1.1506 +**
  1.1507 +** Note that when type conversions occur, pointers returned by prior
  1.1508 +** calls to sqlite3_column_blob(), sqlite3_column_text(), and/or
  1.1509 +** sqlite3_column_text16() may be invalidated. 
  1.1510 +** Type conversions and pointer invalidations might occur
  1.1511 +** in the following cases:
  1.1512 +**
  1.1513 +** <ul>
  1.1514 +** <li><p>  The initial content is a BLOB and sqlite3_column_text() 
  1.1515 +**          or sqlite3_column_text16() is called.  A zero-terminator might
  1.1516 +**          need to be added to the string.</p></li>
  1.1517 +**
  1.1518 +** <li><p>  The initial content is UTF-8 text and sqlite3_column_bytes16() or
  1.1519 +**          sqlite3_column_text16() is called.  The content must be converted
  1.1520 +**          to UTF-16.</p></li>
  1.1521 +**
  1.1522 +** <li><p>  The initial content is UTF-16 text and sqlite3_column_bytes() or
  1.1523 +**          sqlite3_column_text() is called.  The content must be converted
  1.1524 +**          to UTF-8.</p></li>
  1.1525 +** </ul>
  1.1526 +**
  1.1527 +** Conversions between UTF-16be and UTF-16le are always done in place and do
  1.1528 +** not invalidate a prior pointer, though of course the content of the buffer
  1.1529 +** that the prior pointer points to will have been modified.  Other kinds
  1.1530 +** of conversion are done in place when it is possible, but sometime it is
  1.1531 +** not possible and in those cases prior pointers are invalidated.  
  1.1532 +**
  1.1533 +** The safest and easiest to remember policy is to invoke these routines
  1.1534 +** in one of the following ways:
  1.1535 +**
  1.1536 +**  <ul>
  1.1537 +**  <li>sqlite3_column_text() followed by sqlite3_column_bytes()</li>
  1.1538 +**  <li>sqlite3_column_blob() followed by sqlite3_column_bytes()</li>
  1.1539 +**  <li>sqlite3_column_text16() followed by sqlite3_column_bytes16()</li>
  1.1540 +**  </ul>
  1.1541 +**
  1.1542 +** In other words, you should call sqlite3_column_text(), sqlite3_column_blob(),
  1.1543 +** or sqlite3_column_text16() first to force the result into the desired
  1.1544 +** format, then invoke sqlite3_column_bytes() or sqlite3_column_bytes16() to
  1.1545 +** find the size of the result.  Do not mix call to sqlite3_column_text() or
  1.1546 +** sqlite3_column_blob() with calls to sqlite3_column_bytes16().  And do not
  1.1547 +** mix calls to sqlite3_column_text16() with calls to sqlite3_column_bytes().
  1.1548 +*/
  1.1549 +const void *sqlite3_column_blob(sqlite3_stmt*, int iCol);
  1.1550 +int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
  1.1551 +int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
  1.1552 +double sqlite3_column_double(sqlite3_stmt*, int iCol);
  1.1553 +int sqlite3_column_int(sqlite3_stmt*, int iCol);
  1.1554 +sqlite_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol);
  1.1555 +const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol);
  1.1556 +const void *sqlite3_column_text16(sqlite3_stmt*, int iCol);
  1.1557 +int sqlite3_column_type(sqlite3_stmt*, int iCol);
  1.1558 +sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol);
  1.1559 +
  1.1560 +/*
  1.1561 +** CAPI3REF: Destroy A Prepared Statement Object
  1.1562 +**
  1.1563 +** The sqlite3_finalize() function is called to delete a 
  1.1564 +** [sqlite3_stmt | compiled SQL statement]. If the statement was
  1.1565 +** executed successfully, or not executed at all, then SQLITE_OK is returned.
  1.1566 +** If execution of the statement failed then an 
  1.1567 +** [SQLITE_ERROR | error code] or [SQLITE_IOERR_READ | extended error code]
  1.1568 +** is returned. 
  1.1569 +**
  1.1570 +** This routine can be called at any point during the execution of the
  1.1571 +** [sqlite3_stmt | virtual machine].  If the virtual machine has not 
  1.1572 +** completed execution when this routine is called, that is like
  1.1573 +** encountering an error or an interrupt.  (See [sqlite3_interrupt()].) 
  1.1574 +** Incomplete updates may be rolled back and transactions cancelled,  
  1.1575 +** depending on the circumstances, and the 
  1.1576 +** [SQLITE_ERROR | result code] returned will be [SQLITE_ABORT].
  1.1577 +*/
  1.1578 +int sqlite3_finalize(sqlite3_stmt *pStmt);
  1.1579 +
  1.1580 +/*
  1.1581 +** CAPI3REF: Reset A Prepared Statement Object
  1.1582 +**
  1.1583 +** The sqlite3_reset() function is called to reset a 
  1.1584 +** [sqlite_stmt | compiled SQL statement] object.
  1.1585 +** back to it's initial state, ready to be re-executed.
  1.1586 +** Any SQL statement variables that had values bound to them using
  1.1587 +** the [sqlite3_bind_blob | sqlite3_bind_*() API] retain their values.
  1.1588 +** Use [sqlite3_clear_bindings()] to reset the bindings.
  1.1589 +*/
  1.1590 +int sqlite3_reset(sqlite3_stmt *pStmt);
  1.1591 +
  1.1592 +/*
  1.1593 +** CAPI3REF: Create Or Redefine SQL Functions
  1.1594 +**
  1.1595 +** The following two functions are used to add SQL functions or aggregates
  1.1596 +** or to redefine the behavior of existing SQL functions or aggregates.  The
  1.1597 +** difference only between the two is that the second parameter, the
  1.1598 +** name of the (scalar) function or aggregate, is encoded in UTF-8 for
  1.1599 +** sqlite3_create_function() and UTF-16 for sqlite3_create_function16().
  1.1600 +**
  1.1601 +** The first argument is the [sqlite3 | database handle] that holds the
  1.1602 +** SQL function or aggregate is to be added or redefined. If a single
  1.1603 +** program uses more than one database handle internally, then SQL
  1.1604 +** functions or aggregates must be added individually to each database
  1.1605 +** handle with which they will be used.
  1.1606 +**
  1.1607 +** The second parameter is the name of the SQL function to be created
  1.1608 +** or redefined.
  1.1609 +** The length of the name is limited to 255 bytes, exclusive of the 
  1.1610 +** zero-terminator.  Note that the name length limit is in bytes, not
  1.1611 +** characters.  Any attempt to create a function with a longer name
  1.1612 +** will result in an SQLITE_ERROR error.
  1.1613 +**
  1.1614 +** The third parameter is the number of arguments that the SQL function or
  1.1615 +** aggregate takes. If this parameter is negative, then the SQL function or
  1.1616 +** aggregate may take any number of arguments.
  1.1617 +**
  1.1618 +** The fourth parameter, eTextRep, specifies what 
  1.1619 +** [SQLITE_UTF8 | text encoding] this SQL function prefers for
  1.1620 +** its parameters.  Any SQL function implementation should be able to work
  1.1621 +** work with UTF-8, UTF-16le, or UTF-16be.  But some implementations may be
  1.1622 +** more efficient with one encoding than another.  It is allowed to
  1.1623 +** invoke sqlite_create_function() or sqlite3_create_function16() multiple
  1.1624 +** times with the same function but with different values of eTextRep.
  1.1625 +** When multiple implementations of the same function are available, SQLite
  1.1626 +** will pick the one that involves the least amount of data conversion.
  1.1627 +** If there is only a single implementation which does not care what
  1.1628 +** text encoding is used, then the fourth argument should be
  1.1629 +** [SQLITE_ANY].
  1.1630 +**
  1.1631 +** The fifth parameter is an arbitrary pointer.  The implementation
  1.1632 +** of the function can gain access to this pointer using
  1.1633 +** [sqlite_user_data()].
  1.1634 +**
  1.1635 +** The seventh, eighth and ninth parameters, xFunc, xStep and xFinal, are
  1.1636 +** pointers to C-language functions that implement the SQL
  1.1637 +** function or aggregate. A scalar SQL function requires an implementation of
  1.1638 +** the xFunc callback only, NULL pointers should be passed as the xStep
  1.1639 +** and xFinal parameters. An aggregate SQL function requires an implementation
  1.1640 +** of xStep and xFinal and NULL should be passed for xFunc. To delete an
  1.1641 +** existing SQL function or aggregate, pass NULL for all three function
  1.1642 +** callback.
  1.1643 +**
  1.1644 +** It is permitted to register multiple implementations of the same
  1.1645 +** functions with the same name but with either differing numbers of
  1.1646 +** arguments or differing perferred text encodings.  SQLite will use
  1.1647 +** the implementation most closely matches the way in which the
  1.1648 +** SQL function is used.
  1.1649 +*/
  1.1650 +int sqlite3_create_function(
  1.1651 +  sqlite3 *,
  1.1652 +  const char *zFunctionName,
  1.1653 +  int nArg,
  1.1654 +  int eTextRep,
  1.1655 +  void*,
  1.1656 +  void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
  1.1657 +  void (*xStep)(sqlite3_context*,int,sqlite3_value**),
  1.1658 +  void (*xFinal)(sqlite3_context*)
  1.1659 +);
  1.1660 +int sqlite3_create_function16(
  1.1661 +  sqlite3*,
  1.1662 +  const void *zFunctionName,
  1.1663 +  int nArg,
  1.1664 +  int eTextRep,
  1.1665 +  void*,
  1.1666 +  void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
  1.1667 +  void (*xStep)(sqlite3_context*,int,sqlite3_value**),
  1.1668 +  void (*xFinal)(sqlite3_context*)
  1.1669 +);
  1.1670 +
  1.1671 +/*
  1.1672 +** CAPI3REF: Text Encodings
  1.1673 +**
  1.1674 +** These constant define integer codes that represent the various
  1.1675 +** text encodings supported by SQLite.
  1.1676 +*/
  1.1677 +#define SQLITE_UTF8           1
  1.1678 +#define SQLITE_UTF16LE        2
  1.1679 +#define SQLITE_UTF16BE        3
  1.1680 +#define SQLITE_UTF16          4    /* Use native byte order */
  1.1681 +#define SQLITE_ANY            5    /* sqlite3_create_function only */
  1.1682 +#define SQLITE_UTF16_ALIGNED  8    /* sqlite3_create_collation only */
  1.1683 +
  1.1684 +/*
  1.1685 +** CAPI3REF: Obsolete Functions
  1.1686 +**
  1.1687 +** These functions are all now obsolete.  In order to maintain
  1.1688 +** backwards compatibility with older code, we continue to support
  1.1689 +** these functions.  However, new development projects should avoid
  1.1690 +** the use of these functions.  To help encourage people to avoid
  1.1691 +** using these functions, we are not going to tell you want they do.
  1.1692 +*/
  1.1693 +int sqlite3_aggregate_count(sqlite3_context*);
  1.1694 +int sqlite3_expired(sqlite3_stmt*);
  1.1695 +int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*);
  1.1696 +int sqlite3_global_recover(void);
  1.1697 +
  1.1698 +
  1.1699 +/*
  1.1700 +** CAPI3REF: Obtaining SQL Function Parameter Values
  1.1701 +**
  1.1702 +** The C-language implementation of SQL functions and aggregates uses
  1.1703 +** this set of interface routines to access the parameter values on
  1.1704 +** the function or aggregate.
  1.1705 +**
  1.1706 +** The xFunc (for scalar functions) or xStep (for aggregates) parameters
  1.1707 +** to [sqlite3_create_function()] and [sqlite3_create_function16()]
  1.1708 +** define callbacks that implement the SQL functions and aggregates.
  1.1709 +** The 4th parameter to these callbacks is an array of pointers to
  1.1710 +** [sqlite3_value] objects.  There is one [sqlite3_value] object for
  1.1711 +** each parameter to the SQL function.  These routines are used to
  1.1712 +** extract values from the [sqlite3_value] objects.
  1.1713 +**
  1.1714 +** These routines work just like the corresponding 
  1.1715 +** [sqlite3_column_blob | sqlite3_column_* routines] except that 
  1.1716 +** these routines take a single [sqlite3_value*] pointer instead
  1.1717 +** of an [sqlite3_stmt*] pointer and an integer column number.
  1.1718 +**
  1.1719 +** The sqlite3_value_text16() interface extracts a UTF16 string
  1.1720 +** in the native byte-order of the host machine.  The
  1.1721 +** sqlite3_value_text16be() and sqlite3_value_text16le() interfaces
  1.1722 +** extract UTF16 strings as big-endian and little-endian respectively.
  1.1723 +**
  1.1724 +** The sqlite3_value_numeric_type() interface attempts to apply
  1.1725 +** numeric affinity to the value.  This means that an attempt is
  1.1726 +** made to convert the value to an integer or floating point.  If
  1.1727 +** such a conversion is possible without loss of information (in order
  1.1728 +** words if the value is original a string that looks like a number)
  1.1729 +** then it is done.  Otherwise no conversion occurs.  The 
  1.1730 +** [SQLITE_INTEGER | datatype] after conversion is returned.
  1.1731 +**
  1.1732 +** Please pay particular attention to the fact that the pointer that
  1.1733 +** is returned from [sqlite3_value_blob()], [sqlite3_value_text()], or
  1.1734 +** [sqlite3_value_text16()] can be invalidated by a subsequent call to
  1.1735 +** [sqlite3_value_bytes()], [sqlite3_value_bytes16()], [sqlite_value_text()],
  1.1736 +** or [sqlite3_value_text16()].  
  1.1737 +*/
  1.1738 +const void *sqlite3_value_blob(sqlite3_value*);
  1.1739 +int sqlite3_value_bytes(sqlite3_value*);
  1.1740 +int sqlite3_value_bytes16(sqlite3_value*);
  1.1741 +double sqlite3_value_double(sqlite3_value*);
  1.1742 +int sqlite3_value_int(sqlite3_value*);
  1.1743 +sqlite_int64 sqlite3_value_int64(sqlite3_value*);
  1.1744 +const unsigned char *sqlite3_value_text(sqlite3_value*);
  1.1745 +const void *sqlite3_value_text16(sqlite3_value*);
  1.1746 +const void *sqlite3_value_text16le(sqlite3_value*);
  1.1747 +const void *sqlite3_value_text16be(sqlite3_value*);
  1.1748 +int sqlite3_value_type(sqlite3_value*);
  1.1749 +int sqlite3_value_numeric_type(sqlite3_value*);
  1.1750 +
  1.1751 +/*
  1.1752 +** CAPI3REF: Obtain Aggregate Function Context
  1.1753 +**
  1.1754 +** The implementation of aggregate SQL functions use this routine to allocate
  1.1755 +** a structure for storing their state.  The first time this routine
  1.1756 +** is called for a particular aggregate, a new structure of size nBytes
  1.1757 +** is allocated, zeroed, and returned.  On subsequent calls (for the
  1.1758 +** same aggregate instance) the same buffer is returned.  The implementation
  1.1759 +** of the aggregate can use the returned buffer to accumulate data.
  1.1760 +**
  1.1761 +** The buffer allocated is freed automatically by SQLite whan the aggregate
  1.1762 +** query concludes.
  1.1763 +**
  1.1764 +** The first parameter should be a copy of the 
  1.1765 +** [sqlite3_context | SQL function context] that is the first
  1.1766 +** parameter to the callback routine that implements the aggregate
  1.1767 +** function.
  1.1768 +*/
  1.1769 +void *sqlite3_aggregate_context(sqlite3_context*, int nBytes);
  1.1770 +
  1.1771 +/*
  1.1772 +** CAPI3REF: User Data For Functions
  1.1773 +**
  1.1774 +** The pUserData parameter to the [sqlite3_create_function()]
  1.1775 +** and [sqlite3_create_function16()] routines
  1.1776 +** used to register user functions is available to
  1.1777 +** the implementation of the function using this call.
  1.1778 +*/
  1.1779 +void *sqlite3_user_data(sqlite3_context*);
  1.1780 +
  1.1781 +/*
  1.1782 +** CAPI3REF: Function Auxiliary Data
  1.1783 +**
  1.1784 +** The following two functions may be used by scalar SQL functions to
  1.1785 +** associate meta-data with argument values. If the same value is passed to
  1.1786 +** multiple invocations of the same SQL function during query execution, under
  1.1787 +** some circumstances the associated meta-data may be preserved. This may
  1.1788 +** be used, for example, to add a regular-expression matching scalar
  1.1789 +** function. The compiled version of the regular expression is stored as
  1.1790 +** meta-data associated with the SQL value passed as the regular expression
  1.1791 +** pattern.  The compiled regular expression can be reused on multiple
  1.1792 +** invocations of the same function so that the original pattern string
  1.1793 +** does not need to be recompiled on each invocation.
  1.1794 +**
  1.1795 +** The sqlite3_get_auxdata() interface returns a pointer to the meta-data
  1.1796 +** associated with the Nth argument value to the current SQL function
  1.1797 +** call, where N is the second parameter. If no meta-data has been set for
  1.1798 +** that value, then a NULL pointer is returned.
  1.1799 +**
  1.1800 +** The sqlite3_set_auxdata() is used to associate meta-data with an SQL
  1.1801 +** function argument. The third parameter is a pointer to the meta-data
  1.1802 +** to be associated with the Nth user function argument value. The fourth
  1.1803 +** parameter specifies a destructor that will be called on the meta-
  1.1804 +** data pointer to release it when it is no longer required. If the 
  1.1805 +** destructor is NULL, it is not invoked.
  1.1806 +**
  1.1807 +** In practice, meta-data is preserved between function calls for
  1.1808 +** expressions that are constant at compile time. This includes literal
  1.1809 +** values and SQL variables.
  1.1810 +*/
  1.1811 +void *sqlite3_get_auxdata(sqlite3_context*, int);
  1.1812 +void sqlite3_set_auxdata(sqlite3_context*, int, void*, void (*)(void*));
  1.1813 +
  1.1814 +
  1.1815 +/*
  1.1816 +** CAPI3REF: Constants Defining Special Destructor Behavior
  1.1817 +**
  1.1818 +** These are special value for the destructor that is passed in as the
  1.1819 +** final argument to routines like [sqlite3_result_blob()].  If the destructor
  1.1820 +** argument is SQLITE_STATIC, it means that the content pointer is constant
  1.1821 +** and will never change.  It does not need to be destroyed.  The 
  1.1822 +** SQLITE_TRANSIENT value means that the content will likely change in
  1.1823 +** the near future and that SQLite should make its own private copy of
  1.1824 +** the content before returning.
  1.1825 +**
  1.1826 +** The typedef is necessary to work around problems in certain
  1.1827 +** C++ compilers.  See ticket #2191.
  1.1828 +*/
  1.1829 +typedef void (*sqlite3_destructor_type)(void*);
  1.1830 +#define SQLITE_STATIC      ((sqlite3_destructor_type)0)
  1.1831 +#define SQLITE_TRANSIENT   ((sqlite3_destructor_type)-1)
  1.1832 +
  1.1833 +/*
  1.1834 +** CAPI3REF: Setting The Result Of An SQL Function
  1.1835 +**
  1.1836 +** These routines are used by the xFunc or xFinal callbacks that
  1.1837 +** implement SQL functions and aggregates.  See
  1.1838 +** [sqlite3_create_function()] and [sqlite3_create_function16()]
  1.1839 +** for additional information.
  1.1840 +**
  1.1841 +** These functions work very much like the 
  1.1842 +** [sqlite3_bind_blob | sqlite3_bind_*] family of functions used
  1.1843 +** to bind values to host parameters in prepared statements.
  1.1844 +** Refer to the
  1.1845 +** [sqlite3_bind_blob | sqlite3_bind_* documentation] for
  1.1846 +** additional information.
  1.1847 +**
  1.1848 +** The sqlite3_result_error() and sqlite3_result_error16() functions
  1.1849 +** cause the implemented SQL function to throw an exception.  The
  1.1850 +** parameter to sqlite3_result_error() or sqlite3_result_error16()
  1.1851 +** is the text of an error message.
  1.1852 +**
  1.1853 +** The sqlite3_result_toobig() cause the function implementation
  1.1854 +** to throw and error indicating that a string or BLOB is to long
  1.1855 +** to represent.
  1.1856 +*/
  1.1857 +void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));
  1.1858 +void sqlite3_result_double(sqlite3_context*, double);
  1.1859 +void sqlite3_result_error(sqlite3_context*, const char*, int);
  1.1860 +void sqlite3_result_error16(sqlite3_context*, const void*, int);
  1.1861 +void sqlite3_result_error_toobig(sqlite3_context*);
  1.1862 +void sqlite3_result_int(sqlite3_context*, int);
  1.1863 +void sqlite3_result_int64(sqlite3_context*, sqlite_int64);
  1.1864 +void sqlite3_result_null(sqlite3_context*);
  1.1865 +void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*));
  1.1866 +void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*));
  1.1867 +void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));
  1.1868 +void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*));
  1.1869 +void sqlite3_result_value(sqlite3_context*, sqlite3_value*);
  1.1870 +void sqlite3_result_zeroblob(sqlite3_context*, int n);
  1.1871 +
  1.1872 +/*
  1.1873 +** CAPI3REF: Define New Collating Sequences
  1.1874 +**
  1.1875 +** These functions are used to add new collation sequences to the
  1.1876 +** [sqlite3*] handle specified as the first argument. 
  1.1877 +**
  1.1878 +** The name of the new collation sequence is specified as a UTF-8 string
  1.1879 +** for sqlite3_create_collation() and sqlite3_create_collation_v2()
  1.1880 +** and a UTF-16 string for sqlite3_create_collation16().  In all cases
  1.1881 +** the name is passed as the second function argument.
  1.1882 +**
  1.1883 +** The third argument must be one of the constants [SQLITE_UTF8],
  1.1884 +** [SQLITE_UTF16LE] or [SQLITE_UTF16BE], indicating that the user-supplied
  1.1885 +** routine expects to be passed pointers to strings encoded using UTF-8,
  1.1886 +** UTF-16 little-endian or UTF-16 big-endian respectively.
  1.1887 +**
  1.1888 +** A pointer to the user supplied routine must be passed as the fifth
  1.1889 +** argument. If it is NULL, this is the same as deleting the collation
  1.1890 +** sequence (so that SQLite cannot call it anymore). Each time the user
  1.1891 +** supplied function is invoked, it is passed a copy of the void* passed as
  1.1892 +** the fourth argument to sqlite3_create_collation() or
  1.1893 +** sqlite3_create_collation16() as its first parameter.
  1.1894 +**
  1.1895 +** The remaining arguments to the user-supplied routine are two strings,
  1.1896 +** each represented by a [length, data] pair and encoded in the encoding
  1.1897 +** that was passed as the third argument when the collation sequence was
  1.1898 +** registered. The user routine should return negative, zero or positive if
  1.1899 +** the first string is less than, equal to, or greater than the second
  1.1900 +** string. i.e. (STRING1 - STRING2).
  1.1901 +**
  1.1902 +** The sqlite3_create_collation_v2() works like sqlite3_create_collation()
  1.1903 +** excapt that it takes an extra argument which is a destructor for
  1.1904 +** the collation.  The destructor is called when the collation is
  1.1905 +** destroyed and is passed a copy of the fourth parameter void* pointer
  1.1906 +** of the sqlite3_create_collation_v2().  Collations are destroyed when
  1.1907 +** they are overridden by later calls to the collation creation functions
  1.1908 +** or when the [sqlite3*] database handle is closed using [sqlite3_close()].
  1.1909 +**
  1.1910 +** The sqlite3_create_collation_v2() interface is experimental and
  1.1911 +** subject to change in future releases.  The other collation creation
  1.1912 +** functions are stable.
  1.1913 +*/
  1.1914 +int sqlite3_create_collation(
  1.1915 +  sqlite3*, 
  1.1916 +  const char *zName, 
  1.1917 +  int eTextRep, 
  1.1918 +  void*,
  1.1919 +  int(*xCompare)(void*,int,const void*,int,const void*)
  1.1920 +);
  1.1921 +int sqlite3_create_collation_v2(
  1.1922 +  sqlite3*, 
  1.1923 +  const char *zName, 
  1.1924 +  int eTextRep, 
  1.1925 +  void*,
  1.1926 +  int(*xCompare)(void*,int,const void*,int,const void*),
  1.1927 +  void(*xDestroy)(void*)
  1.1928 +);
  1.1929 +int sqlite3_create_collation16(
  1.1930 +  sqlite3*, 
  1.1931 +  const char *zName, 
  1.1932 +  int eTextRep, 
  1.1933 +  void*,
  1.1934 +  int(*xCompare)(void*,int,const void*,int,const void*)
  1.1935 +);
  1.1936 +
  1.1937 +/*
  1.1938 +** CAPI3REF: Collation Needed Callbacks
  1.1939 +**
  1.1940 +** To avoid having to register all collation sequences before a database
  1.1941 +** can be used, a single callback function may be registered with the
  1.1942 +** database handle to be called whenever an undefined collation sequence is
  1.1943 +** required.
  1.1944 +**
  1.1945 +** If the function is registered using the sqlite3_collation_needed() API,
  1.1946 +** then it is passed the names of undefined collation sequences as strings
  1.1947 +** encoded in UTF-8. If sqlite3_collation_needed16() is used, the names
  1.1948 +** are passed as UTF-16 in machine native byte order. A call to either
  1.1949 +** function replaces any existing callback.
  1.1950 +**
  1.1951 +** When the callback is invoked, the first argument passed is a copy
  1.1952 +** of the second argument to sqlite3_collation_needed() or
  1.1953 +** sqlite3_collation_needed16(). The second argument is the database
  1.1954 +** handle. The third argument is one of [SQLITE_UTF8], [SQLITE_UTF16BE], or
  1.1955 +** [SQLITE_UTF16LE], indicating the most desirable form of the collation
  1.1956 +** sequence function required. The fourth parameter is the name of the
  1.1957 +** required collation sequence.
  1.1958 +**
  1.1959 +** The callback function should register the desired collation using
  1.1960 +** [sqlite3_create_collation()], [sqlite3_create_collation16()], or
  1.1961 +** [sqlite3_create_collation_v2()].
  1.1962 +*/
  1.1963 +int sqlite3_collation_needed(
  1.1964 +  sqlite3*, 
  1.1965 +  void*, 
  1.1966 +  void(*)(void*,sqlite3*,int eTextRep,const char*)
  1.1967 +);
  1.1968 +int sqlite3_collation_needed16(
  1.1969 +  sqlite3*, 
  1.1970 +  void*,
  1.1971 +  void(*)(void*,sqlite3*,int eTextRep,const void*)
  1.1972 +);
  1.1973 +
  1.1974 +/*
  1.1975 +** Specify the key for an encrypted database.  This routine should be
  1.1976 +** called right after sqlite3_open().
  1.1977 +**
  1.1978 +** The code to implement this API is not available in the public release
  1.1979 +** of SQLite.
  1.1980 +*/
  1.1981 +int sqlite3_key(
  1.1982 +  sqlite3 *db,                   /* Database to be rekeyed */
  1.1983 +  const void *pKey, int nKey     /* The key */
  1.1984 +);
  1.1985 +
  1.1986 +/*
  1.1987 +** Change the key on an open database.  If the current database is not
  1.1988 +** encrypted, this routine will encrypt it.  If pNew==0 or nNew==0, the
  1.1989 +** database is decrypted.
  1.1990 +**
  1.1991 +** The code to implement this API is not available in the public release
  1.1992 +** of SQLite.
  1.1993 +*/
  1.1994 +int sqlite3_rekey(
  1.1995 +  sqlite3 *db,                   /* Database to be rekeyed */
  1.1996 +  const void *pKey, int nKey     /* The new key */
  1.1997 +);
  1.1998 +
  1.1999 +/*
  1.2000 +** CAPI3REF:  Suspend Execution For A Short Time
  1.2001 +**
  1.2002 +** This function causes the current thread to suspend execution
  1.2003 +** a number of milliseconds specified in its parameter.
  1.2004 +**
  1.2005 +** If the operating system does not support sleep requests with 
  1.2006 +** millisecond time resolution, then the time will be rounded up to 
  1.2007 +** the nearest second. The number of milliseconds of sleep actually 
  1.2008 +** requested from the operating system is returned.
  1.2009 +*/
  1.2010 +int sqlite3_sleep(int);
  1.2011 +
  1.2012 +/*
  1.2013 +** CAPI3REF:  Name Of The Folder Holding Temporary Files
  1.2014 +**
  1.2015 +** If this global variable is made to point to a string which is
  1.2016 +** the name of a folder (a.ka. directory), then all temporary files
  1.2017 +** created by SQLite will be placed in that directory.  If this variable
  1.2018 +** is NULL pointer, then SQLite does a search for an appropriate temporary
  1.2019 +** file directory.
  1.2020 +**
  1.2021 +** Once [sqlite3_open()] has been called, changing this variable will
  1.2022 +** invalidate the current temporary database, if any.  Generally speaking,
  1.2023 +** it is not safe to invoke this routine after [sqlite3_open()] has
  1.2024 +** been called.
  1.2025 +*/
  1.2026 +extern char *sqlite3_temp_directory;
  1.2027 +
  1.2028 +/*
  1.2029 +** CAPI3REF:  Test To See If The Databse Is In Auto-Commit Mode
  1.2030 +**
  1.2031 +** Test to see whether or not the database connection is in autocommit
  1.2032 +** mode.  Return TRUE if it is and FALSE if not.  Autocommit mode is on
  1.2033 +** by default.  Autocommit is disabled by a BEGIN statement and reenabled
  1.2034 +** by the next COMMIT or ROLLBACK.
  1.2035 +*/
  1.2036 +int sqlite3_get_autocommit(sqlite3*);
  1.2037 +
  1.2038 +/*
  1.2039 +** CAPI3REF:  Find The Database Handle Associated With A Prepared Statement
  1.2040 +**
  1.2041 +** Return the [sqlite3*] database handle to which a
  1.2042 +** [sqlite3_stmt | prepared statement] belongs.
  1.2043 +** This is the same database handle that was
  1.2044 +** the first argument to the [sqlite3_prepare_v2()] or its variants
  1.2045 +** that was used to create the statement in the first place.
  1.2046 +*/
  1.2047 +sqlite3 *sqlite3_db_handle(sqlite3_stmt*);
  1.2048 +
  1.2049 +
  1.2050 +/*
  1.2051 +** CAPI3REF: Commit And Rollback Notification Callbacks
  1.2052 +**
  1.2053 +** These routines
  1.2054 +** register callback functions to be invoked whenever a transaction
  1.2055 +** is committed or rolled back.  The pArg argument is passed through
  1.2056 +** to the callback.  If the callback on a commit hook function 
  1.2057 +** returns non-zero, then the commit is converted into a rollback.
  1.2058 +**
  1.2059 +** If another function was previously registered, its pArg value is returned.
  1.2060 +** Otherwise NULL is returned.
  1.2061 +**
  1.2062 +** Registering a NULL function disables the callback.
  1.2063 +**
  1.2064 +** For the purposes of this API, a transaction is said to have been 
  1.2065 +** rolled back if an explicit "ROLLBACK" statement is executed, or
  1.2066 +** an error or constraint causes an implicit rollback to occur. The 
  1.2067 +** callback is not invoked if a transaction is automatically rolled
  1.2068 +** back because the database connection is closed.
  1.2069 +**
  1.2070 +** These are experimental interfaces and are subject to change.
  1.2071 +*/
  1.2072 +void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*);
  1.2073 +void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
  1.2074 +
  1.2075 +/*
  1.2076 +** CAPI3REF: Data Change Notification Callbacks
  1.2077 +**
  1.2078 +** Register a callback function with the database connection identified by the 
  1.2079 +** first argument to be invoked whenever a row is updated, inserted or deleted.
  1.2080 +** Any callback set by a previous call to this function for the same 
  1.2081 +** database connection is overridden.
  1.2082 +**
  1.2083 +** The second argument is a pointer to the function to invoke when a 
  1.2084 +** row is updated, inserted or deleted. The first argument to the callback is
  1.2085 +** a copy of the third argument to sqlite3_update_hook(). The second callback 
  1.2086 +** argument is one of SQLITE_INSERT, SQLITE_DELETE or SQLITE_UPDATE, depending
  1.2087 +** on the operation that caused the callback to be invoked. The third and 
  1.2088 +** fourth arguments to the callback contain pointers to the database and 
  1.2089 +** table name containing the affected row. The final callback parameter is 
  1.2090 +** the rowid of the row. In the case of an update, this is the rowid after 
  1.2091 +** the update takes place.
  1.2092 +**
  1.2093 +** The update hook is not invoked when internal system tables are
  1.2094 +** modified (i.e. sqlite_master and sqlite_sequence).
  1.2095 +**
  1.2096 +** If another function was previously registered, its pArg value is returned.
  1.2097 +** Otherwise NULL is returned.
  1.2098 +*/
  1.2099 +void *sqlite3_update_hook(
  1.2100 +  sqlite3*, 
  1.2101 +  void(*)(void *,int ,char const *,char const *,sqlite_int64),
  1.2102 +  void*
  1.2103 +);
  1.2104 +
  1.2105 +/*
  1.2106 +** CAPI3REF:  Enable Or Disable Shared Pager Cache
  1.2107 +**
  1.2108 +** This routine enables or disables the sharing of the database cache
  1.2109 +** and schema data structures between connections to the same database.
  1.2110 +** Sharing is enabled if the argument is true and disabled if the argument
  1.2111 +** is false.
  1.2112 +**
  1.2113 +** Cache sharing is enabled and disabled on a thread-by-thread basis.
  1.2114 +** Each call to this routine enables or disables cache sharing only for
  1.2115 +** connections created in the same thread in which this routine is called.
  1.2116 +** There is no mechanism for sharing cache between database connections
  1.2117 +** running in different threads.
  1.2118 +**
  1.2119 +** Sharing must be disabled prior to shutting down a thread or else
  1.2120 +** the thread will leak memory.  Call this routine with an argument of
  1.2121 +** 0 to turn off sharing.  Or use the sqlite3_thread_cleanup() API.
  1.2122 +**
  1.2123 +** This routine must not be called when any database connections
  1.2124 +** are active in the current thread.  Enabling or disabling shared
  1.2125 +** cache while there are active database connections will result
  1.2126 +** in memory corruption.
  1.2127 +**
  1.2128 +** When the shared cache is enabled, the
  1.2129 +** following routines must always be called from the same thread:
  1.2130 +** [sqlite3_open()], [sqlite3_prepare_v2()], [sqlite3_step()],
  1.2131 +** [sqlite3_reset()], [sqlite3_finalize()], and [sqlite3_close()].
  1.2132 +** This is due to the fact that the shared cache makes use of
  1.2133 +** thread-specific storage so that it will be available for sharing
  1.2134 +** with other connections.
  1.2135 +**
  1.2136 +** Virtual tables cannot be used with a shared cache.  When shared
  1.2137 +** cache is enabled, the sqlite3_create_module() API used to register
  1.2138 +** virtual tables will always return an error.
  1.2139 +**
  1.2140 +** This routine returns [SQLITE_OK] if shared cache was
  1.2141 +** enabled or disabled successfully.  An [SQLITE_ERROR | error code]
  1.2142 +** is returned otherwise.
  1.2143 +**
  1.2144 +** Shared cache is disabled by default for backward compatibility.
  1.2145 +*/
  1.2146 +int sqlite3_enable_shared_cache(int);
  1.2147 +
  1.2148 +/*
  1.2149 +** CAPI3REF:  Attempt To Free Heap Memory
  1.2150 +**
  1.2151 +** Attempt to free N bytes of heap memory by deallocating non-essential
  1.2152 +** memory allocations held by the database library (example: memory 
  1.2153 +** used to cache database pages to improve performance).
  1.2154 +**
  1.2155 +** This function is not a part of standard builds.  It is only created
  1.2156 +** if SQLite is compiled with the SQLITE_ENABLE_MEMORY_MANAGEMENT macro.
  1.2157 +*/
  1.2158 +int sqlite3_release_memory(int);
  1.2159 +
  1.2160 +/*
  1.2161 +** CAPI3REF:  Impose A Limit On Heap Size
  1.2162 +**
  1.2163 +** Place a "soft" limit on the amount of heap memory that may be allocated by
  1.2164 +** SQLite within the current thread. If an internal allocation is requested 
  1.2165 +** that would exceed the specified limit, [sqlite3_release_memory()] is invoked
  1.2166 +** one or more times to free up some space before the allocation is made.
  1.2167 +**
  1.2168 +** The limit is called "soft", because if [sqlite3_release_memory()] cannot free
  1.2169 +** sufficient memory to prevent the limit from being exceeded, the memory is
  1.2170 +** allocated anyway and the current operation proceeds.
  1.2171 +**
  1.2172 +** Prior to shutting down a thread sqlite3_soft_heap_limit() must be set to 
  1.2173 +** zero (the default) or else the thread will leak memory. Alternatively, use
  1.2174 +** the [sqlite3_thread_cleanup()] API.
  1.2175 +**
  1.2176 +** A negative or zero value for N means that there is no soft heap limit and
  1.2177 +** [sqlite3_release_memory()] will only be called when memory is exhaused.
  1.2178 +** The default value for the soft heap limit is zero.
  1.2179 +**
  1.2180 +** SQLite makes a best effort to honor the soft heap limit.  But if it
  1.2181 +** is unable to reduce memory usage below the soft limit, execution will
  1.2182 +** continue without error or notification.  This is why the limit is 
  1.2183 +** called a "soft" limit.  It is advisory only.
  1.2184 +**
  1.2185 +** This function is only available if the library was compiled with the 
  1.2186 +** SQLITE_ENABLE_MEMORY_MANAGEMENT option set.
  1.2187 +** memory-management has been enabled.
  1.2188 +*/
  1.2189 +void sqlite3_soft_heap_limit(int);
  1.2190 +
  1.2191 +/*
  1.2192 +** CAPI3REF:  Clean Up Thread Local Storage
  1.2193 +**
  1.2194 +** This routine makes sure that all thread-local storage has been
  1.2195 +** deallocated for the current thread.
  1.2196 +**
  1.2197 +** This routine is not technically necessary.  All thread-local storage
  1.2198 +** will be automatically deallocated once memory-management and
  1.2199 +** shared-cache are disabled and the soft heap limit has been set
  1.2200 +** to zero.  This routine is provided as a convenience for users who
  1.2201 +** want to make absolutely sure they have not forgotten something
  1.2202 +** prior to killing off a thread.
  1.2203 +*/
  1.2204 +void sqlite3_thread_cleanup(void);
  1.2205 +
  1.2206 +/*
  1.2207 +** CAPI3REF:  Extract Metadata About A Column Of A Table
  1.2208 +**
  1.2209 +** This routine
  1.2210 +** returns meta-data about a specific column of a specific database
  1.2211 +** table accessible using the connection handle passed as the first function 
  1.2212 +** argument.
  1.2213 +**
  1.2214 +** The column is identified by the second, third and fourth parameters to 
  1.2215 +** this function. The second parameter is either the name of the database
  1.2216 +** (i.e. "main", "temp" or an attached database) containing the specified
  1.2217 +** table or NULL. If it is NULL, then all attached databases are searched
  1.2218 +** for the table using the same algorithm as the database engine uses to 
  1.2219 +** resolve unqualified table references.
  1.2220 +**
  1.2221 +** The third and fourth parameters to this function are the table and column 
  1.2222 +** name of the desired column, respectively. Neither of these parameters 
  1.2223 +** may be NULL.
  1.2224 +**
  1.2225 +** Meta information is returned by writing to the memory locations passed as
  1.2226 +** the 5th and subsequent parameters to this function. Any of these 
  1.2227 +** arguments may be NULL, in which case the corresponding element of meta 
  1.2228 +** information is ommitted.
  1.2229 +**
  1.2230 +** <pre>
  1.2231 +** Parameter     Output Type      Description
  1.2232 +** -----------------------------------
  1.2233 +**
  1.2234 +**   5th         const char*      Data type
  1.2235 +**   6th         const char*      Name of the default collation sequence 
  1.2236 +**   7th         int              True if the column has a NOT NULL constraint
  1.2237 +**   8th         int              True if the column is part of the PRIMARY KEY
  1.2238 +**   9th         int              True if the column is AUTOINCREMENT
  1.2239 +** </pre>
  1.2240 +**
  1.2241 +**
  1.2242 +** The memory pointed to by the character pointers returned for the 
  1.2243 +** declaration type and collation sequence is valid only until the next 
  1.2244 +** call to any sqlite API function.
  1.2245 +**
  1.2246 +** If the specified table is actually a view, then an error is returned.
  1.2247 +**
  1.2248 +** If the specified column is "rowid", "oid" or "_rowid_" and an 
  1.2249 +** INTEGER PRIMARY KEY column has been explicitly declared, then the output 
  1.2250 +** parameters are set for the explicitly declared column. If there is no
  1.2251 +** explicitly declared IPK column, then the output parameters are set as 
  1.2252 +** follows:
  1.2253 +**
  1.2254 +** <pre>
  1.2255 +**     data type: "INTEGER"
  1.2256 +**     collation sequence: "BINARY"
  1.2257 +**     not null: 0
  1.2258 +**     primary key: 1
  1.2259 +**     auto increment: 0
  1.2260 +** </pre>
  1.2261 +**
  1.2262 +** This function may load one or more schemas from database files. If an
  1.2263 +** error occurs during this process, or if the requested table or column
  1.2264 +** cannot be found, an SQLITE error code is returned and an error message
  1.2265 +** left in the database handle (to be retrieved using sqlite3_errmsg()).
  1.2266 +**
  1.2267 +** This API is only available if the library was compiled with the
  1.2268 +** SQLITE_ENABLE_COLUMN_METADATA preprocessor symbol defined.
  1.2269 +*/
  1.2270 +int sqlite3_table_column_metadata(
  1.2271 +  sqlite3 *db,                /* Connection handle */
  1.2272 +  const char *zDbName,        /* Database name or NULL */
  1.2273 +  const char *zTableName,     /* Table name */
  1.2274 +  const char *zColumnName,    /* Column name */
  1.2275 +  char const **pzDataType,    /* OUTPUT: Declared data type */
  1.2276 +  char const **pzCollSeq,     /* OUTPUT: Collation sequence name */
  1.2277 +  int *pNotNull,              /* OUTPUT: True if NOT NULL constraint exists */
  1.2278 +  int *pPrimaryKey,           /* OUTPUT: True if column part of PK */
  1.2279 +  int *pAutoinc               /* OUTPUT: True if colums is auto-increment */
  1.2280 +);
  1.2281 +
  1.2282 +/*
  1.2283 +** CAPI3REF: Load An Extension
  1.2284 +**
  1.2285 +** Attempt to load an SQLite extension library contained in the file
  1.2286 +** zFile.  The entry point is zProc.  zProc may be 0 in which case the
  1.2287 +** name of the entry point defaults to "sqlite3_extension_init".
  1.2288 +**
  1.2289 +** Return [SQLITE_OK] on success and [SQLITE_ERROR] if something goes wrong.
  1.2290 +**
  1.2291 +** If an error occurs and pzErrMsg is not 0, then fill *pzErrMsg with 
  1.2292 +** error message text.  The calling function should free this memory
  1.2293 +** by calling [sqlite3_free()].
  1.2294 +**
  1.2295 +** Extension loading must be enabled using [sqlite3_enable_load_extension()]
  1.2296 +** prior to calling this API or an error will be returned.
  1.2297 +*/
  1.2298 +int sqlite3_load_extension(
  1.2299 +  sqlite3 *db,          /* Load the extension into this database connection */
  1.2300 +  const char *zFile,    /* Name of the shared library containing extension */
  1.2301 +  const char *zProc,    /* Entry point.  Derived from zFile if 0 */
  1.2302 +  char **pzErrMsg       /* Put error message here if not 0 */
  1.2303 +);
  1.2304 +
  1.2305 +/*
  1.2306 +** CAPI3REF:  Enable Or Disable Extension Loading
  1.2307 +**
  1.2308 +** So as not to open security holes in older applications that are
  1.2309 +** unprepared to deal with extension loading, and as a means of disabling
  1.2310 +** extension loading while evaluating user-entered SQL, the following
  1.2311 +** API is provided to turn the [sqlite3_load_extension()] mechanism on and
  1.2312 +** off.  It is off by default.  See ticket #1863.
  1.2313 +**
  1.2314 +** Call this routine with onoff==1 to turn extension loading on
  1.2315 +** and call it with onoff==0 to turn it back off again.
  1.2316 +*/
  1.2317 +int sqlite3_enable_load_extension(sqlite3 *db, int onoff);
  1.2318 +
  1.2319 +/*
  1.2320 +** CAPI3REF: Make Arrangements To Automatically Load An Extension
  1.2321 +**
  1.2322 +** Register an extension entry point that is automatically invoked
  1.2323 +** whenever a new database connection is opened using
  1.2324 +** [sqlite3_open()] or [sqlite3_open16()].
  1.2325 +**
  1.2326 +** This API can be invoked at program startup in order to register
  1.2327 +** one or more statically linked extensions that will be available
  1.2328 +** to all new database connections.
  1.2329 +**
  1.2330 +** Duplicate extensions are detected so calling this routine multiple
  1.2331 +** times with the same extension is harmless.
  1.2332 +**
  1.2333 +** This routine stores a pointer to the extension in an array
  1.2334 +** that is obtained from malloc().  If you run a memory leak
  1.2335 +** checker on your program and it reports a leak because of this
  1.2336 +** array, then invoke [sqlite3_automatic_extension_reset()] prior
  1.2337 +** to shutdown to free the memory.
  1.2338 +**
  1.2339 +** Automatic extensions apply across all threads.
  1.2340 +**
  1.2341 +** This interface is experimental and is subject to change or
  1.2342 +** removal in future releases of SQLite.
  1.2343 +*/
  1.2344 +int sqlite3_auto_extension(void *xEntryPoint);
  1.2345 +
  1.2346 +
  1.2347 +/*
  1.2348 +** CAPI3REF: Reset Automatic Extension Loading
  1.2349 +**
  1.2350 +** Disable all previously registered automatic extensions.  This
  1.2351 +** routine undoes the effect of all prior [sqlite3_automatic_extension()]
  1.2352 +** calls.
  1.2353 +**
  1.2354 +** This call disabled automatic extensions in all threads.
  1.2355 +**
  1.2356 +** This interface is experimental and is subject to change or
  1.2357 +** removal in future releases of SQLite.
  1.2358 +*/
  1.2359 +void sqlite3_reset_auto_extension(void);
  1.2360 +
  1.2361 +
  1.2362 +/*
  1.2363 +****** EXPERIMENTAL - subject to change without notice **************
  1.2364 +**
  1.2365 +** The interface to the virtual-table mechanism is currently considered
  1.2366 +** to be experimental.  The interface might change in incompatible ways.
  1.2367 +** If this is a problem for you, do not use the interface at this time.
  1.2368 +**
  1.2369 +** When the virtual-table mechanism stablizes, we will declare the
  1.2370 +** interface fixed, support it indefinitely, and remove this comment.
  1.2371 +*/
  1.2372 +
  1.2373 +/*
  1.2374 +** Structures used by the virtual table interface
  1.2375 +*/
  1.2376 +typedef struct sqlite3_vtab sqlite3_vtab;
  1.2377 +typedef struct sqlite3_index_info sqlite3_index_info;
  1.2378 +typedef struct sqlite3_vtab_cursor sqlite3_vtab_cursor;
  1.2379 +typedef struct sqlite3_module sqlite3_module;
  1.2380 +
  1.2381 +/*
  1.2382 +** A module is a class of virtual tables.  Each module is defined
  1.2383 +** by an instance of the following structure.  This structure consists
  1.2384 +** mostly of methods for the module.
  1.2385 +*/
  1.2386 +struct sqlite3_module {
  1.2387 +  int iVersion;
  1.2388 +  int (*xCreate)(sqlite3*, void *pAux,
  1.2389 +               int argc, const char *const*argv,
  1.2390 +               sqlite3_vtab **ppVTab, char**);
  1.2391 +  int (*xConnect)(sqlite3*, void *pAux,
  1.2392 +               int argc, const char *const*argv,
  1.2393 +               sqlite3_vtab **ppVTab, char**);
  1.2394 +  int (*xBestIndex)(sqlite3_vtab *pVTab, sqlite3_index_info*);
  1.2395 +  int (*xDisconnect)(sqlite3_vtab *pVTab);
  1.2396 +  int (*xDestroy)(sqlite3_vtab *pVTab);
  1.2397 +  int (*xOpen)(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor);
  1.2398 +  int (*xClose)(sqlite3_vtab_cursor*);
  1.2399 +  int (*xFilter)(sqlite3_vtab_cursor*, int idxNum, const char *idxStr,
  1.2400 +                int argc, sqlite3_value **argv);
  1.2401 +  int (*xNext)(sqlite3_vtab_cursor*);
  1.2402 +  int (*xEof)(sqlite3_vtab_cursor*);
  1.2403 +  int (*xColumn)(sqlite3_vtab_cursor*, sqlite3_context*, int);
  1.2404 +  int (*xRowid)(sqlite3_vtab_cursor*, sqlite_int64 *pRowid);
  1.2405 +  int (*xUpdate)(sqlite3_vtab *, int, sqlite3_value **, sqlite_int64 *);
  1.2406 +  int (*xBegin)(sqlite3_vtab *pVTab);
  1.2407 +  int (*xSync)(sqlite3_vtab *pVTab);
  1.2408 +  int (*xCommit)(sqlite3_vtab *pVTab);
  1.2409 +  int (*xRollback)(sqlite3_vtab *pVTab);
  1.2410 +  int (*xFindFunction)(sqlite3_vtab *pVtab, int nArg, const char *zName,
  1.2411 +                       void (**pxFunc)(sqlite3_context*,int,sqlite3_value**),
  1.2412 +                       void **ppArg);
  1.2413 +
  1.2414 +  int (*xRename)(sqlite3_vtab *pVtab, const char *zNew);
  1.2415 +};
  1.2416 +
  1.2417 +/*
  1.2418 +** The sqlite3_index_info structure and its substructures is used to
  1.2419 +** pass information into and receive the reply from the xBestIndex
  1.2420 +** method of an sqlite3_module.  The fields under **Inputs** are the
  1.2421 +** inputs to xBestIndex and are read-only.  xBestIndex inserts its
  1.2422 +** results into the **Outputs** fields.
  1.2423 +**
  1.2424 +** The aConstraint[] array records WHERE clause constraints of the
  1.2425 +** form:
  1.2426 +**
  1.2427 +**         column OP expr
  1.2428 +**
  1.2429 +** Where OP is =, <, <=, >, or >=.  The particular operator is stored
  1.2430 +** in aConstraint[].op.  The index of the column is stored in 
  1.2431 +** aConstraint[].iColumn.  aConstraint[].usable is TRUE if the
  1.2432 +** expr on the right-hand side can be evaluated (and thus the constraint
  1.2433 +** is usable) and false if it cannot.
  1.2434 +**
  1.2435 +** The optimizer automatically inverts terms of the form "expr OP column"
  1.2436 +** and makes other simplificatinos to the WHERE clause in an attempt to
  1.2437 +** get as many WHERE clause terms into the form shown above as possible.
  1.2438 +** The aConstraint[] array only reports WHERE clause terms in the correct
  1.2439 +** form that refer to the particular virtual table being queried.
  1.2440 +**
  1.2441 +** Information about the ORDER BY clause is stored in aOrderBy[].
  1.2442 +** Each term of aOrderBy records a column of the ORDER BY clause.
  1.2443 +**
  1.2444 +** The xBestIndex method must fill aConstraintUsage[] with information
  1.2445 +** about what parameters to pass to xFilter.  If argvIndex>0 then
  1.2446 +** the right-hand side of the corresponding aConstraint[] is evaluated
  1.2447 +** and becomes the argvIndex-th entry in argv.  If aConstraintUsage[].omit
  1.2448 +** is true, then the constraint is assumed to be fully handled by the
  1.2449 +** virtual table and is not checked again by SQLite.
  1.2450 +**
  1.2451 +** The idxNum and idxPtr values are recorded and passed into xFilter.
  1.2452 +** sqlite3_free() is used to free idxPtr if needToFreeIdxPtr is true.
  1.2453 +**
  1.2454 +** The orderByConsumed means that output from xFilter will occur in
  1.2455 +** the correct order to satisfy the ORDER BY clause so that no separate
  1.2456 +** sorting step is required.
  1.2457 +**
  1.2458 +** The estimatedCost value is an estimate of the cost of doing the
  1.2459 +** particular lookup.  A full scan of a table with N entries should have
  1.2460 +** a cost of N.  A binary search of a table of N entries should have a
  1.2461 +** cost of approximately log(N).
  1.2462 +*/
  1.2463 +struct sqlite3_index_info {
  1.2464 +  /* Inputs */
  1.2465 +  const int nConstraint;     /* Number of entries in aConstraint */
  1.2466 +  const struct sqlite3_index_constraint {
  1.2467 +     int iColumn;              /* Column on left-hand side of constraint */
  1.2468 +     unsigned char op;         /* Constraint operator */
  1.2469 +     unsigned char usable;     /* True if this constraint is usable */
  1.2470 +     int iTermOffset;          /* Used internally - xBestIndex should ignore */
  1.2471 +  } *const aConstraint;      /* Table of WHERE clause constraints */
  1.2472 +  const int nOrderBy;        /* Number of terms in the ORDER BY clause */
  1.2473 +  const struct sqlite3_index_orderby {
  1.2474 +     int iColumn;              /* Column number */
  1.2475 +     unsigned char desc;       /* True for DESC.  False for ASC. */
  1.2476 +  } *const aOrderBy;         /* The ORDER BY clause */
  1.2477 +
  1.2478 +  /* Outputs */
  1.2479 +  struct sqlite3_index_constraint_usage {
  1.2480 +    int argvIndex;           /* if >0, constraint is part of argv to xFilter */
  1.2481 +    unsigned char omit;      /* Do not code a test for this constraint */
  1.2482 +  } *const aConstraintUsage;
  1.2483 +  int idxNum;                /* Number used to identify the index */
  1.2484 +  char *idxStr;              /* String, possibly obtained from sqlite3_malloc */
  1.2485 +  int needToFreeIdxStr;      /* Free idxStr using sqlite3_free() if true */
  1.2486 +  int orderByConsumed;       /* True if output is already ordered */
  1.2487 +  double estimatedCost;      /* Estimated cost of using this index */
  1.2488 +};
  1.2489 +#define SQLITE_INDEX_CONSTRAINT_EQ    2
  1.2490 +#define SQLITE_INDEX_CONSTRAINT_GT    4
  1.2491 +#define SQLITE_INDEX_CONSTRAINT_LE    8
  1.2492 +#define SQLITE_INDEX_CONSTRAINT_LT    16
  1.2493 +#define SQLITE_INDEX_CONSTRAINT_GE    32
  1.2494 +#define SQLITE_INDEX_CONSTRAINT_MATCH 64
  1.2495 +
  1.2496 +/*
  1.2497 +** This routine is used to register a new module name with an SQLite
  1.2498 +** connection.  Module names must be registered before creating new
  1.2499 +** virtual tables on the module, or before using preexisting virtual
  1.2500 +** tables of the module.
  1.2501 +*/
  1.2502 +int sqlite3_create_module(
  1.2503 +  sqlite3 *db,               /* SQLite connection to register module with */
  1.2504 +  const char *zName,         /* Name of the module */
  1.2505 +  const sqlite3_module *,    /* Methods for the module */
  1.2506 +  void *                     /* Client data for xCreate/xConnect */
  1.2507 +);
  1.2508 +
  1.2509 +/*
  1.2510 +** This routine is identical to the sqlite3_create_module() method above,
  1.2511 +** except that it allows a destructor function to be specified. It is
  1.2512 +** even more experimental than the rest of the virtual tables API.
  1.2513 +*/
  1.2514 +int sqlite3_create_module_v2(
  1.2515 +  sqlite3 *db,               /* SQLite connection to register module with */
  1.2516 +  const char *zName,         /* Name of the module */
  1.2517 +  const sqlite3_module *,    /* Methods for the module */
  1.2518 +  void *,                    /* Client data for xCreate/xConnect */
  1.2519 +  void(*xDestroy)(void*)     /* Module destructor function */
  1.2520 +);
  1.2521 +
  1.2522 +/*
  1.2523 +** Every module implementation uses a subclass of the following structure
  1.2524 +** to describe a particular instance of the module.  Each subclass will
  1.2525 +** be taylored to the specific needs of the module implementation.   The
  1.2526 +** purpose of this superclass is to define certain fields that are common
  1.2527 +** to all module implementations.
  1.2528 +**
  1.2529 +** Virtual tables methods can set an error message by assigning a
  1.2530 +** string obtained from sqlite3_mprintf() to zErrMsg.  The method should
  1.2531 +** take care that any prior string is freed by a call to sqlite3_free()
  1.2532 +** prior to assigning a new string to zErrMsg.  After the error message
  1.2533 +** is delivered up to the client application, the string will be automatically
  1.2534 +** freed by sqlite3_free() and the zErrMsg field will be zeroed.  Note
  1.2535 +** that sqlite3_mprintf() and sqlite3_free() are used on the zErrMsg field
  1.2536 +** since virtual tables are commonly implemented in loadable extensions which
  1.2537 +** do not have access to sqlite3MPrintf() or sqlite3Free().
  1.2538 +*/
  1.2539 +struct sqlite3_vtab {
  1.2540 +  const sqlite3_module *pModule;  /* The module for this virtual table */
  1.2541 +  int nRef;                       /* Used internally */
  1.2542 +  char *zErrMsg;                  /* Error message from sqlite3_mprintf() */
  1.2543 +  /* Virtual table implementations will typically add additional fields */
  1.2544 +};
  1.2545 +
  1.2546 +/* Every module implementation uses a subclass of the following structure
  1.2547 +** to describe cursors that point into the virtual table and are used
  1.2548 +** to loop through the virtual table.  Cursors are created using the
  1.2549 +** xOpen method of the module.  Each module implementation will define
  1.2550 +** the content of a cursor structure to suit its own needs.
  1.2551 +**
  1.2552 +** This superclass exists in order to define fields of the cursor that
  1.2553 +** are common to all implementations.
  1.2554 +*/
  1.2555 +struct sqlite3_vtab_cursor {
  1.2556 +  sqlite3_vtab *pVtab;      /* Virtual table of this cursor */
  1.2557 +  /* Virtual table implementations will typically add additional fields */
  1.2558 +};
  1.2559 +
  1.2560 +/*
  1.2561 +** The xCreate and xConnect methods of a module use the following API
  1.2562 +** to declare the format (the names and datatypes of the columns) of
  1.2563 +** the virtual tables they implement.
  1.2564 +*/
  1.2565 +int sqlite3_declare_vtab(sqlite3*, const char *zCreateTable);
  1.2566 +
  1.2567 +/*
  1.2568 +** Virtual tables can provide alternative implementations of functions
  1.2569 +** using the xFindFunction method.  But global versions of those functions
  1.2570 +** must exist in order to be overloaded.
  1.2571 +**
  1.2572 +** This API makes sure a global version of a function with a particular
  1.2573 +** name and number of parameters exists.  If no such function exists
  1.2574 +** before this API is called, a new function is created.  The implementation
  1.2575 +** of the new function always causes an exception to be thrown.  So
  1.2576 +** the new function is not good for anything by itself.  Its only
  1.2577 +** purpose is to be a place-holder function that can be overloaded
  1.2578 +** by virtual tables.
  1.2579 +**
  1.2580 +** This API should be considered part of the virtual table interface,
  1.2581 +** which is experimental and subject to change.
  1.2582 +*/
  1.2583 +int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg);
  1.2584 +
  1.2585 +/*
  1.2586 +** The interface to the virtual-table mechanism defined above (back up
  1.2587 +** to a comment remarkably similar to this one) is currently considered
  1.2588 +** to be experimental.  The interface might change in incompatible ways.
  1.2589 +** If this is a problem for you, do not use the interface at this time.
  1.2590 +**
  1.2591 +** When the virtual-table mechanism stablizes, we will declare the
  1.2592 +** interface fixed, support it indefinitely, and remove this comment.
  1.2593 +**
  1.2594 +****** EXPERIMENTAL - subject to change without notice **************
  1.2595 +*/
  1.2596 +
  1.2597 +/*
  1.2598 +** CAPI3REF: A Handle To An Open BLOB
  1.2599 +**
  1.2600 +** An instance of the following opaque structure is used to 
  1.2601 +** represent an blob-handle.  A blob-handle is created by
  1.2602 +** [sqlite3_blob_open()] and destroyed by [sqlite3_blob_close()].
  1.2603 +** The [sqlite3_blob_read()] and [sqlite3_blob_write()] interfaces
  1.2604 +** can be used to read or write small subsections of the blob.
  1.2605 +** The [sqltie3_blob_size()] interface returns the size of the
  1.2606 +** blob in bytes.
  1.2607 +*/
  1.2608 +typedef struct sqlite3_blob sqlite3_blob;
  1.2609 +
  1.2610 +/*
  1.2611 +** CAPI3REF: Open A BLOB For Incremental I/O
  1.2612 +**
  1.2613 +** Open a handle to the blob located in row iRow,, column zColumn, 
  1.2614 +** table zTable in database zDb. i.e. the same blob that would
  1.2615 +** be selected by:
  1.2616 +**
  1.2617 +** <pre>
  1.2618 +**     SELECT zColumn FROM zDb.zTable WHERE rowid = iRow;
  1.2619 +** </pre>
  1.2620 +**
  1.2621 +** If the flags parameter is non-zero, the blob is opened for 
  1.2622 +** read and write access. If it is zero, the blob is opened for read 
  1.2623 +** access.
  1.2624 +**
  1.2625 +** On success, [SQLITE_OK] is returned and the new 
  1.2626 +** [sqlite3_blob | blob handle] is written to *ppBlob.
  1.2627 +** Otherwise an error code is returned and 
  1.2628 +** any value written to *ppBlob should not be used by the caller.
  1.2629 +** This function sets the database-handle error code and message
  1.2630 +** accessible via [sqlite3_errcode()] and [sqlite3_errmsg()].
  1.2631 +*/
  1.2632 +int sqlite3_blob_open(
  1.2633 +  sqlite3*,
  1.2634 +  const char *zDb,
  1.2635 +  const char *zTable,
  1.2636 +  const char *zColumn,
  1.2637 +  sqlite_int64 iRow,
  1.2638 +  int flags,
  1.2639 +  sqlite3_blob **ppBlob
  1.2640 +);
  1.2641 +
  1.2642 +/*
  1.2643 +** CAPI3REF:  Close A BLOB Handle
  1.2644 +**
  1.2645 +** Close an open [sqlite3_blob | blob handle].
  1.2646 +*/
  1.2647 +int sqlite3_blob_close(sqlite3_blob *);
  1.2648 +
  1.2649 +/*
  1.2650 +** CAPI3REF:  Return The Size Of An Open BLOB
  1.2651 +**
  1.2652 +** Return the size in bytes of the blob accessible via the open 
  1.2653 +** [sqlite3_blob | blob-handle] passed as an argument.
  1.2654 +*/
  1.2655 +int sqlite3_blob_bytes(sqlite3_blob *);
  1.2656 +
  1.2657 +/*
  1.2658 +** CAPI3REF:  Read Data From A BLOB Incrementally
  1.2659 +**
  1.2660 +** This function is used to read data from an open 
  1.2661 +** [sqlite3_blob | blob-handle] into a caller supplied buffer.
  1.2662 +** n bytes of data are copied into buffer
  1.2663 +** z from the open blob, starting at offset iOffset.
  1.2664 +**
  1.2665 +** On success, SQLITE_OK is returned. Otherwise, an 
  1.2666 +** [SQLITE_ERROR | SQLite error code] or an
  1.2667 +** [SQLITE_IOERR_READ | extended error code] is returned.
  1.2668 +*/
  1.2669 +int sqlite3_blob_read(sqlite3_blob *, void *z, int n, int iOffset);
  1.2670 +
  1.2671 +/*
  1.2672 +** CAPI3REF:  Write Data Into A BLOB Incrementally
  1.2673 +**
  1.2674 +** This function is used to write data into an open 
  1.2675 +** [sqlite3_blob | blob-handle] from a user supplied buffer.
  1.2676 +** n bytes of data are copied from the buffer
  1.2677 +** pointed to by z into the open blob, starting at offset iOffset.
  1.2678 +**
  1.2679 +** If the [sqlite3_blob | blob-handle] passed as the first argument
  1.2680 +** was not opened for writing (the flags parameter to [sqlite3_blob_open()]
  1.2681 +*** was zero), this function returns [SQLITE_READONLY].
  1.2682 +**
  1.2683 +** This function may only modify the contents of the blob, it is
  1.2684 +** not possible to increase the size of a blob using this API. If
  1.2685 +** offset iOffset is less than n bytes from the end of the blob, 
  1.2686 +** [SQLITE_ERROR] is returned and no data is written.
  1.2687 +**
  1.2688 +** On success, SQLITE_OK is returned. Otherwise, an 
  1.2689 +** [SQLITE_ERROR | SQLite error code] or an
  1.2690 +** [SQLITE_IOERR_READ | extended error code] is returned.
  1.2691 +*/
  1.2692 +int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset);
  1.2693 +
  1.2694 +/*
  1.2695 +** Undo the hack that converts floating point types to integer for
  1.2696 +** builds on processors without floating point support.
  1.2697 +*/
  1.2698 +#ifdef SQLITE_OMIT_FLOATING_POINT
  1.2699 +# undef double
  1.2700 +#endif
  1.2701 +
  1.2702 +#ifdef __cplusplus
  1.2703 +}  /* End of the 'extern "C"' block */
  1.2704 +#endif
  1.2705 +#endif