Changeset 184

Show
Ignore:
Timestamp:
04/26/08 07:28:23 (7 months ago)
Author:
yidabu
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/database/sqlite/c/sqlite3.d

    r179 r184  
    1 /** 
    2  * SQLite3 C Module. 
    3  * by iceeLyne, from SQLite3 version 3.3.12 header. 
    4  */ 
    5  
    6 module dwin.database.sqlite.c.sqlite3; 
    7  
    8 /* 
     1/* 
     2** The D programming language 
     3** 
     4** Converted by Anders Bergh <anders1@gmail.com> 
     5** 
     6************************************************************************* 
     7** 
    98** 2001 September 15 
    109** 
     
    1817************************************************************************* 
    1918** This header file defines the interface that the SQLite library 
    20 ** presents to client programs. 
    21 ** 
    22 */ 
    23  
    24 ////#include <stdarg.h>     /* Needed for the definition of va_list */ 
    25 version(Phobos) 
    26     import std.c.stdarg; 
     19** presents to client programs.  If a C-function, structure, datatype, 
     20** or constant definition does not appear in this file, then it is 
     21** not a published API of SQLite, is subject to change without 
     22** notice, and should not be referenced by programs that use SQLite. 
     23** 
     24** Some of the definitions that are in this file are marked as 
     25** "experimental".  Experimental interfaces are normally new 
     26** features recently added to SQLite.  We do not anticipate changes  
     27** to experimental interfaces but reserve to make minor changes if 
     28** experience from use "in the wild" suggest such changes are prudent. 
     29** 
     30** The official C-language API documentation for SQLite is derived 
     31** from comments in this file.  This file is the authoritative source 
     32** on how SQLite interfaces are suppose to operate. 
     33** 
     34** The name of this file under configuration management is "sqlite.h.in". 
     35** The makefile makes some minor changes to this file (such as inserting 
     36** the version number) and changes its name to "sqlite3.h" as 
     37** part of the build process. 
     38*/ 
     39 
     40module dwin.database.sqlite.c.sqlite3; 
     41 
     42extern (C): 
     43 
     44// For va_list and int64_t, etc 
     45version (Tango) 
     46
     47    import tango.stdc.stdarg; 
     48    import tango.stdc.inttypes; 
     49
    2750else 
    28     import tango.stdc.stdarg; 
    29  
    30 pragma(lib,"sqlite3.lib"); 
    31  
    32 extern(C) { 
    33  
    34 /* 
    35 ** The version of the SQLite library. 
    36 */ 
    37 const char[] SQLITE_VERSION = "3.3.12"; 
    38  
    39 /* 
    40 ** The format of the version string is "X.Y.Z<trailing string>", where 
     51
     52    import std.c.stdarg; 
     53    import std.stdint; 
     54
     55 
     56// Link with sqlite3 (rebuild) 
     57version (build) pragma(link, "sqlite3"); 
     58 
     59/* 
     60** CAPI3REF: Compile-Time Library Version Numbers 
     61** 
     62** The version of the SQLite library is contained in the sqlite3.h 
     63** header file in a #define named SQLITE_VERSION.  The SQLITE_VERSION 
     64** macro resolves to a string constant. 
     65** 
     66** The format of the version string is "X.Y.Z", where 
    4167** X is the major version number, Y is the minor version number and Z 
    42 ** is the release number. The trailing string is often "alpha" or "beta". 
     68** is the release number. The X.Y.Z might be followed by "alpha" or "beta". 
    4369** For example "3.1.1beta". 
    4470** 
     71** The X value is always 3 in SQLite.  The X value only changes when 
     72** backwards compatibility is broken and we intend to never break 
     73** backwards compatibility.  The Y value only changes when 
     74** there are major feature enhancements that are forwards compatible 
     75** but not backwards compatible.  The Z value is incremented with 
     76** each release but resets back to 0 when Y is incremented. 
     77** 
    4578** The SQLITE_VERSION_NUMBER is an integer with the value  
    46 ** (X*100000 + Y*1000 + Z). For example, for version "3.1.1beta",  
     79** (X*1000000 + Y*1000 + Z). For example, for version "3.1.1beta",  
    4780** SQLITE_VERSION_NUMBER is set to 3001001. To detect if they are using  
    4881** version 3.1.1 or greater at compile time, programs may use the test  
    4982** (SQLITE_VERSION_NUMBER>=3001001). 
    50 */ 
    51 const int SQLITE_VERSION_NUMBER = 3003012; 
    52  
    53 /* 
    54 ** The version string is also compiled into the library so that a program 
    55 ** can check to make sure that the lib*.a file and the *.h file are from 
    56 ** the same version.  The sqlite3_libversion() function returns a pointer 
    57 ** to the sqlite3_version variable - useful in DLLs which cannot access 
    58 ** global variables. 
    59 */ 
    60 ////extern const char sqlite3_version[]; 
    61 ////const char *sqlite3_libversion(void); 
     83** 
     84** See also: [sqlite3_libversion()] and [sqlite3_libversion_number()]. 
     85*/ 
     86const char[] SQLITE_VERSION = "3.5.1"; 
     87const SQLITE_VERSION_NUMBER = 3005001; 
     88 
     89/* 
     90** CAPI3REF: Run-Time Library Version Numbers 
     91** 
     92** These routines return values equivalent to the header constants 
     93** [SQLITE_VERSION] and [SQLITE_VERSION_NUMBER].  The values returned 
     94** by this routines should only be different from the header values 
     95** if you compile your program using an sqlite3.h header from a 
     96** different version of SQLite that the version of the library you 
     97** link against. 
     98** 
     99** The sqlite3_version[] string constant contains the text of the 
     100** [SQLITE_VERSION] string.  The sqlite3_libversion() function returns 
     101** a poiner to the sqlite3_version[] string constant.  The function 
     102** is provided for DLL users who can only access functions and not 
     103** constants within the DLL. 
     104*/ 
     105char* sqlite3_version; 
    62106char* sqlite3_libversion(); 
    63  
    64 /* 
    65 ** Return the value of the SQLITE_VERSION_NUMBER macro when the 
    66 ** library was compiled. 
    67 */ 
    68 ////int sqlite3_libversion_number(void); 
    69107int sqlite3_libversion_number(); 
    70108 
    71109/* 
    72 ** Each open sqlite database is represented by an instance of the 
    73 ** following opaque structure. 
    74 */ 
    75 ////typedef struct sqlite3 sqlite3; 
    76 struct sqlite3 {}; 
    77  
    78  
    79 /* 
     110** CAPI3REF: Test To See If The Library Is Threadsafe 
     111** 
     112** This routine returns TRUE (nonzero) if SQLite was compiled with 
     113** all of its mutexes enabled and is thus threadsafe.  It returns 
     114** zero if the particular build is for single-threaded operation 
     115** only. 
     116** 
     117** Really all this routine does is return true if SQLite was compiled 
     118** with the -DSQLITE_THREADSAFE=1 option and false if 
     119** compiled with -DSQLITE_THREADSAFE=0.  If SQLite uses an 
     120** application-defined mutex subsystem, malloc subsystem, collating 
     121** sequence, VFS, SQL function, progress callback, commit hook, 
     122** extension, or other accessories and these add-ons are not 
     123** threadsafe, then clearly the combination will not be threadsafe 
     124** either.  Hence, this routine never reports that the library 
     125** is guaranteed to be threadsafe, only when it is guaranteed not 
     126** to be. 
     127** 
     128** This is an experimental API and may go away or change in future 
     129** releases. 
     130*/ 
     131int sqlite3_threadsafe(); 
     132 
     133/* 
     134** CAPI3REF: Database Connection Handle 
     135** 
     136** Each open SQLite database is represented by pointer to an instance of the 
     137** opaque structure named "sqlite3".  It is useful to think of an sqlite3 
     138** pointer as an object.  The [sqlite3_open()], [sqlite3_open16()], and 
     139** [sqlite3_open_v2()] interfaces are its constructors 
     140** and [sqlite3_close()] is its destructor.  There are many other interfaces 
     141** (such as [sqlite3_prepare_v2()], [sqlite3_create_function()], and 
     142** [sqlite3_busy_timeout()] to name but three) that are methods on this 
     143** object. 
     144*/ 
     145struct sqlite3; 
     146 
     147 
     148/* 
     149** CAPI3REF: 64-Bit Integer Types 
     150** 
    80151** Some compilers do not support the "long long" datatype.  So we have 
    81 ** to do a typedef that for 64-bit integers that depends on what compiler 
    82 ** is being used. 
    83 */ 
    84 ////#ifdef long_TYPE 
    85 ////  typedef long_TYPE long; 
    86 ////  typedef unsigned long_TYPE sqlite_uint64; 
    87 ////#elif defined(_MSC_VER) || defined(__BORLANDC__) 
    88 ////  typedef __int64 long; 
    89 ////  typedef unsigned __int64 sqlite_uint64; 
    90 ////#else 
    91 ////  typedef long long int long; 
    92 ////  typedef unsigned long long int sqlite_uint64; 
    93 ////#endif 
    94  
    95 /* 
    96 ** If compiling for a processor that lacks floating point support, 
    97 ** substitute integer for floating-point 
    98 */ 
    99 ////#ifdef SQLITE_OMIT_FLOATING_POINT 
    100 ////# define double long 
    101 ////#endif 
    102  
    103 /* 
    104 ** A function to close the database. 
     152** to do compiler-specific typedefs for 64-bit signed and unsigned integers. 
     153** 
     154** Many SQLite interface functions require a 64-bit integer arguments. 
     155** Those interfaces are declared using this typedef. 
     156*/ 
     157alias int64_t sqlite3_int64; 
     158alias uint64_t sqlite3_uint64; 
     159 
     160/* 
     161** CAPI3REF: Closing A Database Connection 
    105162** 
    106163** Call this function with a pointer to a structure that was previously 
    107 ** returned from sqlite3_open() and the corresponding database will by closed. 
    108 ** 
    109 ** All SQL statements prepared using sqlite3_prepare() or 
    110 ** sqlite3_prepare16() must be deallocated using sqlite3_finalize() before 
    111 ** this routine is called. Otherwise, SQLITE_BUSY is returned and the 
     164** returned from [sqlite3_open()], [sqlite3_open16()], or 
     165** [sqlite3_open_v2()] and the corresponding database will by 
     166** closed. 
     167** 
     168** All SQL statements prepared using [sqlite3_prepare_v2()] or 
     169** [sqlite3_prepare16_v2()] must be destroyed using [sqlite3_finalize()] 
     170** before this routine is called. Otherwise, SQLITE_BUSY is returned and the 
    112171** database connection remains open. 
    113 */ 
    114 int sqlite3_close(sqlite3*); 
     172** 
     173** Passing this routine a database connection that has already been 
     174** closed results in undefined behavior.  If other interfaces that 
     175** reference the same database connection are pending (either in the 
     176** same thread or in different threads) when this routine is called, 
     177** then the behavior is undefined and is almost certainly undesirable. 
     178*/ 
     179int sqlite3_close(sqlite3 *); 
    115180 
    116181/* 
    117182** The type for a callback function. 
    118 */ 
    119 ////typedef int (*sqlite3_callback)(void*,int,char**, char**); 
    120 alias int function(void*, int, char**, char**) sqlite3_callback; 
    121  
    122 /* 
    123 ** A function to executes one or more statements of SQL. 
     183** This is legacy and deprecated.  It is included for historical 
     184** compatibility and is not documented. 
     185*/ 
     186alias int function(void*,int,char**, char**) sqlite3_callback; 
     187 
     188/* 
     189** CAPI3REF: One-Step Query Execution Interface 
     190** 
     191** This interface is used to do a one-time evaluatation of zero 
     192** or more SQL statements.  UTF-8 text of the SQL statements to 
     193** be evaluted is passed in as the second parameter.  The statements 
     194** are prepared one by one using [sqlite3_prepare()], evaluated 
     195** using [sqlite3_step()], then destroyed using [sqlite3_finalize()]. 
    124196** 
    125197** If one or more of the SQL statements are queries, then 
     
    128200** should normally return 0.  If the callback returns a non-zero 
    129201** value then the query is aborted, all subsequent SQL statements 
    130 ** are skipped and the sqlite3_exec() function returns the SQLITE_ABORT
    131 ** 
    132 ** The 1st parameter is an arbitrary pointer that is passed 
    133 ** to the callback function as its first parameter. 
     202** are skipped and the sqlite3_exec() function returns the [SQLITE_ABORT]
     203** 
     204** The 4th parameter to this interface is an arbitrary pointer that is 
     205** passed through to the callback function as its first parameter. 
    134206** 
    135207** The 2nd parameter to the callback function is the number of 
    136208** columns in the query result.  The 3rd parameter to the callback 
    137 ** is an array of strings holding the values for each column. 
    138 ** The 4th parameter to the callback is an array of strings holding 
     209** is an array of strings holding the values for each column 
     210** as extracted using [sqlite3_column_text()]. 
     211** The 4th parameter to the callback is an array of strings 
     212** obtained using [sqlite3_column_name()] and holding 
    139213** the names of each column. 
    140214** 
     
    145219** If an error occurs while parsing or evaluating the SQL (but 
    146220** not while executing the callback) then an appropriate error 
    147 ** message is written into memory obtained from malloc() and 
     221** message is written into memory obtained from [sqlite3_malloc()] and 
    148222** *errmsg is made to point to that message.  The calling function 
    149 ** is responsible for freeing the memory that holds the error 
    150 ** message.   Use sqlite3_free() for this.  If errmsg==NULL, 
    151 ** then no error message is ever written. 
     223** is responsible for freeing the memory using [sqlite3_free()]. 
     224** If errmsg==NULL, then no error message is ever written. 
    152225** 
    153226** The return value is is SQLITE_OK if there are no errors and 
    154 ** some other return code if there is an error.  The particular 
    155 ** return value depends on the type of error.  
    156 ** 
    157 ** If the query could not be executed because a database file is 
    158 ** locked or busy, then this function returns SQLITE_BUSY.  (This 
    159 ** behavior can be modified somewhat using the sqlite3_busy_handler() 
    160 ** and sqlite3_busy_timeout() functions below.) 
     227** some other [SQLITE_OK | return code] if there is an error.   
     228** The particular return value depends on the type of error.  
     229** 
    161230*/ 
    162231int sqlite3_exec( 
    163     sqlite3* db,                     /* An open database */ 
    164     /*const */char* sql,              /* SQL to be executed */ 
    165     sqlite3_callback callback,             /* Callback function */ 
    166     void* arg1,                       /* 1st argument to callback function */ 
    167     char** errmsg                 /* Error msg written here */ 
     232  sqlite3*,                                        /* An open database */ 
     233  char *sql,                                       /* SQL to be evaluted */ 
     234  int function(void*,int,char**,char**) callback,  /* Callback function */ 
     235  void *,                                          /* 1st argument to callback */ 
     236  char **errmsg                                    /* Error msg written here */ 
    168237); 
    169238 
    170239/* 
    171 ** Return values for sqlite3_exec() and sqlite3_step() 
    172 */ 
    173 const int SQLITE_OK=           0;   /* Successful result */ 
     240** CAPI3REF: Result Codes 
     241** KEYWORDS: SQLITE_OK 
     242** 
     243** Many SQLite functions return an integer result code from the set shown 
     244** above in order to indicates success or failure. 
     245** 
     246** The result codes above are the only ones returned by SQLite in its 
     247** default configuration.  However, the [sqlite3_extended_result_codes()] 
     248** API can be used to set a database connectoin to return more detailed 
     249** result codes. 
     250** 
     251** See also: [SQLITE_IOERR_READ | extended result codes] 
     252** 
     253*/ 
     254const SQLITE_OK =          0;  /* Successful result */ 
    174255/* beginning-of-error-codes */ 
    175 const int SQLITE_ERROR=        1;   /* SQL error or missing database */ 
    176 const int SQLITE_INTERNAL=     2;   /* NOT USED. Internal logic error in SQLite */ 
    177 const int SQLITE_PERM=         3;   /* Access permission denied */ 
    178 const int SQLITE_ABORT=        4;   /* Callback routine requested an abort */ 
    179 const int SQLITE_BUSY=         5;   /* The database file is locked */ 
    180 const int SQLITE_LOCKED=       6;   /* A table in the database is locked */ 
    181 const int SQLITE_NOMEM=        7;   /* A malloc() failed */ 
    182 const int SQLITE_READONLY=     8;   /* Attempt to write a readonly database */ 
    183 const int SQLITE_INTERRUPT=    9;   /* Operation terminated by sqlite3_interrupt()*/ 
    184 const int SQLITE_IOERR=       10;   /* Some kind of disk I/O error occurred */ 
    185 const int SQLITE_CORRUPT=     11;   /* The database disk image is malformed */ 
    186 const int SQLITE_NOTFOUND=    12;   /* NOT USED. Table or record not found */ 
    187 const int SQLITE_FULL=        13;   /* Insertion failed because database is full */ 
    188 const int SQLITE_CANTOPEN=    14;   /* Unable to open the database file */ 
    189 const int SQLITE_PROTOCOL=    15;   /* Database lock protocol error */ 
    190 const int SQLITE_EMPTY=       16;   /* Database is empty */ 
    191 const int SQLITE_SCHEMA=      17;   /* The database schema changed */ 
    192 const int SQLITE_TOOBIG=      18;   /* NOT USED. Too much data for one row */ 
    193 const int SQLITE_CONSTRAINT=  19;   /* Abort due to contraint violation */ 
    194 const int SQLITE_MISMATCH=    20;   /* Data type mismatch */ 
    195 const int SQLITE_MISUSE=      21;   /* Library used incorrectly */ 
    196 const int SQLITE_NOLFS=       22;   /* Uses OS features not supported on host */ 
    197 const int SQLITE_AUTH=        23;   /* Authorization denied */ 
    198 const int SQLITE_FORMAT=      24;   /* Auxiliary database format error */ 
    199 const int SQLITE_RANGE=       25;   /* 2nd parameter to sqlite3_bind out of range */ 
    200 const int SQLITE_NOTADB=      26;   /* File opened that is not a database file */ 
    201 const int SQLITE_ROW=         100;  /* sqlite3_step() has another row ready */ 
    202 const int SQLITE_DONE=        101;  /* sqlite3_step() has finished executing */ 
     256const SQLITE_ERROR =       1;   /* SQL error or missing database */ 
     257const SQLITE_INTERNAL =    2;   /* NOT USED. Internal logic error in SQLite */ 
     258const SQLITE_PERM =        3;   /* Access permission denied */ 
     259const SQLITE_ABORT =       4;   /* Callback routine requested an abort */ 
     260const SQLITE_BUSY =        5;   /* The database file is locked */ 
     261const SQLITE_LOCKED =      6;   /* A table in the database is locked */ 
     262const SQLITE_NOMEM =       7;   /* A malloc() failed */ 
     263const SQLITE_READONLY =    8;   /* Attempt to write a readonly database */ 
     264const SQLITE_INTERRUPT =   9;   /* Operation terminated by sqlite3_interrupt()*/ 
     265const SQLITE_IOERR =      10;   /* Some kind of disk I/O error occurred */ 
     266const SQLITE_CORRUPT =    11;   /* The database disk image is malformed */ 
     267const SQLITE_NOTFOUND =   12;   /* NOT USED. Table or record not found */ 
     268const SQLITE_FULL =       13;   /* Insertion failed because database is full */ 
     269const SQLITE_CANTOPEN =   14;   /* Unable to open the database file */ 
     270const SQLITE_PROTOCOL =   15;   /* NOT USED. Database lock protocol error */ 
     271const SQLITE_EMPTY =      16;   /* Database is empty */ 
     272const SQLITE_SCHEMA =     17;   /* The database schema changed */ 
     273const SQLITE_TOOBIG =     18;   /* String or BLOB exceeds size limit */ 
     274const SQLITE_CONSTRAINT = 19;   /* Abort due to constraint violation */ 
     275const SQLITE_MISMATCH =   20;   /* Data type mismatch */ 
     276const SQLITE_MISUSE =     21;   /* Library used incorrectly */ 
     277const SQLITE_NOLFS =      22;   /* Uses OS features not supported on host */ 
     278const SQLITE_AUTH =       23;   /* Authorization denied */ 
     279const SQLITE_FORMAT =     24;   /* Auxiliary database format error */ 
     280const SQLITE_RANGE =      25;   /* 2nd parameter to sqlite3_bind out of range */ 
     281const SQLITE_NOTADB =     26;   /* File opened that is not a database file */ 
     282const SQLITE_ROW =        100;  /* sqlite3_step() has another row ready */ 
     283const SQLITE_DONE =       101;  /* sqlite3_step() has finished executing */ 
    203284/* end-of-error-codes */ 
    204285 
    205286/* 
    206 ** Using the sqlite3_extended_result_codes() API, you can cause 
    207 ** SQLite to return result codes with additional information in 
    208 ** their upper bits.  The lower 8 bits will be the same as the 
    209 ** primary result codes above.  But the upper bits might contain 
    210 ** more specific error information. 
    211 ** 
    212 ** To extract the primary result code from an extended result code, 
    213 ** simply mask off the lower 8 bits. 
    214 ** 
    215 **        primary = extended & 0xff; 
    216 ** 
    217 ** New result error codes may be added from time to time.  Software 
    218 ** that uses the extended result codes should plan accordingly and be 
    219 ** sure to always handle new unknown codes gracefully. 
     287** CAPI3REF: Extended Result Codes 
     288** 
     289** In its default configuration, SQLite API routines return one of 26 integer 
     290** result codes described at result-codes.  However, experience has shown that 
     291** many of these result codes are too course-grained.  They do not provide as 
     292** much information about problems as users might like.  In an effort to 
     293** address this, newer versions of SQLite (version 3.3.8 and later) include 
     294** support for additional result codes that provide more detailed information 
     295** about errors.  The extended result codes are enabled (or disabled) for  
     296** each database 
     297** connection using the [sqlite3_extended_result_codes()] API. 
     298**  
     299** Some of the available extended result codes are listed above. 
     300** We expect the number of extended result codes will be expand 
     301** over time.  Software that uses extended result codes should expect 
     302** to see new result codes in future releases of SQLite. 
     303**  
     304** The symbolic name for an extended result code always contains a related 
     305** primary result code as a prefix.  Primary result codes contain a single 
     306** "_" character.  Extended result codes contain two or more "_" characters. 
     307** The numeric value of an extended result code can be converted to its 
     308** corresponding primary result code by masking off the lower 8 bytes. 
    220309** 
    221310** The SQLITE_OK result code will never be extended.  It will always 
    222311** be exactly zero. 
    223 ** 
    224 ** The extended result codes always have the primary result code 
    225 ** as a prefix.  Primary result codes only contain a single "_" 
    226 ** character.  Extended result codes contain two or more "_" characters. 
    227 */ 
    228 const int SQLITE_IOERR_READ=          (SQLITE_IOERR | (1<<8)); 
    229 const int SQLITE_IOERR_SHORT_READ=    (SQLITE_IOERR | (2<<8)); 
    230 const int SQLITE_IOERR_WRITE=         (SQLITE_IOERR | (3<<8)); 
    231 const int SQLITE_IOERR_FSYNC=         (SQLITE_IOERR | (4<<8)); 
    232 const int SQLITE_IOERR_DIR_FSYNC=     (SQLITE_IOERR | (5<<8)); 
    233 const int SQLITE_IOERR_TRUNCATE=      (SQLITE_IOERR | (6<<8)); 
    234 const int SQLITE_IOERR_FSTAT=         (SQLITE_IOERR | (7<<8)); 
    235 const int SQLITE_IOERR_UNLOCK=        (SQLITE_IOERR | (8<<8)); 
    236 const int SQLITE_IOERR_RDLOCK=        (SQLITE_IOERR | (9<<8)); 
    237  
    238 /* 
    239 ** Enable or disable the extended result codes. 
     312*/ 
     313const SQLITE_IOERR_READ =         (SQLITE_IOERR | (1<<8)); 
     314const SQLITE_IOERR_SHORT_READ =   (SQLITE_IOERR | (2<<8)); 
     315const SQLITE_IOERR_WRITE =        (SQLITE_IOERR | (3<<8)); 
     316const SQLITE_IOERR_FSYNC =        (SQLITE_IOERR | (4<<8)); 
     317const SQLITE_IOERR_DIR_FSYNC =    (SQLITE_IOERR | (5<<8)); 
     318const SQLITE_IOERR_TRUNCATE =     (SQLITE_IOERR | (6<<8)); 
     319const SQLITE_IOERR_FSTAT =        (SQLITE_IOERR | (7<<8)); 
     320const SQLITE_IOERR_UNLOCK =       (SQLITE_IOERR | (8<<8)); 
     321const SQLITE_IOERR_RDLOCK =       (SQLITE_IOERR | (9<<8)); 
     322const SQLITE_IOERR_DELETE =       (SQLITE_IOERR | (10<<8)); 
     323const SQLITE_IOERR_BLOCKED =      (SQLITE_IOERR | (11<<8)); 
     324const SQLITE_IOERR_NOMEM =        (SQLITE_IOERR | (12<<8)); 
     325 
     326/* 
     327** CAPI3REF: Flags For File Open Operations 
     328** 
     329** Combination of the following bit values are used as the 
     330** third argument to the [sqlite3_open_v2()] interface and 
     331** as fourth argument to the xOpen method of the 
     332** [sqlite3_vfs] object. 
     333** 
     334*/ 
     335const SQLITE_OPEN_READONLY =        0x00000001; 
     336const SQLITE_OPEN_READWRITE =       0x00000002; 
     337const SQLITE_OPEN_CREATE =          0x00000004; 
     338const SQLITE_OPEN_DELETEONCLOSE =   0x00000008; 
     339const SQLITE_OPEN_EXCLUSIVE =       0x00000010; 
     340const SQLITE_OPEN_MAIN_DB =         0x00000100; 
     341const SQLITE_OPEN_TEMP_DB =         0x00000200; 
     342const SQLITE_OPEN_TRANSIENT_DB =    0x00000400; 
     343const SQLITE_OPEN_MAIN_JOURNAL =    0x00000800; 
     344const SQLITE_OPEN_TEMP_JOURNAL =    0x00001000; 
     345const SQLITE_OPEN_SUBJOURNAL =      0x00002000; 
     346const SQLITE_OPEN_MASTER_JOURNAL =  0x00004000; 
     347 
     348/* 
     349** CAPI3REF: Device Characteristics 
     350** 
     351** The xDeviceCapabilities method of the [sqlite3_io_methods] 
     352** object returns an integer which is a vector of the following 
     353** bit values expressing I/O characteristics of the mass storage 
     354** device that holds the file that the [sqlite3_io_methods] 
     355** refers to. 
     356** 
     357** The SQLITE_IOCAP_ATOMIC property means that all writes of 
     358** any size are atomic.  The SQLITE_IOCAP_ATOMICnnn values 
     359** mean that writes of blocks that are nnn bytes in size and 
     360** are aligned to an address which is an integer multiple of 
     361** nnn are atomic.  The SQLITE_IOCAP_SAFE_APPEND value means 
     362** that when data is appended to a file, the data is appended 
     363** first then the size of the file is extended, never the other 
     364** way around.  The SQLITE_IOCAP_SEQUENTIAL property means that 
     365** information is written to disk in the same order as calls 
     366** to xWrite(). 
     367*/ 
     368const SQLITE_IOCAP_ATOMIC =         0x00000001; 
     369const SQLITE_IOCAP_ATOMIC512 =      0x00000002; 
     370const SQLITE_IOCAP_ATOMIC1K =       0x00000004; 
     371const SQLITE_IOCAP_ATOMIC2K =       0x00000008; 
     372const SQLITE_IOCAP_ATOMIC4K =       0x00000010; 
     373const SQLITE_IOCAP_ATOMIC8K =       0x00000020; 
     374const SQLITE_IOCAP_ATOMIC16K =      0x00000040; 
     375const SQLITE_IOCAP_ATOMIC32K =      0x00000080; 
     376const SQLITE_IOCAP_ATOMIC64K =      0x00000100; 
     377const SQLITE_IOCAP_SAFE_APPEND =    0x00000200; 
     378const SQLITE_IOCAP_SEQUENTIAL =     0x00000400; 
     379 
     380/* 
     381** CAPI3REF: File Locking Levels 
     382** 
     383** SQLite uses one of the following integer values as the second 
     384** argument to calls it makes to the xLock() and xUnlock() methods 
     385** of an [sqlite3_io_methods] object. 
     386*/ 
     387const SQLITE_LOCK_NONE =         0; 
     388const SQLITE_LOCK_SHARED =       1; 
     389const SQLITE_LOCK_RESERVED =     2; 
     390const SQLITE_LOCK_PENDING =      3; 
     391const SQLITE_LOCK_EXCLUSIVE =    4; 
     392 
     393/* 
     394** CAPI3REF: Synchronization Type Flags 
     395** 
     396** When SQLite invokes the xSync() method of an [sqlite3_io_methods] 
     397** object it uses a combination of the following integer values as 
     398** the second argument. 
     399** 
     400** When the SQLITE_SYNC_DATAONLY flag is used, it means that the 
     401** sync operation only needs to flush data to mass storage.  Inode 
     402** information need not be flushed.  The SQLITE_SYNC_NORMAL means  
     403** to use normal fsync() semantics.  The SQLITE_SYNC_FULL flag means  
     404** to use Mac OS-X style fullsync instead of fsync(). 
     405*/ 
     406const SQLITE_SYNC_NORMAL =       0x00002; 
     407const SQLITE_SYNC_FULL =         0x00003; 
     408const SQLITE_SYNC_DATAONLY =     0x00010; 
     409 
     410 
     411/* 
     412** CAPI3REF: OS Interface Open File Handle 
     413** 
     414** An [sqlite3_file] object represents an open file in the OS 
     415** interface layer.  Individual OS interface implementations will 
     416** want to subclass this object by appending additional fields 
     417** for their own use.  The pMethods entry is a pointer to an 
     418** [sqlite3_io_methods] object that defines methods for performing 
     419** I/O operations on the open file. 
     420*/ 
     421struct sqlite3_file { 
     422    sqlite3_io_methods* pMethods; 
     423
     424 
     425/* 
     426** CAPI3REF: OS Interface File Virtual Methods Object 
     427** 
     428** Every file opened by the [sqlite3_vfs] xOpen method contains a pointer to 
     429** an instance of the this object.  This object defines the 
     430** methods used to perform various operations against the open file. 
     431** 
     432** The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or 
     433** [SQLITE_SYNC_FULL].  The first choice is the normal fsync(). 
     434*  The second choice is an 
     435** OS-X style fullsync.  The SQLITE_SYNC_DATA flag may be ORed in to 
     436** indicate that only the data of the file and not its inode needs to be 
     437** synced. 
     438**  
     439** The integer values to xLock() and xUnlock() are one of 
     440** <ul> 
     441** <li> [SQLITE_LOCK_NONE], 
     442** <li> [SQLITE_LOCK_SHARED], 
     443** <li> [SQLITE_LOCK_RESERVED], 
     444** <li> [SQLITE_LOCK_PENDING], or 
     445** <li> [SQLITE_LOCK_EXCLUSIVE]. 
     446** </ul> 
     447** xLock() increases the lock. xUnlock() decreases the lock.   
     448** The xCheckReservedLock() method looks 
     449** to see if any database connection, either in this 
     450** process or in some other process, is holding an RESERVED, 
     451** PENDING, or EXCLUSIVE lock on the file.  It returns true 
     452** if such a lock exists and false if not. 
     453**  
     454** The xFileControl() method is a generic interface that allows custom 
     455** VFS implementations to directly control an open file using the 
     456** [sqlite3_file_control()] interface.  The second "op" argument 
     457** is an integer opcode.   The third 
     458** argument is a generic pointer which is intended to be a pointer 
     459** to a structure that may contain arguments or space in which to 
     460** write return values.  Potential uses for xFileControl() might be 
     461** functions to enable blocking locks with timeouts, to change the 
     462** locking strategy (for example to use dot-file locks), to inquire 
     463** about the status of a lock, or to break stale locks.  The SQLite 
     464** core reserves opcodes less than 100 for its own use.  
     465** A [SQLITE_FCNTL_LOCKSTATE | list of opcodes] less than 100 is available. 
     466** Applications that define a custom xFileControl method should use opcodes  
     467** greater than 100 to avoid conflicts. 
     468** 
     469** The xSectorSize() method returns the sector size of the 
     470** device that underlies the file.  The sector size is the 
     471** minimum write that can be performed without disturbing 
     472** other bytes in the file.  The xDeviceCharacteristics() 
     473** method returns a bit vector describing behaviors of the 
     474** underlying device: 
     475** 
     476** <ul> 
     477** <li> [SQLITE_IOCAP_ATOMIC] 
     478** <li> [SQLITE_IOCAP_ATOMIC512] 
     479** <li> [SQLITE_IOCAP_ATOMIC1K] 
     480** <li> [SQLITE_IOCAP_ATOMIC2K] 
     481** <li> [SQLITE_IOCAP_ATOMIC4K] 
     482** <li> [SQLITE_IOCAP_ATOMIC8K] 
     483** <li> [SQLITE_IOCAP_ATOMIC16K] 
     484** <li> [SQLITE_IOCAP_ATOMIC32K] 
     485** <li> [SQLITE_IOCAP_ATOMIC64K] 
     486** <li> [SQLITE_IOCAP_SAFE_APPEND] 
     487** <li> [SQLITE_IOCAP_SEQUENTIAL] 
     488** </ul> 
     489** 
     490** The SQLITE_IOCAP_ATOMIC property means that all writes of 
     491** any size are atomic.  The SQLITE_IOCAP_ATOMICnnn values 
     492** mean that writes of blocks that are nnn bytes in size and 
     493** are aligned to an address which is an integer multiple of 
     494** nnn are atomic.  The SQLITE_IOCAP_SAFE_APPEND value means 
     495** that when data is appended to a file, the data is appended 
     496** first then the size of the file is extended, never the other 
     497** way around.  The SQLITE_IOCAP_SEQUENTIAL property means that 
     498** information is written to disk in the same order as calls 
     499** to xWrite(). 
     500*/ 
     501struct sqlite3_io_methods { 
     502  int iVersion; 
     503  int function(sqlite3_file*) xClose; 
     504  int function(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst) xRead; 
     505  int function(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst) xWrite; 
     506  int function(sqlite3_file*, sqlite3_int64 size) xTruncate; 
     507  int function(sqlite3_file*, int flags) xSync; 
     508  int function(sqlite3_file*, sqlite3_int64 *pSize) xFileSize; 
     509  int function(sqlite3_file*, int) xLock; 
     510  int function(sqlite3_file*, int) xUnlock; 
     511  int function(sqlite3_file*) xCheckReservedLock; 
     512  int function(sqlite3_file*, int op, void* pArg) xFileControl; 
     513  int function(sqlite3_file*) xSectorSize; 
     514  int function(sqlite3_file*) xDeviceCharacteristics; 
     515  /* Additional methods may be added in future releases */ 
     516
     517 
     518/* 
     519** CAPI3REF: Standard File Control Opcodes 
     520** 
     521** These integer constants are opcodes for the xFileControl method 
     522** of the [sqlite3_io_methods] object and to the [sqlite3_file_control()] 
     523** interface. 
     524** 
     525** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging.  This 
     526** opcode cases the xFileControl method to write the current state of 
     527** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED], 
     528** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE]) 
     529** into an integer that the pArg argument points to.  This capability 
     530** is used during testing and only needs to be supported when SQLITE_TEST 
     531** is defined. 
     532*/ 
     533const SQLITE_FCNTL_LOCKSTATE =       1; 
     534 
     535/* 
     536** CAPI3REF: Mutex Handle 
     537** 
     538** The mutex module within SQLite defines [sqlite3_mutex] to be an 
     539** abstract type for a mutex object.  The SQLite core never looks 
     540** at the internal representation of an [sqlite3_mutex].  It only 
     541** deals with pointers to the [sqlite3_mutex] object. 
     542** 
     543** Mutexes are created using [sqlite3_mutex_alloc()]. 
     544*/ 
     545struct sqlite3_mutex; 
     546 
     547/* 
     548** CAPI3REF: OS Interface Object 
     549** 
     550** An instance of this object defines the interface between the 
     551** SQLite core and the underlying operating system.  The "vfs" 
     552** in the name of the object stands for "virtual file system". 
     553** 
     554** The iVersion field is initially 1 but may be larger for future 
     555** versions of SQLite.  Additional fields may be appended to this 
     556** object when the iVersion value is increased. 
     557** 
     558** The szOsFile field is the size of the subclassed [sqlite3_file] 
     559** structure used by this VFS.  mxPathname is the maximum length of 
     560** a pathname in this VFS. 
     561** 
     562** Registered vfs modules are kept on a linked list formed by 
     563** the pNext pointer.  The [sqlite3_vfs_register()] 
     564** and [sqlite3_vfs_unregister()] interfaces manage this list 
     565** in a thread-safe way.  The [sqlite3_vfs_find()] interface 
     566** searches the list. 
     567** 
     568** The pNext field is the only fields in the sqlite3_vfs  
     569** structure that SQLite will ever modify.  SQLite will only access 
     570** or modify this field while holding a particular static mutex. 
     571** The application should never modify anything within the sqlite3_vfs 
     572** object once the object has been registered. 
     573** 
     574** The zName field holds the name of the VFS module.  The name must 
     575** be unique across all VFS modules. 
     576** 
     577** SQLite will guarantee that the zFilename string passed to 
     578** xOpen() is a full pathname as generated by xFullPathname() and 
     579** that the string will be valid and unchanged until xClose() is 
     580** called.  So the [sqlite3_file] can store a pointer to the 
     581** filename if it needs to remember the filename for some reason. 
     582** 
     583** The flags argument to xOpen() is a copy of the flags argument 
     584** to [sqlite3_open_v2()].  If [sqlite3_open()] or [sqlite3_open16()] 
     585** is used, then flags is [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]. 
     586** If xOpen() opens a file read-only then it sets *pOutFlags to 
     587** include [SQLITE_OPEN_READONLY].  Other bits in *pOutFlags may be 
     588** set. 
     589**  
     590** SQLite will also add one of the following flags to the xOpen() 
     591** call, depending on the object being opened: 
     592**  
     593** <ul> 
     594** <li>  [SQLITE_OPEN_MAIN_DB] 
     595** <li>  [SQLITE_OPEN_MAIN_JOURNAL] 
     596** <li>  [SQLITE_OPEN_TEMP_DB] 
     597** <li>  [SQLITE_OPEN_TEMP_JOURNAL] 
     598** <li>  [SQLITE_OPEN_TRANSIENT_DB] 
     599** <li>  [SQLITE_OPEN_SUBJOURNAL] 
     600** <li>  [SQLITE_OPEN_MASTER_JOURNAL] 
     601** </ul> 
     602** 
     603** The file I/O implementation can use the object type flags to 
     604** changes the way it deals with files.  For example, an application 
     605** that does not care about crash recovery or rollback, might make 
     606** the open of a journal file a no-op.  Writes to this journal are 
     607** also a no-op.  Any attempt to read the journal return SQLITE_IOERR. 
     608** Or the implementation might recognize the a database file will 
     609** be doing page-aligned sector reads and writes in a random order 
     610** and set up its I/O subsystem accordingly. 
     611**  
     612** SQLite might also add one of the following flags to the xOpen 
     613** method: 
     614**  
     615** <ul> 
     616** <li> [SQLITE_OPEN_DELETEONCLOSE] 
     617** <li> [SQLITE_OPEN_EXCLUSIVE] 
     618** </ul> 
     619**  
     620** The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be 
     621** deleted when it is closed.  This will always be set for TEMP  
     622** databases and journals and for subjournals.  The  
     623** [SQLITE_OPEN_EXCLUSIVE] flag means the file should be opened 
     624** for exclusive access.  This flag is set for all files except 
     625** for the main database file. 
     626**  
     627** Space to hold the  [sqlite3_file] structure passed as the third  
     628** argument to xOpen is allocated by caller (the SQLite core).  
     629** szOsFile bytes are allocated for this object.  The xOpen method 
     630** fills in the allocated space. 
     631**  
     632** The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS]  
     633** to test for the existance of a file, 
     634** or [SQLITE_ACCESS_READWRITE] to test to see 
     635** if a file is readable and writable, or [SQLITE_ACCESS_READ] 
     636** to test to see if a file is at least readable.  The file can be a  
     637** directory. 
     638**  
     639** SQLite will always allocate at least mxPathname+1 byte for 
     640** the output buffers for xGetTempname and xFullPathname. The exact 
     641** size of the output buffer is also passed as a parameter to both  
     642** methods. If the output buffer is not large enough, SQLITE_CANTOPEN 
     643** should be returned. As this is handled as a fatal error by SQLite, 
     644** vfs implementations should endevour to prevent this by setting  
     645** mxPathname to a sufficiently large value. 
     646**  
     647** The xRandomness(), xSleep(), and xCurrentTime() interfaces 
     648** are not strictly a part of the filesystem, but they are 
     649** included in the VFS structure for completeness. 
     650** The xRandomness() function attempts to return nBytes bytes 
     651** of good-quality randomness into zOut.  The return value is 
     652** the actual number of bytes of randomness obtained.  The 
     653** xSleep() method cause the calling thread to sleep for at 
     654** least the number of microseconds given.  The xCurrentTime() 
     655** method returns a Julian Day Number for the current date and 
     656** time. 
     657*/ 
     658struct sqlite3_vfs { 
     659  int iVersion;            /* Structure version number */ 
     660  int szOsFile;            /* Size of subclassed sqlite3_file */ 
     661  int mxPathname;          /* Maximum file pathname length */ 
     662  sqlite3_vfs* pNext;      /* Next registered VFS */ 
     663  char* zName;             /* Name of this virtual file system */ 
     664  void* pAppData;          /* Pointer to application-specific data */ 
     665  int function(sqlite3_vfs*, char* zName, sqlite3_file*, int flags, int* pOutFlags) xOpen; 
     666  int function(sqlite3_vfs*, char* zName, int syncDir) xDelete; 
     667  int function(sqlite3_vfs*, char* zName, int flags) xAccess; 
     668  int function(sqlite3_vfs*, int nOut, char* zOut) xGetTempName; 
     669  int function(sqlite3_vfs*, char* zName, int nOut, char* zOut) xFullPathname; 
     670  void* function(sqlite3_vfs*, char* zFileName) xDlOpen; 
     671  void* function(sqlite3_vfs*, int nByte, char* zErrMsg) xDlError; 
     672  void* function(sqlite3_vfs*, void*, char* zSymbol) xDlSym; 
     673  void function(sqlite3_vfs*, void*) xDlClose; 
     674  int function(sqlite3_vfs*, int nByte, char* zOut) xRandomness; 
     675  int function(sqlite3_vfs*, int microseconds) xSleep; 
     676  int function(sqlite3_vfs, double*) xCurrentTime; 
     677  /* New fields may be appended in figure versions.  The iVersion 
     678  ** value will increment whenever this happens. */ 
     679
     680 
     681/* 
     682** CAPI3REF: Flags for the xAccess VFS method 
     683** 
     684** These integer constants can be used as the third parameter to 
     685** the xAccess method of an [sqlite3_vfs] object.  They determine 
     686** the kind of what kind of permissions the xAccess method is 
     687** looking for.  With SQLITE_ACCESS_EXISTS, the xAccess method 
     688** simply checks to see if the file exists.  With SQLITE_ACCESS_READWRITE, 
     689** the xAccess method checks to see if the file is both readable 
     690** and writable.  With SQLITE_ACCESS_READ the xAccess method 
     691** checks to see if the file is readable. 
     692*/ 
     693const SQLITE_ACCESS_EXISTS =    0; 
     694const SQLITE_ACCESS_READWRITE = 1; 
     695const SQLITE_ACCESS_READ =      2; 
     696 
     697/* 
     698** CAPI3REF: Enable Or Disable Extended Result Codes 
     699** 
     700** This routine enables or disables the 
     701** [SQLITE_IOERR_READ | extended result codes] feature. 
     702** By default, SQLite API routines return one of only 26 integer 
     703** [SQLITE_OK | result codes].  When extended result codes 
     704** are enabled by this routine, the repetoire of result codes can be 
     705** much larger and can (hopefully) provide more detailed information 
     706** about the cause of an error. 
     707** 
     708** The second argument is a boolean value that turns extended result 
     709** codes on and off.  Extended result codes are off by default for 
     710** backwards compatibility with older versions of SQLite. 
    240711*/ 
    241712int sqlite3_extended_result_codes(sqlite3*, int onoff); 
    242713 
    243714/* 
    244 ** Each entry in an SQLite table has a unique integer key.  (The key is 
    245 ** the value of the INTEGER PRIMARY KEY column if there is such a column, 
    246 ** otherwise the key is generated at random.  The unique key is always 
    247 ** available as the ROWID, OID, or _ROWID_ column.)  The following routine 
    248 ** returns the integer key of the most recent insert in the database. 
    249 ** 
    250 ** This function is similar to the mysql_insert_id() function from MySQL. 
    251 */ 
    252 long sqlite3_last_insert_rowid(sqlite3*); 
    253  
    254 /* 
     715** CAPI3REF: Last Insert Rowid 
     716** 
     717** Each entry in an SQLite table has a unique 64-bit signed integer key 
     718** called the "rowid". The rowid is always available as an undeclared 
     719** column named ROWID, OID, or _ROWID_.  If the table has a column of 
     720** type INTEGER PRIMARY KEY then that column is another an alias for the 
     721** rowid. 
     722** 
     723** This routine returns the rowid of the most recent INSERT into 
     724** the database from the database connection given in the first  
     725** argument.  If no inserts have ever occurred on this database 
     726** connection, zero is returned. 
     727** 
     728** If an INSERT occurs within a trigger, then the rowid of the 
     729** inserted row is returned by this routine as long as the trigger 
     730** is running.  But once the trigger terminates, the value returned 
     731** by this routine reverts to the last value inserted before the 
     732** trigger fired. 
     733** 
     734** If another thread does a new insert on the same database connection 
     735** while this routine is running and thus changes the last insert rowid, 
     736** then the return value of this routine is undefined. 
     737*/ 
     738sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*); 
     739 
     740/* 
     741** CAPI3REF: Count The Number Of Rows Modified 
     742** 
    255743** This function returns the number of database rows that were changed 
    256 ** (or inserted or deleted) by the most recent called sqlite3_exec(). 
     744** (or inserted or deleted) by the most recent SQL statement.  Only 
     745** changes that are directly specified by the INSERT, UPDATE, or 
     746** DELETE statement are counted.  Auxiliary changes caused by 
     747** triggers are not counted.  Use the [sqlite3_total_changes()] function 
     748** to find the total number of changes including changes caused by triggers. 
     749** 
     750** Within the body of a trigger, the sqlite3_changes() interface can be 
     751** called to find the number of 
     752** changes in the most recently completed INSERT, UPDATE, or DELETE 
     753** statement within the body of the trigger. 
    257754** 
    258755** All changes are counted, even if they were later undone by a 
     
    260757** dropping tables are not counted. 
    261758** 
    262 ** If a callback invokes sqlite3_exec() recursively, then the changes 
    263 ** in the inner, recursive call are counted together with the changes 
    264 ** in the outer call. 
     759** If a callback invokes [sqlite3_exec()] or [sqlite3_step()] recursively, 
     760** then the changes in the inner, recursive call are counted together 
     761** with the changes in the outer call. 
     762** 
     763** SQLite implements the command "DELETE FROM table" without a WHERE clause 
     764** by dropping and recreating the table.  (This is much faster than going 
     765** through and deleting individual elements from the table.)  Because of 
     766** this optimization, the change count for "DELETE FROM table" will be 
     767** zero regardless of the number of elements that were originally in the 
     768** table. To get an accurate count of the number of rows deleted, use 
     769** "DELETE FROM table WHERE 1" instead. 
     770** 
     771** If another thread makes changes on the same database connection 
     772** while this routine is running then the return value of this routine 
     773** is undefined. 
     774*/ 
     775int sqlite3_changes(sqlite3*); 
     776 
     777/* 
     778** CAPI3REF: Total Number Of Rows Modified 
     779*** 
     780** This function returns the number of database rows that have been 
     781** modified by INSERT, UPDATE or DELETE statements since the database handle 
     782** was opened. This includes UPDATE, INSERT and DELETE statements executed 
     783** as part of trigger programs. All changes are counted as soon as the 
     784** statement that makes them is completed (when the statement handle is 
     785** passed to [sqlite3_reset()] or [sqlite3_finalize()]). 
     786** 
     787** See also the [sqlite3_change()] interface. 
    265788** 
    266789** SQLite implements the command "DELETE FROM table" without a WHERE clause 
     
    271794** table. To get an accurate count of the number of rows deleted, use 
    272795** "DELETE FROM table WHERE 1" instead. 
    273 */ 
    274 int sqlite3_changes(sqlite3*); 
    275  
    276 /* 
    277 ** This function returns the number of database rows that have been 
    278 ** modified by INSERT, UPDATE or DELETE statements since the database handle 
    279 ** was opened. This includes UPDATE, INSERT and DELETE statements executed 
    280 ** as part of trigger programs. All changes are counted as soon as the 
    281 ** statement that makes them is completed (when the statement handle is 
    282 ** passed to sqlite3_reset() or sqlite_finalise()). 
    283 ** 
    284 ** SQLite implements the command "DELETE FROM table" without a WHERE clause 
    285 ** by dropping and recreating the table.  (This is much faster than going 
    286 ** through and deleting individual elements form the table.)  Because of 
    287 ** this optimization, the change count for "DELETE FROM table" will be 
    288 ** zero regardless of the number of elements that were originally in the 
    289 ** table. To get an accurate count of the number of rows deleted, use 
    290 ** "DELETE FROM table WHERE 1" instead. 
     796** 
     797** If another thread makes changes on the same database connection 
     798** while this routine is running then the return value of this routine 
     799** is undefined. 
    291800*/ 
    292801int sqlite3_total_changes(sqlite3*); 
    293802 
    294 /* This function causes any pending database operation to abort and 
     803/* 
     804** CAPI3REF: Interrupt A Long-Running Query 
     805** 
     806** This function causes any pending database operation to abort and 
    295807** return at its earliest opportunity.  This routine is typically 
    296808** called in response to a user action such as pressing "Cancel" 
    297809** or Ctrl-C where the user wants a long query operation to halt 
    298810** immediately. 
     811** 
     812** It is safe to call this routine from a thread different from the 
     813** thread that is currently running the database operation.  But it 
     814** is not safe to call this routine with a database connection that 
     815** is closed or might close before sqlite3_interrupt() returns. 
     816** 
     817** The SQL operation that is interrupted will return [SQLITE_INTERRUPT]. 
     818** If an interrupted operation was an update that is inside an 
     819** explicit transaction, then the entire transaction will be rolled 
     820** back automatically. 
    299821*/ 
    300822void sqlite3_interrupt(sqlite3*); 
    301823 
    302  
    303 /* These functions return true if the given input string comprises 
     824/* 
     825** CAPI3REF: Determine If An SQL Statement Is Complete 
     826** 
     827** These functions return true if the given input string comprises 
    304828** one or more complete SQL statements. For the sqlite3_complete() call, 
    305829** the parameter must be a nul-terminated UTF-8 string. For 
     
    307831** is required. 
    308832** 
    309 ** The algorithm is simple.  If the last token other than spaces 
    310 ** and comments is a semicolon, then return true.  otherwise return 
    311 ** false. 
    312 */ 
    313 int sqlite3_complete(/*const */char* sql); 
    314 int sqlite3_complete16(/*const */wchar* sql); 
    315  
    316 /* 
    317 ** This routine identifies a callback function that is invoked 
    318 ** whenever an attempt is made to open a database table that is 
    319 ** currently locked by another process or thread.  If the busy callback 
    320 ** is NULL, then sqlite3_exec() returns SQLITE_BUSY immediately if 
    321 ** it finds a locked table.  If the busy callback is not NULL, then 
    322 ** sqlite3_exec() invokes the callback with two arguments.  The 
     833** These routines are useful for command-line input to determine if the 
     834** currently entered text forms one or more complete SQL statements or 
     835** if additional input is needed before sending the statements into 
     836** SQLite for parsing. The algorithm is simple.  If the  
     837** last token other than spaces and comments is a semicolon, then return  
     838** true.  Actually, the algorithm is a little more complicated than that 
     839** in order to deal with triggers, but the basic idea is the same:  the 
     840** statement is not complete unless it ends in a semicolon. 
     841*/ 
     842int sqlite3_complete(char* sql); 
     843int sqlite3_complete16(void* sql); 
     844 
     845/* 
     846** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors 
     847** 
     848** This routine identifies a callback function that might be invoked 
     849** whenever an attempt is made to open a database table  
     850** that another thread or process has locked. 
     851** If the busy callback is NULL, then [SQLITE_BUSY] 
     852** (or sometimes [SQLITE_IOERR_BLOCKED]) 
     853** is returned immediately upon encountering the lock. 
     854** If the busy callback is not NULL, then the 
     855** callback will be invoked with two arguments.  The 
    323856** first argument to the handler is a copy of the void* pointer which 
    324857** is the third argument to this routine.  The second argument to 
    325858** the handler is the number of times that the busy handler has 
    326 ** been invoked for this locking event.  If the 
    327 ** busy callback returns 0, then sqlite3_exec() immediately returns 
    328 ** SQLITE_BUSY.  If the callback returns non-zero, then sqlite3_exec() 
    329 ** tries to open the table again and the cycle repeats. 
     859** been invoked for this locking event. If the 
     860** busy callback returns 0, then no additional attempts are made to 
     861** access the database and [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED] is returned. 
     862** If the callback returns non-zero, then another attempt is made to open the 
     863** database for reading and the cycle repeats. 
    330864** 
    331865** The presence of a busy handler does not guarantee that 
    332866** it will be invoked when there is lock contention. 
    333867** If SQLite determines that invoking the busy handler could result in 
    334 ** a deadlock, it will return SQLITE_BUSY instead. 
     868** a deadlock, it will return [SQLITE_BUSY] instead. 
    335869** Consider a scenario where one process is holding a read lock that 
    336870** it is trying to promote to a reserved lock and 
     
    340874** proceed because it is blocked by the first.  If both processes 
    341875** invoke the busy handlers, neither will make any progress.  Therefore, 
    342 ** SQLite returns SQLITE_BUSY for the first process, hoping that this 
     876** SQLite returns [SQLITE_BUSY] for the first process, hoping that this 
    343877** will induce the first process to release its read lock and allow 
    344878** the second process to proceed. 
     
    346880** The default busy callback is NULL. 
    347881** 
     882** The [SQLITE_BUSY] error is converted to [SQLITE_IOERR_BLOCKED] when 
     883** SQLite is in the middle of a large transaction where all