System.Data.SQLite
Check-in [e7d1758f41]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:3.6.15
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | sourceforge
Files: files | file ages | folders
SHA1: e7d1758f41fa10c6b186a802af06862d57c15ac5
User & Date: rmsimpson 2009-06-19 21:04:12
Context
2009-06-29
22:59
1.0.63.0 check-in: 26297c39cc user: rmsimpson tags: sourceforge
2009-06-19
21:04
3.6.15 check-in: e7d1758f41 user: rmsimpson tags: sourceforge
20:57
1.0.62.0 check-in: 5ab035e676 user: rmsimpson tags: sourceforge
Changes
Hide Diffs Side-by-Side Diffs Show Whitespace Changes Patch

Changes to SQLite.Interop/src/sqlite3.c.

more than 10,000 changes

Changes to SQLite.Interop/src/sqlite3.h.

    26     26   ** on how SQLite interfaces are suppose to operate.
    27     27   **
    28     28   ** The name of this file under configuration management is "sqlite.h.in".
    29     29   ** The makefile makes some minor changes to this file (such as inserting
    30     30   ** the version number) and changes its name to "sqlite3.h" as
    31     31   ** part of the build process.
    32     32   **
    33         -** @(#) $Id: sqlite3.h,v 1.39 2009/04/28 16:17:45 rmsimpson Exp $
           33  +** @(#) $Id: sqlite3.h,v 1.40 2009/06/19 21:04:12 rmsimpson Exp $
    34     34   */
    35     35   #ifndef _SQLITE3_H_
    36     36   #define _SQLITE3_H_
    37     37   #include <stdarg.h>     /* Needed for the definition of va_list */
    38     38   
    39     39   /*
    40     40   ** Make sure we can call this stuff from C++.
................................................................................
    95     95   ** The Z value is the release number and is incremented with
    96     96   ** each release but resets back to 0 whenever Y is incremented.
    97     97   **
    98     98   ** See also: [sqlite3_libversion()] and [sqlite3_libversion_number()].
    99     99   **
   100    100   ** Requirements: [H10011] [H10014]
   101    101   */
   102         -#define SQLITE_VERSION         "3.6.13"
   103         -#define SQLITE_VERSION_NUMBER  3006013
          102  +#define SQLITE_VERSION         "3.6.15"
          103  +#define SQLITE_VERSION_NUMBER  3006015
   104    104   
   105    105   /*
   106    106   ** CAPI3REF: Run-Time Library Version Numbers {H10020} <S60100>
   107    107   ** KEYWORDS: sqlite3_version
   108    108   **
   109    109   ** These features provide the same information as the [SQLITE_VERSION]
   110    110   ** and [SQLITE_VERSION_NUMBER] #defines in the header, but are associated
................................................................................
   388    388   ** CAPI3REF: Flags For File Open Operations {H10230} <H11120> <H12700>
   389    389   **
   390    390   ** These bit values are intended for use in the
   391    391   ** 3rd parameter to the [sqlite3_open_v2()] interface and
   392    392   ** in the 4th parameter to the xOpen method of the
   393    393   ** [sqlite3_vfs] object.
   394    394   */
   395         -#define SQLITE_OPEN_READONLY         0x00000001
   396         -#define SQLITE_OPEN_READWRITE        0x00000002
   397         -#define SQLITE_OPEN_CREATE           0x00000004
   398         -#define SQLITE_OPEN_DELETEONCLOSE    0x00000008
   399         -#define SQLITE_OPEN_EXCLUSIVE        0x00000010
   400         -#define SQLITE_OPEN_MAIN_DB          0x00000100
   401         -#define SQLITE_OPEN_TEMP_DB          0x00000200
   402         -#define SQLITE_OPEN_TRANSIENT_DB     0x00000400
   403         -#define SQLITE_OPEN_MAIN_JOURNAL     0x00000800
   404         -#define SQLITE_OPEN_TEMP_JOURNAL     0x00001000
   405         -#define SQLITE_OPEN_SUBJOURNAL       0x00002000
   406         -#define SQLITE_OPEN_MASTER_JOURNAL   0x00004000
   407         -#define SQLITE_OPEN_NOMUTEX          0x00008000
   408         -#define SQLITE_OPEN_FULLMUTEX        0x00010000
          395  +#define SQLITE_OPEN_READONLY         0x00000001  /* Ok for sqlite3_open_v2() */
          396  +#define SQLITE_OPEN_READWRITE        0x00000002  /* Ok for sqlite3_open_v2() */
          397  +#define SQLITE_OPEN_CREATE           0x00000004  /* Ok for sqlite3_open_v2() */
          398  +#define SQLITE_OPEN_DELETEONCLOSE    0x00000008  /* VFS only */
          399  +#define SQLITE_OPEN_EXCLUSIVE        0x00000010  /* VFS only */
          400  +#define SQLITE_OPEN_MAIN_DB          0x00000100  /* VFS only */
          401  +#define SQLITE_OPEN_TEMP_DB          0x00000200  /* VFS only */
          402  +#define SQLITE_OPEN_TRANSIENT_DB     0x00000400  /* VFS only */
          403  +#define SQLITE_OPEN_MAIN_JOURNAL     0x00000800  /* VFS only */
          404  +#define SQLITE_OPEN_TEMP_JOURNAL     0x00001000  /* VFS only */
          405  +#define SQLITE_OPEN_SUBJOURNAL       0x00002000  /* VFS only */
          406  +#define SQLITE_OPEN_MASTER_JOURNAL   0x00004000  /* VFS only */
          407  +#define SQLITE_OPEN_NOMUTEX          0x00008000  /* Ok for sqlite3_open_v2() */
          408  +#define SQLITE_OPEN_FULLMUTEX        0x00010000  /* Ok for sqlite3_open_v2() */
   409    409   
   410    410   /*
   411    411   ** CAPI3REF: Device Characteristics {H10240} <H11120>
   412    412   **
   413    413   ** The xDeviceCapabilities method of the [sqlite3_io_methods]
   414    414   ** object returns an integer which is a vector of the these
   415    415   ** bit values expressing I/O characteristics of the mass storage
................................................................................
   698    698   ** <li> [SQLITE_OPEN_EXCLUSIVE]
   699    699   ** </ul>
   700    700   **
   701    701   ** The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be
   702    702   ** deleted when it is closed.  The [SQLITE_OPEN_DELETEONCLOSE]
   703    703   ** will be set for TEMP  databases, journals and for subjournals.
   704    704   **
   705         -** The [SQLITE_OPEN_EXCLUSIVE] flag means the file should be opened
   706         -** for exclusive access.  This flag is set for all files except
   707         -** for the main database file.
          705  +** The [SQLITE_OPEN_EXCLUSIVE] flag is always used in conjunction
          706  +** with the [SQLITE_OPEN_CREATE] flag, which are both directly
          707  +** analogous to the O_EXCL and O_CREAT flags of the POSIX open()
          708  +** API.  The SQLITE_OPEN_EXCLUSIVE flag, when paired with the 
          709  +** SQLITE_OPEN_CREATE, is used to indicate that file should always
          710  +** be created, and that it is an error if it already exists.
          711  +** It is <i>not</i> used to indicate the file should be opened 
          712  +** for exclusive access.
   708    713   **
   709    714   ** At least szOsFile bytes of memory are allocated by SQLite
   710    715   ** to hold the  [sqlite3_file] structure passed as the third
   711    716   ** argument to xOpen.  The xOpen method does not have to
   712    717   ** allocate the structure; it should just fill it in.
   713    718   **
   714    719   ** The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS]
................................................................................
   786    791   **
   787    792   ** A call to sqlite3_initialize() is an "effective" call if it is
   788    793   ** the first time sqlite3_initialize() is invoked during the lifetime of
   789    794   ** the process, or if it is the first time sqlite3_initialize() is invoked
   790    795   ** following a call to sqlite3_shutdown().  Only an effective call
   791    796   ** of sqlite3_initialize() does any initialization.  All other calls
   792    797   ** are harmless no-ops.
          798  +**
          799  +** A call to sqlite3_shutdown() is an "effective" call if it is the first
          800  +** call to sqlite3_shutdown() since the last sqlite3_initialize().  Only
          801  +** an effective call to sqlite3_shutdown() does any deinitialization.
          802  +** All other calls to sqlite3_shutdown() are harmless no-ops.
   793    803   **
   794    804   ** Among other things, sqlite3_initialize() shall invoke
   795    805   ** sqlite3_os_init().  Similarly, sqlite3_shutdown()
   796    806   ** shall invoke sqlite3_os_end().
   797    807   **
   798    808   ** The sqlite3_initialize() routine returns [SQLITE_OK] on success.
   799    809   ** If for some reason, sqlite3_initialize() is unable to initialize
................................................................................
  1022   1032   **   <li> [sqlite3_soft_heap_limit()]
  1023   1033   **   <li> [sqlite3_status()]
  1024   1034   **   </ul>
  1025   1035   ** </dd>
  1026   1036   **
  1027   1037   ** <dt>SQLITE_CONFIG_SCRATCH</dt>
  1028   1038   ** <dd>This option specifies a static memory buffer that SQLite can use for
  1029         -** scratch memory.  There are three arguments:  A pointer to the memory, the
  1030         -** size of each scratch buffer (sz), and the number of buffers (N).  The sz
         1039  +** scratch memory.  There are three arguments:  A pointer an 8-byte
         1040  +** aligned memory buffer from which the scrach allocations will be
         1041  +** drawn, the size of each scratch allocation (sz),
         1042  +** and the maximum number of scratch allocations (N).  The sz
  1031   1043   ** argument must be a multiple of 16. The sz parameter should be a few bytes
  1032         -** larger than the actual scratch space required due internal overhead.
  1033         -** The first
  1034         -** argument should point to an allocation of at least sz*N bytes of memory.
         1044  +** larger than the actual scratch space required due to internal overhead.
         1045  +** The first argument should pointer to an 8-byte aligned buffer
         1046  +** of at least sz*N bytes of memory.
  1035   1047   ** SQLite will use no more than one scratch buffer at once per thread, so
  1036   1048   ** N should be set to the expected maximum number of threads.  The sz
  1037   1049   ** parameter should be 6 times the size of the largest database page size.
  1038   1050   ** Scratch buffers are used as part of the btree balance operation.  If
  1039   1051   ** The btree balancer needs additional memory beyond what is provided by
  1040   1052   ** scratch buffers or if no scratch buffer space is specified, then SQLite
  1041   1053   ** goes to [sqlite3_malloc()] to obtain the memory it needs.</dd>
  1042   1054   **
  1043   1055   ** <dt>SQLITE_CONFIG_PAGECACHE</dt>
  1044   1056   ** <dd>This option specifies a static memory buffer that SQLite can use for
  1045   1057   ** the database page cache with the default page cache implemenation.  
  1046   1058   ** This configuration should not be used if an application-define page
  1047   1059   ** cache implementation is loaded using the SQLITE_CONFIG_PCACHE option.
  1048         -** There are three arguments to this option: A pointer to the
         1060  +** There are three arguments to this option: A pointer to 8-byte aligned
  1049   1061   ** memory, the size of each page buffer (sz), and the number of pages (N).
  1050         -** The sz argument must be a power of two between 512 and 32768.  The first
         1062  +** The sz argument should be the size of the largest database page
         1063  +** (a power of two between 512 and 32768) plus a little extra for each
         1064  +** page header.  The page header size is 20 to 40 bytes depending on
         1065  +** the host architecture.  It is harmless, apart from the wasted memory,
         1066  +** to make sz a little too large.  The first
  1051   1067   ** argument should point to an allocation of at least sz*N bytes of memory.
  1052   1068   ** SQLite will use the memory provided by the first argument to satisfy its
  1053   1069   ** memory needs for the first N pages that it adds to cache.  If additional
  1054   1070   ** page cache memory is needed beyond what is provided by this option, then
  1055   1071   ** SQLite goes to [sqlite3_malloc()] for the additional storage space.
  1056   1072   ** The implementation might use one or more of the N buffers to hold 
  1057         -** memory accounting information. </dd>
         1073  +** memory accounting information. The pointer in the first argument must
         1074  +** be aligned to an 8-byte boundary or subsequent behavior of SQLite
         1075  +** will be undefined.</dd>
  1058   1076   **
  1059   1077   ** <dt>SQLITE_CONFIG_HEAP</dt>
  1060   1078   ** <dd>This option specifies a static memory buffer that SQLite will use
  1061   1079   ** for all of its dynamic memory allocation needs beyond those provided
  1062   1080   ** for by [SQLITE_CONFIG_SCRATCH] and [SQLITE_CONFIG_PAGECACHE].
  1063         -** There are three arguments: A pointer to the memory, the number of
  1064         -** bytes in the memory buffer, and the minimum allocation size.  If
  1065         -** the first pointer (the memory pointer) is NULL, then SQLite reverts
         1081  +** There are three arguments: An 8-byte aligned pointer to the memory,
         1082  +** the number of bytes in the memory buffer, and the minimum allocation size.
         1083  +** If the first pointer (the memory pointer) is NULL, then SQLite reverts
  1066   1084   ** to using its default memory allocator (the system malloc() implementation),
  1067   1085   ** undoing any prior invocation of [SQLITE_CONFIG_MALLOC].  If the
  1068   1086   ** memory pointer is not NULL and either [SQLITE_ENABLE_MEMSYS3] or
  1069   1087   ** [SQLITE_ENABLE_MEMSYS5] are defined, then the alternative memory
  1070         -** allocator is engaged to handle all of SQLites memory allocation needs.</dd>
         1088  +** allocator is engaged to handle all of SQLites memory allocation needs.
         1089  +** The first pointer (the memory pointer) must be aligned to an 8-byte
         1090  +** boundary or subsequent behavior of SQLite will be undefined.</dd>
  1071   1091   **
  1072   1092   ** <dt>SQLITE_CONFIG_MUTEX</dt>
  1073   1093   ** <dd>This option takes a single argument which is a pointer to an
  1074   1094   ** instance of the [sqlite3_mutex_methods] structure.  The argument specifies
  1075   1095   ** alternative low-level mutex routines to be used in place
  1076   1096   ** the mutex routines built into SQLite.</dd>
  1077   1097   **
................................................................................
  1134   1154   ** is invoked.
  1135   1155   **
  1136   1156   ** <dl>
  1137   1157   ** <dt>SQLITE_DBCONFIG_LOOKASIDE</dt>
  1138   1158   ** <dd>This option takes three additional arguments that determine the 
  1139   1159   ** [lookaside memory allocator] configuration for the [database connection].
  1140   1160   ** The first argument (the third parameter to [sqlite3_db_config()] is a
  1141         -** pointer to a memory buffer to use for lookaside memory.  The first
  1142         -** argument may be NULL in which case SQLite will allocate the lookaside
  1143         -** buffer itself using [sqlite3_malloc()].  The second argument is the
         1161  +** pointer to an 8-byte aligned memory buffer to use for lookaside memory.
         1162  +** The first argument may be NULL in which case SQLite will allocate the
         1163  +** lookaside buffer itself using [sqlite3_malloc()].  The second argument is the
  1144   1164   ** size of each lookaside buffer slot and the third argument is the number of
  1145   1165   ** slots.  The size of the buffer in the first argument must be greater than
  1146   1166   ** or equal to the product of the second and third arguments.</dd>
  1147   1167   **
  1148   1168   ** </dl>
  1149   1169   */
  1150   1170   #define SQLITE_DBCONFIG_LOOKASIDE    1001  /* void* int int */
................................................................................
  1213   1233   ** This function returns the number of database rows that were changed
  1214   1234   ** or inserted or deleted by the most recently completed SQL statement
  1215   1235   ** on the [database connection] specified by the first parameter.
  1216   1236   ** Only changes that are directly specified by the [INSERT], [UPDATE],
  1217   1237   ** or [DELETE] statement are counted.  Auxiliary changes caused by
  1218   1238   ** triggers are not counted. Use the [sqlite3_total_changes()] function
  1219   1239   ** to find the total number of changes including changes caused by triggers.
         1240  +**
         1241  +** Changes to a view that are simulated by an [INSTEAD OF trigger]
         1242  +** are not counted.  Only real table changes are counted.
  1220   1243   **
  1221   1244   ** A "row change" is a change to a single row of a single table
  1222   1245   ** caused by an INSERT, DELETE, or UPDATE statement.  Rows that
  1223         -** are changed as side effects of REPLACE constraint resolution,
  1224         -** rollback, ABORT processing, DROP TABLE, or by any other
         1246  +** are changed as side effects of [REPLACE] constraint resolution,
         1247  +** rollback, ABORT processing, [DROP TABLE], or by any other
  1225   1248   ** mechanisms do not count as direct row changes.
  1226   1249   **
  1227   1250   ** A "trigger context" is a scope of execution that begins and
  1228         -** ends with the script of a trigger.  Most SQL statements are
         1251  +** ends with the script of a [CREATE TRIGGER | trigger]. 
         1252  +** Most SQL statements are
  1229   1253   ** evaluated outside of any trigger.  This is the "top level"
  1230   1254   ** trigger context.  If a trigger fires from the top level, a
  1231   1255   ** new trigger context is entered for the duration of that one
  1232   1256   ** trigger.  Subtriggers create subcontexts for their duration.
  1233   1257   **
  1234   1258   ** Calling [sqlite3_exec()] or [sqlite3_step()] recursively does
  1235   1259   ** not create a new trigger context.
................................................................................
  1243   1267   ** that also occurred at the top level.  Within the body of a trigger,
  1244   1268   ** the sqlite3_changes() interface can be called to find the number of
  1245   1269   ** changes in the most recently completed INSERT, UPDATE, or DELETE
  1246   1270   ** statement within the body of the same trigger.
  1247   1271   ** However, the number returned does not include changes
  1248   1272   ** caused by subtriggers since those have their own context.
  1249   1273   **
  1250         -** SQLite implements the command "DELETE FROM table" without a WHERE clause
  1251         -** by dropping and recreating the table.  Doing so is much faster than going
  1252         -** through and deleting individual elements from the table.  Because of this
  1253         -** optimization, the deletions in "DELETE FROM table" are not row changes and
  1254         -** will not be counted by the sqlite3_changes() or [sqlite3_total_changes()]
  1255         -** functions, regardless of the number of elements that were originally
  1256         -** in the table.  To get an accurate count of the number of rows deleted, use
  1257         -** "DELETE FROM table WHERE 1" instead.  Or recompile using the
  1258         -** [SQLITE_OMIT_TRUNCATE_OPTIMIZATION] compile-time option to disable the
  1259         -** optimization on all queries.
         1274  +** See also the [sqlite3_total_changes()] interface and the
         1275  +** [count_changes pragma].
  1260   1276   **
  1261   1277   ** Requirements:
  1262   1278   ** [H12241] [H12243]
  1263   1279   **
  1264   1280   ** If a separate thread makes changes on the same database connection
  1265   1281   ** while [sqlite3_changes()] is running then the value returned
  1266   1282   ** is unpredictable and not meaningful.
  1267   1283   */
  1268   1284   int sqlite3_changes(sqlite3*);
  1269   1285   
  1270   1286   /*
  1271   1287   ** CAPI3REF: Total Number Of Rows Modified {H12260} <S10600>
  1272   1288   **
  1273         -** This function returns the number of row changes caused by INSERT,
  1274         -** UPDATE or DELETE statements since the [database connection] was opened.
  1275         -** The count includes all changes from all trigger contexts.  However,
  1276         -** the count does not include changes used to implement REPLACE constraints,
  1277         -** do rollbacks or ABORT processing, or DROP table processing.
         1289  +** This function returns the number of row changes caused by [INSERT],
         1290  +** [UPDATE] or [DELETE] statements since the [database connection] was opened.
         1291  +** The count includes all changes from all 
         1292  +** [CREATE TRIGGER | trigger] contexts.  However,
         1293  +** the count does not include changes used to implement [REPLACE] constraints,
         1294  +** do rollbacks or ABORT processing, or [DROP TABLE] processing.  The
         1295  +** count does not include rows of views that fire an [INSTEAD OF trigger],
         1296  +** though if the INSTEAD OF trigger makes changes of its own, those changes 
         1297  +** are counted.
  1278   1298   ** The changes are counted as soon as the statement that makes them is
  1279   1299   ** completed (when the statement handle is passed to [sqlite3_reset()] or
  1280   1300   ** [sqlite3_finalize()]).
  1281   1301   **
  1282         -** SQLite implements the command "DELETE FROM table" without a WHERE clause
  1283         -** by dropping and recreating the table.  (This is much faster than going
  1284         -** through and deleting individual elements from the table.)  Because of this
  1285         -** optimization, the deletions in "DELETE FROM table" are not row changes and
  1286         -** will not be counted by the sqlite3_changes() or [sqlite3_total_changes()]
  1287         -** functions, regardless of the number of elements that were originally
  1288         -** in the table.  To get an accurate count of the number of rows deleted, use
  1289         -** "DELETE FROM table WHERE 1" instead.   Or recompile using the
  1290         -** [SQLITE_OMIT_TRUNCATE_OPTIMIZATION] compile-time option to disable the
  1291         -** optimization on all queries.
  1292         -**
  1293         -** See also the [sqlite3_changes()] interface.
         1302  +** See also the [sqlite3_changes()] interface and the
         1303  +** [count_changes pragma].
  1294   1304   **
  1295   1305   ** Requirements:
  1296   1306   ** [H12261] [H12263]
  1297   1307   **
  1298   1308   ** If a separate thread makes changes on the same database connection
  1299   1309   ** while [sqlite3_total_changes()] is running then the value
  1300   1310   ** returned is unpredictable and not meaningful.
................................................................................
  1320   1330   ** to be interrupted and might continue to completion.
  1321   1331   **
  1322   1332   ** An SQL operation that is interrupted will return [SQLITE_INTERRUPT].
  1323   1333   ** If the interrupted SQL operation is an INSERT, UPDATE, or DELETE
  1324   1334   ** that is inside an explicit transaction, then the entire transaction
  1325   1335   ** will be rolled back automatically.
  1326   1336   **
  1327         -** A call to sqlite3_interrupt() has no effect on SQL statements
  1328         -** that are started after sqlite3_interrupt() returns.
         1337  +** The sqlite3_interrupt(D) call is in effect until all currently running
         1338  +** SQL statements on [database connection] D complete.  Any new SQL statements
         1339  +** that are started after the sqlite3_interrupt() call and before the 
         1340  +** running statements reaches zero are interrupted as if they had been
         1341  +** running prior to the sqlite3_interrupt() call.  New SQL statements
         1342  +** that are started after the running statement count reaches zero are
         1343  +** not effected by the sqlite3_interrupt().
         1344  +** A call to sqlite3_interrupt(D) that occurs when there are no running
         1345  +** SQL statements is a no-op and has no effect on SQL statements
         1346  +** that are started after the sqlite3_interrupt() call returns.
  1329   1347   **
  1330   1348   ** Requirements:
  1331   1349   ** [H12271] [H12272]
  1332   1350   **
  1333   1351   ** If the database connection closes while [sqlite3_interrupt()]
  1334   1352   ** is running then bad things will likely happen.
  1335   1353   */
  1336   1354   void sqlite3_interrupt(sqlite3*);
  1337   1355   
  1338   1356   /*
  1339   1357   ** CAPI3REF: Determine If An SQL Statement Is Complete {H10510} <S70200>
  1340   1358   **
  1341         -** These routines are useful for command-line input to determine if the
  1342         -** currently entered text seems to form complete a SQL statement or
         1359  +** These routines are useful during command-line input to determine if the
         1360  +** currently entered text seems to form a complete SQL statement or
  1343   1361   ** if additional input is needed before sending the text into
  1344         -** SQLite for parsing.  These routines return true if the input string
         1362  +** SQLite for parsing.  These routines return 1 if the input string
  1345   1363   ** appears to be a complete SQL statement.  A statement is judged to be
  1346         -** complete if it ends with a semicolon token and is not a fragment of a
  1347         -** CREATE TRIGGER statement.  Semicolons that are embedded within
         1364  +** complete if it ends with a semicolon token and is not a prefix of a
         1365  +** well-formed CREATE TRIGGER statement.  Semicolons that are embedded within
  1348   1366   ** string literals or quoted identifier names or comments are not
  1349   1367   ** independent tokens (they are part of the token in which they are
  1350         -** embedded) and thus do not count as a statement terminator.
         1368  +** embedded) and thus do not count as a statement terminator.  Whitespace
         1369  +** and comments that follow the final semicolon are ignored.
         1370  +**
         1371  +** These routines return 0 if the statement is incomplete.  If a
         1372  +** memory allocation fails, then SQLITE_NOMEM is returned.
  1351   1373   **
  1352   1374   ** These routines do not parse the SQL statements thus
  1353   1375   ** will not detect syntactically incorrect SQL.
         1376  +**
         1377  +** If SQLite has not been initialized using [sqlite3_initialize()] prior 
         1378  +** to invoking sqlite3_complete16() then sqlite3_initialize() is invoked
         1379  +** automatically by sqlite3_complete16().  If that initialization fails,
         1380  +** then the return value from sqlite3_complete16() will be non-zero
         1381  +** regardless of whether or not the input SQL is complete.
  1354   1382   **
  1355   1383   ** Requirements: [H10511] [H10512]
  1356   1384   **
  1357   1385   ** The input to [sqlite3_complete()] must be a zero-terminated
  1358   1386   ** UTF-8 string.
  1359   1387   **
  1360   1388   ** The input to [sqlite3_complete16()] must be a zero-terminated
................................................................................
  1775   1803   ** then the [sqlite3_prepare_v2()] or equivalent call that triggered
  1776   1804   ** the authorizer will fail with an error message.
  1777   1805   **
  1778   1806   ** When the callback returns [SQLITE_OK], that means the operation
  1779   1807   ** requested is ok.  When the callback returns [SQLITE_DENY], the
  1780   1808   ** [sqlite3_prepare_v2()] or equivalent call that triggered the
  1781   1809   ** authorizer will fail with an error message explaining that
  1782         -** access is denied.  If the authorizer code is [SQLITE_READ]
  1783         -** and the callback returns [SQLITE_IGNORE] then the
  1784         -** [prepared statement] statement is constructed to substitute
  1785         -** a NULL value in place of the table column that would have
  1786         -** been read if [SQLITE_OK] had been returned.  The [SQLITE_IGNORE]
  1787         -** return can be used to deny an untrusted user access to individual
  1788         -** columns of a table.
         1810  +** access is denied. 
  1789   1811   **
  1790   1812   ** The first parameter to the authorizer callback is a copy of the third
  1791   1813   ** parameter to the sqlite3_set_authorizer() interface. The second parameter
  1792   1814   ** to the callback is an integer [SQLITE_COPY | action code] that specifies
  1793   1815   ** the particular action to be authorized. The third through sixth parameters
  1794   1816   ** to the callback are zero-terminated strings that contain additional
  1795   1817   ** details about the action to be authorized.
  1796   1818   **
         1819  +** If the action code is [SQLITE_READ]
         1820  +** and the callback returns [SQLITE_IGNORE] then the
         1821  +** [prepared statement] statement is constructed to substitute
         1822  +** a NULL value in place of the table column that would have
         1823  +** been read if [SQLITE_OK] had been returned.  The [SQLITE_IGNORE]
         1824  +** return can be used to deny an untrusted user access to individual
         1825  +** columns of a table.
         1826  +** If the action code is [SQLITE_DELETE] and the callback returns
         1827  +** [SQLITE_IGNORE] then the [DELETE] operation proceeds but the
         1828  +** [truncate optimization] is disabled and all rows are deleted individually.
         1829  +**
  1797   1830   ** An authorizer is used when [sqlite3_prepare | preparing]
  1798   1831   ** SQL statements from an untrusted source, to ensure that the SQL statements
  1799   1832   ** do not try to access data they are not allowed to see, or that they do not
  1800   1833   ** try to execute malicious statements that damage the database.  For
  1801   1834   ** example, an application may allow a user to enter arbitrary
  1802   1835   ** SQL queries for evaluation by a database.  But the application does
  1803   1836   ** not want the user to be able to make arbitrary changes to the
................................................................................
  1823   1856   ** When [sqlite3_prepare_v2()] is used to prepare a statement, the
  1824   1857   ** statement might be reprepared during [sqlite3_step()] due to a 
  1825   1858   ** schema change.  Hence, the application should ensure that the
  1826   1859   ** correct authorizer callback remains in place during the [sqlite3_step()].
  1827   1860   **
  1828   1861   ** Note that the authorizer callback is invoked only during
  1829   1862   ** [sqlite3_prepare()] or its variants.  Authorization is not
  1830         -** performed during statement evaluation in [sqlite3_step()].
         1863  +** performed during statement evaluation in [sqlite3_step()], unless
         1864  +** as stated in the previous paragraph, sqlite3_step() invokes
         1865  +** sqlite3_prepare_v2() to reprepare a statement after a schema change.
  1831   1866   **
  1832   1867   ** Requirements:
  1833   1868   ** [H12501] [H12502] [H12503] [H12504] [H12505] [H12506] [H12507] [H12510]
  1834   1869   ** [H12511] [H12512] [H12520] [H12521] [H12522]
  1835   1870   */
  1836   1871   int sqlite3_set_authorizer(
  1837   1872     sqlite3*,
................................................................................
  3045   3080   ** redefined.  The length of the name is limited to 255 bytes, exclusive of
  3046   3081   ** the zero-terminator.  Note that the name length limit is in bytes, not
  3047   3082   ** characters.  Any attempt to create a function with a longer name
  3048   3083   ** will result in [SQLITE_ERROR] being returned.
  3049   3084   **
  3050   3085   ** The third parameter (nArg)
  3051   3086   ** is the number of arguments that the SQL function or
  3052         -** aggregate takes. If this parameter is negative, then the SQL function or
  3053         -** aggregate may take any number of arguments.
         3087  +** aggregate takes. If this parameter is -1, then the SQL function or
         3088  +** aggregate may take any number of arguments between 0 and the limit
         3089  +** set by [sqlite3_limit]([SQLITE_LIMIT_FUNCTION_ARG]).  If the third
         3090  +** parameter is less than -1 or greater than 127 then the behavior is
         3091  +** undefined.
  3054   3092   **
  3055   3093   ** The fourth parameter, eTextRep, specifies what
  3056   3094   ** [SQLITE_UTF8 | text encoding] this SQL function prefers for
  3057   3095   ** its parameters.  Any SQL function implementation should be able to work
  3058   3096   ** work with UTF-8, UTF-16le, or UTF-16be.  But some implementations may be
  3059   3097   ** more efficient with one encoding than another.  It is allowed to
  3060   3098   ** invoke sqlite3_create_function() or sqlite3_create_function16() multiple
................................................................................
  3097   3135   **
  3098   3136   ** An application-defined function is permitted to call other
  3099   3137   ** SQLite interfaces.  However, such calls must not
  3100   3138   ** close the database connection nor finalize or reset the prepared
  3101   3139   ** statement in which the function is running.
  3102   3140   **
  3103   3141   ** Requirements:
  3104         -** [H16103] [H16106] [H16109] [H16112] [H16118] [H16121] [H16124] [H16127]
         3142  +** [H16103] [H16106] [H16109] [H16112] [H16118] [H16121] [H16127]
  3105   3143   ** [H16130] [H16133] [H16136] [H16139] [H16142]
  3106   3144   */
  3107   3145   int sqlite3_create_function(
  3108   3146     sqlite3 *db,
  3109   3147     const char *zFunctionName,
  3110   3148     int nArg,
  3111   3149     int eTextRep,
................................................................................
  3479   3517   **
  3480   3518   ** The name of the new collation sequence is specified as a UTF-8 string
  3481   3519   ** for sqlite3_create_collation() and sqlite3_create_collation_v2()
  3482   3520   ** and a UTF-16 string for sqlite3_create_collation16(). In all cases
  3483   3521   ** the name is passed as the second function argument.
  3484   3522   **
  3485   3523   ** The third argument may be one of the constants [SQLITE_UTF8],
  3486         -** [SQLITE_UTF16LE] or [SQLITE_UTF16BE], indicating that the user-supplied
         3524  +** [SQLITE_UTF16LE], or [SQLITE_UTF16BE], indicating that the user-supplied
  3487   3525   ** routine expects to be passed pointers to strings encoded using UTF-8,
  3488   3526   ** UTF-16 little-endian, or UTF-16 big-endian, respectively. The
  3489         -** third argument might also be [SQLITE_UTF16_ALIGNED] to indicate that
         3527  +** third argument might also be [SQLITE_UTF16] to indicate that the routine
         3528  +** expects pointers to be UTF-16 strings in the native byte order, or the
         3529  +** argument can be [SQLITE_UTF16_ALIGNED] if the
  3490   3530   ** the routine expects pointers to 16-bit word aligned strings
  3491         -** of UTF-16 in the native byte order of the host computer.
         3531  +** of UTF-16 in the native byte order.
  3492   3532   **
  3493   3533   ** A pointer to the user supplied routine must be passed as the fifth
  3494   3534   ** argument.  If it is NULL, this is the same as deleting the collation
  3495   3535   ** sequence (so that SQLite cannot call it anymore).
  3496   3536   ** Each time the application supplied function is invoked, it is passed
  3497   3537   ** as its first parameter a copy of the void* passed as the fourth argument
  3498   3538   ** to sqlite3_create_collation() or sqlite3_create_collation16().
................................................................................
  3508   3548   ** except that it takes an extra argument which is a destructor for
  3509   3549   ** the collation.  The destructor is called when the collation is
  3510   3550   ** destroyed and is passed a copy of the fourth parameter void* pointer
  3511   3551   ** of the sqlite3_create_collation_v2().
  3512   3552   ** Collations are destroyed when they are overridden by later calls to the
  3513   3553   ** collation creation functions or when the [database connection] is closed
  3514   3554   ** using [sqlite3_close()].
         3555  +**
         3556  +** See also:  [sqlite3_collation_needed()] and [sqlite3_collation_needed16()].
  3515   3557   **
  3516   3558   ** Requirements:
  3517   3559   ** [H16603] [H16604] [H16606] [H16609] [H16612] [H16615] [H16618] [H16621]
  3518   3560   ** [H16624] [H16627] [H16630]
  3519   3561   */
  3520   3562   int sqlite3_create_collation(
  3521   3563     sqlite3*, 
................................................................................
  3708   3750   */
  3709   3751   sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt);
  3710   3752   
  3711   3753   /*
  3712   3754   ** CAPI3REF: Commit And Rollback Notification Callbacks {H12950} <S60400>
  3713   3755   **
  3714   3756   ** The sqlite3_commit_hook() interface registers a callback
  3715         -** function to be invoked whenever a transaction is committed.
         3757  +** function to be invoked whenever a transaction is [COMMIT | committed].
  3716   3758   ** Any callback set by a previous call to sqlite3_commit_hook()
  3717   3759   ** for the same database connection is overridden.
  3718   3760   ** The sqlite3_rollback_hook() interface registers a callback
  3719         -** function to be invoked whenever a transaction is committed.
         3761  +** function to be invoked whenever a transaction is [ROLLBACK | rolled back].
  3720   3762   ** Any callback set by a previous call to sqlite3_commit_hook()
  3721   3763   ** for the same database connection is overridden.
  3722   3764   ** The pArg argument is passed through to the callback.
  3723   3765   ** If the callback on a commit hook function returns non-zero,
  3724   3766   ** then the commit is converted into a rollback.
  3725   3767   **
  3726   3768   ** If another function was previously registered, its
................................................................................
  3732   3774   ** completion of the [sqlite3_step()] call that triggered the commit
  3733   3775   ** or rollback hook in the first place.
  3734   3776   ** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
  3735   3777   ** database connections for the meaning of "modify" in this paragraph.
  3736   3778   **
  3737   3779   ** Registering a NULL function disables the callback.
  3738   3780   **
         3781  +** When the commit hook callback routine returns zero, the [COMMIT]
         3782  +** operation is allowed to continue normally.  If the commit hook
         3783  +** returns non-zero, then the [COMMIT] is converted into a [ROLLBACK].
         3784  +** The rollback hook is invoked on a rollback that results from a commit
         3785  +** hook returning non-zero, just as it would be with any other rollback.
         3786  +**
  3739   3787   ** For the purposes of this API, a transaction is said to have been
  3740   3788   ** rolled back if an explicit "ROLLBACK" statement is executed, or
  3741   3789   ** an error or constraint causes an implicit rollback to occur.
  3742   3790   ** The rollback callback is not invoked if a transaction is
  3743   3791   ** automatically rolled back because the database connection is closed.
  3744   3792   ** The rollback callback is not invoked if a transaction is
  3745   3793   ** rolled back because a commit callback returned non-zero.
  3746   3794   ** <todo> Check on this </todo>
         3795  +**
         3796  +** See also the [sqlite3_update_hook()] interface.
  3747   3797   **
  3748   3798   ** Requirements:
  3749   3799   ** [H12951] [H12952] [H12953] [H12954] [H12955]
  3750   3800   ** [H12961] [H12962] [H12963] [H12964]
  3751   3801   */
  3752   3802   void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*);
  3753   3803   void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
................................................................................
  3771   3821   ** The third and fourth arguments to the callback contain pointers to the
  3772   3822   ** database and table name containing the affected row.
  3773   3823   ** The final callback parameter is the [rowid] of the row.
  3774   3824   ** In the case of an update, this is the [rowid] after the update takes place.
  3775   3825   **
  3776   3826   ** The update hook is not invoked when internal system tables are
  3777   3827   ** modified (i.e. sqlite_master and sqlite_sequence).
         3828  +**
         3829  +** In the current implementation, the update hook
         3830  +** is not invoked when duplication rows are deleted because of an
         3831  +** [ON CONFLICT | ON CONFLICT REPLACE] clause.  Nor is the update hook
         3832  +** invoked when rows are deleted using the [truncate optimization].
         3833  +** The exceptions defined in this paragraph might change in a future
         3834  +** release of SQLite.
  3778   3835   **
  3779   3836   ** The update hook implementation must not do anything that will modify
  3780   3837   ** the database connection that invoked the update hook.  Any actions
  3781   3838   ** to modify the database connection must be deferred until after the
  3782   3839   ** completion of the [sqlite3_step()] call that triggered the update hook.
  3783   3840   ** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
  3784   3841   ** database connections for the meaning of "modify" in this paragraph.
  3785   3842   **
  3786   3843   ** If another function was previously registered, its pArg value
  3787   3844   ** is returned.  Otherwise NULL is returned.
         3845  +**
         3846  +** See also the [sqlite3_commit_hook()] and [sqlite3_rollback_hook()]
         3847  +** interfaces.
  3788   3848   **
  3789   3849   ** Requirements:
  3790   3850   ** [H12971] [H12973] [H12975] [H12977] [H12979] [H12981] [H12983] [H12986]
  3791   3851   */
  3792   3852   void *sqlite3_update_hook(
  3793   3853     sqlite3*, 
  3794   3854     void(*)(void *,int ,char const *,char const *,sqlite3_int64),
................................................................................
  4062   4122   typedef struct sqlite3_vtab sqlite3_vtab;
  4063   4123   typedef struct sqlite3_index_info sqlite3_index_info;
  4064   4124   typedef struct sqlite3_vtab_cursor sqlite3_vtab_cursor;
  4065   4125   typedef struct sqlite3_module sqlite3_module;
  4066   4126   
  4067   4127   /*
  4068   4128   ** CAPI3REF: Virtual Table Object {H18000} <S20400>
  4069         -** KEYWORDS: sqlite3_module
         4129  +** KEYWORDS: sqlite3_module {virtual table module}
  4070   4130   ** EXPERIMENTAL
  4071   4131   **
  4072         -** A module is a class of virtual tables.  Each module is defined
  4073         -** by an instance of the following structure.  This structure consists
  4074         -** mostly of methods for the module.
         4132  +** This structure, sometimes called a a "virtual table module", 
         4133  +** defines the implementation of a [virtual tables].  
         4134  +** This structure consists mostly of methods for the module.
  4075   4135   **
  4076         -** This interface is experimental and is subject to change or
  4077         -** removal in future releases of SQLite.
         4136  +** A virtual table module is created by filling in a persistent
         4137  +** instance of this structure and passing a pointer to that instance
         4138  +** to [sqlite3_create_module()] or [sqlite3_create_module_v2()].
         4139  +** The registration remains valid until it is replaced by a different
         4140  +** module or until the [database connection] closes.  The content
         4141  +** of this structure must not change while it is registered with
         4142  +** any database connection.
  4078   4143   */
  4079   4144   struct sqlite3_module {
  4080   4145     int iVersion;
  4081   4146     int (*xCreate)(sqlite3*, void *pAux,
  4082   4147                  int argc, const char *const*argv,
  4083   4148                  sqlite3_vtab **ppVTab, char**);
  4084   4149     int (*xConnect)(sqlite3*, void *pAux,
................................................................................
  4108   4173   
  4109   4174   /*
  4110   4175   ** CAPI3REF: Virtual Table Indexing Information {H18100} <S20400>
  4111   4176   ** KEYWORDS: sqlite3_index_info
  4112   4177   ** EXPERIMENTAL
  4113   4178   **
  4114   4179   ** The sqlite3_index_info structure and its substructures is used to
  4115         -** pass information into and receive the reply from the xBestIndex
  4116         -** method of an sqlite3_module.  The fields under **Inputs** are the
         4180  +** pass information into and receive the reply from the [xBestIndex]
         4181  +** method of a [virtual table module].  The fields under **Inputs** are the
  4117   4182   ** inputs to xBestIndex and are read-only.  xBestIndex inserts its
  4118   4183   ** results into the **Outputs** fields.
  4119   4184   **
  4120   4185   ** The aConstraint[] array records WHERE clause constraints of the form:
  4121   4186   **
  4122   4187   ** <pre>column OP expr</pre>
  4123   4188   **
................................................................................
  4132   4197   ** get as many WHERE clause terms into the form shown above as possible.
  4133   4198   ** The aConstraint[] array only reports WHERE clause terms in the correct
  4134   4199   ** form that refer to the particular virtual table being queried.
  4135   4200   **
  4136   4201   ** Information about the ORDER BY clause is stored in aOrderBy[].
  4137   4202   ** Each term of aOrderBy records a column of the ORDER BY clause.
  4138   4203   **
  4139         -** The xBestIndex method must fill aConstraintUsage[] with information
         4204  +** The [xBestIndex] method must fill aConstraintUsage[] with information
  4140   4205   ** about what parameters to pass to xFilter.  If argvIndex>0 then
  4141   4206   ** the right-hand side of the corresponding aConstraint[] is evaluated
  4142   4207   ** and becomes the argvIndex-th entry in argv.  If aConstraintUsage[].omit
  4143   4208   ** is true, then the constraint is assumed to be fully handled by the
  4144   4209   ** virtual table and is not checked again by SQLite.
  4145   4210   **
  4146         -** The idxNum and idxPtr values are recorded and passed into xFilter.
  4147         -** sqlite3_free() is used to free idxPtr if needToFreeIdxPtr is true.
         4211  +** The idxNum and idxPtr values are recorded and passed into the
         4212  +** [xFilter] method.
         4213  +** [sqlite3_free()] is used to free idxPtr if and only iff
         4214  +** needToFreeIdxPtr is true.
  4148   4215   **
  4149         -** The orderByConsumed means that output from xFilter will occur in
         4216  +** The orderByConsumed means that output from [xFilter]/[xNext] will occur in
  4150   4217   ** the correct order to satisfy the ORDER BY clause so that no separate
  4151   4218   ** sorting step is required.
  4152   4219   **
  4153   4220   ** The estimatedCost value is an estimate of the cost of doing the
  4154   4221   ** particular lookup.  A full scan of a table with N entries should have
  4155   4222   ** a cost of N.  A binary search of a table of N entries should have a
  4156   4223   ** cost of approximately log(N).
  4157         -**
  4158         -** This interface is experimental and is subject to change or
  4159         -** removal in future releases of SQLite.
  4160   4224   */
  4161   4225   struct sqlite3_index_info {
  4162   4226     /* Inputs */
  4163   4227     int nConstraint;           /* Number of entries in aConstraint */
  4164   4228     struct sqlite3_index_constraint {
  4165   4229        int iColumn;              /* Column on left-hand side of constraint */
  4166   4230        unsigned char op;         /* Constraint operator */
................................................................................
  4190   4254   #define SQLITE_INDEX_CONSTRAINT_GE    32
  4191   4255   #define SQLITE_INDEX_CONSTRAINT_MATCH 64
  4192   4256   
  4193   4257   /*
  4194   4258   ** CAPI3REF: Register A Virtual Table Implementation {H18200} <S20400>
  4195   4259   ** EXPERIMENTAL
  4196   4260   **
  4197         -** This routine is used to register a new module name with a
  4198         -** [database connection].  Module names must be registered before
  4199         -** creating new virtual tables on the module, or before using
  4200         -** preexisting virtual tables of the module.
         4261  +** This routine is used to register a new [virtual table module] name.
         4262  +** Module names must be registered before
         4263  +** creating a new [virtual table] using the module, or before using a
         4264  +** preexisting [virtual table] for the module.
  4201   4265   **
  4202         -** This interface is experimental and is subject to change or
  4203         -** removal in future releases of SQLite.
         4266  +** The module name is registered on the [database connection] specified
         4267  +** by the first parameter.  The name of the module is given by the 
         4268  +** second parameter.  The third parameter is a pointer to
         4269  +** the implementation of the [virtual table module].   The fourth
         4270  +** parameter is an arbitrary client data pointer that is passed through
         4271  +** into the [xCreate] and [xConnect] methods of the virtual table module
         4272  +** when a new virtual table is be being created or reinitialized.
         4273  +**
         4274  +** This interface has exactly the same effect as calling
         4275  +** [sqlite3_create_module_v2()] with a NULL client data destructor.
  4204   4276   */
  4205   4277   SQLITE_EXPERIMENTAL int sqlite3_create_module(
  4206   4278     sqlite3 *db,               /* SQLite connection to register module with */
  4207   4279     const char *zName,         /* Name of the module */
  4208         -  const sqlite3_module *,    /* Methods for the module */
  4209         -  void *                     /* Client data for xCreate/xConnect */
         4280  +  const sqlite3_module *p,   /* Methods for the module */
         4281  +  void *pClientData          /* Client data for xCreate/xConnect */
  4210   4282   );
  4211   4283   
  4212   4284   /*
  4213   4285   ** CAPI3REF: Register A Virtual Table Implementation {H18210} <S20400>
  4214   4286   ** EXPERIMENTAL
  4215   4287   **
  4216         -** This routine is identical to the [sqlite3_create_module()] method above,
  4217         -** except that it allows a destructor function to be specified. It is
  4218         -** even more experimental than the rest of the virtual tables API.
         4288  +** This routine is identical to the [sqlite3_create_module()] method,
         4289  +** except that it has an extra parameter to specify 
         4290  +** a destructor function for the client data pointer.  SQLite will
         4291  +** invoke the destructor function (if it is not NULL) when SQLite
         4292  +** no longer needs the pClientData pointer.  
  4219   4293   */
  4220   4294   SQLITE_EXPERIMENTAL int sqlite3_create_module_v2(
  4221   4295     sqlite3 *db,               /* SQLite connection to register module with */
  4222   4296     const char *zName,         /* Name of the module */
  4223         -  const sqlite3_module *,    /* Methods for the module */
  4224         -  void *,                    /* Client data for xCreate/xConnect */
         4297  +  const sqlite3_module *p,   /* Methods for the module */
         4298  +  void *pClientData,         /* Client data for xCreate/xConnect */
  4225   4299     void(*xDestroy)(void*)     /* Module destructor function */
  4226   4300   );
  4227   4301   
  4228   4302   /*
  4229   4303   ** CAPI3REF: Virtual Table Instance Object {H18010} <S20400>
  4230   4304   ** KEYWORDS: sqlite3_vtab
  4231   4305   ** EXPERIMENTAL
  4232   4306   **
  4233         -** Every module implementation uses a subclass of the following structure
  4234         -** to describe a particular instance of the module.  Each subclass will
         4307  +** Every [virtual table module] implementation uses a subclass
         4308  +** of the following structure to describe a particular instance
         4309  +** of the [virtual table].  Each subclass will
  4235   4310   ** be tailored to the specific needs of the module implementation.
  4236   4311   ** The purpose of this superclass is to define certain fields that are
  4237   4312   ** common to all module implementations.
  4238   4313   **
  4239   4314   ** Virtual tables methods can set an error message by assigning a
  4240   4315   ** string obtained from [sqlite3_mprintf()] to zErrMsg.  The method should
  4241   4316   ** take care that any prior string is freed by a call to [sqlite3_free()]
  4242   4317   ** prior to assigning a new string to zErrMsg.  After the error message
  4243   4318   ** is delivered up to the client application, the string will be automatically
  4244         -** freed by sqlite3_free() and the zErrMsg field will be zeroed.  Note
  4245         -** that sqlite3_mprintf() and sqlite3_free() are used on the zErrMsg field
  4246         -** since virtual tables are commonly implemented in loadable extensions which
  4247         -** do not have access to sqlite3MPrintf() or sqlite3Free().
  4248         -**
  4249         -** This interface is experimental and is subject to change or
  4250         -** removal in future releases of SQLite.
         4319  +** freed by sqlite3_free() and the zErrMsg field will be zeroed.
  4251   4320   */
  4252   4321   struct sqlite3_vtab {
  4253   4322     const sqlite3_module *pModule;  /* The module for this virtual table */
  4254   4323     int nRef;                       /* Used internally */
  4255   4324     char *zErrMsg;                  /* Error message from sqlite3_mprintf() */
  4256   4325     /* Virtual table implementations will typically add additional fields */
  4257   4326   };
  4258   4327   
  4259   4328   /*
  4260   4329   ** CAPI3REF: Virtual Table Cursor Object  {H18020} <S20400>
  4261         -** KEYWORDS: sqlite3_vtab_cursor
         4330  +** KEYWORDS: sqlite3_vtab_cursor {virtual table cursor}
  4262   4331   ** EXPERIMENTAL
  4263   4332   **
  4264         -** Every module implementation uses a subclass of the following structure
  4265         -** to describe cursors that point into the virtual table and are used
         4333  +** Every [virtual table module] implementation uses a subclass of the
         4334  +** following structure to describe cursors that point into the
         4335  +** [virtual table] and are used
  4266   4336   ** to loop through the virtual table.  Cursors are created using the
  4267         -** xOpen method of the module.  Each module implementation will define
         4337  +** [sqlite3_module.xOpen | xOpen] method of the module and are destroyed
         4338  +** by the [sqlite3_module.xClose | xClose] method.  Cussors are used
         4339  +** by the [xFilter], [xNext], [xEof], [xColumn], and [xRowid] methods
         4340  +** of the module.  Each module implementation will define
  4268   4341   ** the content of a cursor structure to suit its own needs.
  4269   4342   **
  4270   4343   ** This superclass exists in order to define fields of the cursor that
  4271   4344   ** are common to all implementations.
  4272         -**
  4273         -** This interface is experimental and is subject to change or
  4274         -** removal in future releases of SQLite.
  4275   4345   */
  4276   4346   struct sqlite3_vtab_cursor {
  4277   4347     sqlite3_vtab *pVtab;      /* Virtual table of this cursor */
  4278   4348     /* Virtual table implementations will typically add additional fields */
  4279   4349   };
  4280   4350   
  4281   4351   /*
  4282   4352   ** CAPI3REF: Declare The Schema Of A Virtual Table {H18280} <S20400>
  4283   4353   ** EXPERIMENTAL
  4284   4354   **
  4285         -** The xCreate and xConnect methods of a module use the following API
         4355  +** The [xCreate] and [xConnect] methods of a
         4356  +** [virtual table module] call this interface
  4286   4357   ** to declare the format (the names and datatypes of the columns) of
  4287   4358   ** the virtual tables they implement.
  4288         -**
  4289         -** This interface is experimental and is subject to change or
  4290         -** removal in future releases of SQLite.
  4291   4359   */
  4292         -SQLITE_EXPERIMENTAL int sqlite3_declare_vtab(sqlite3*, const char *zCreateTable);
         4360  +SQLITE_EXPERIMENTAL int sqlite3_declare_vtab(sqlite3*, const char *zSQL);
  4293   4361   
  4294   4362   /*
  4295   4363   ** CAPI3REF: Overload A Function For A Virtual Table {H18300} <S20400>
  4296   4364   ** EXPERIMENTAL
  4297   4365   **
  4298   4366   ** Virtual tables can provide alternative implementations of functions
  4299         -** using the xFindFunction method.  But global versions of those functions
         4367  +** using the [xFindFunction] method of the [virtual table module].  
         4368  +** But global versions of those functions
  4300   4369   ** must exist in order to be overloaded.
  4301   4370   **
  4302   4371   ** This API makes sure a global version of a function with a particular
  4303   4372   ** name and number of parameters exists.  If no such function exists
  4304   4373   ** before this API is called, a new function is created.  The implementation
  4305   4374   ** of the new function always causes an exception to be thrown.  So
  4306   4375   ** the new function is not good for anything by itself.  Its only
  4307   4376   ** purpose is to be a placeholder function that can be overloaded
  4308         -** by virtual tables.
  4309         -**
  4310         -** This API should be considered part of the virtual table interface,
  4311         -** which is experimental and subject to change.
         4377  +** by a [virtual table].
  4312   4378   */
  4313   4379   SQLITE_EXPERIMENTAL int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg);
  4314   4380   
  4315   4381   /*
  4316   4382   ** The interface to the virtual-table mechanism defined above (back up
  4317   4383   ** to a comment remarkably similar to this one) is currently considered
  4318   4384   ** to be experimental.  The interface might change in incompatible ways.
................................................................................
  4345   4411   ** in row iRow, column zColumn, table zTable in database zDb;
  4346   4412   ** in other words, the same BLOB that would be selected by:
  4347   4413   **
  4348   4414   ** <pre>
  4349   4415   **     SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;
  4350   4416   ** </pre> {END}
  4351   4417   **
  4352         -** If the flags parameter is non-zero, the the BLOB is opened for read
         4418  +** If the flags parameter is non-zero, then the BLOB is opened for read
  4353   4419   ** and write access. If it is zero, the BLOB is opened for read access.
  4354   4420   **
  4355   4421   ** Note that the database name is not the filename that contains
  4356   4422   ** the database but rather the symbolic name of the database that
  4357   4423   ** is assigned when the database is connected using [ATTACH].
  4358   4424   ** For the main database file, the database name is "main".
  4359   4425   ** For TEMP tables, the database name is "temp".
  4360   4426   **
  4361   4427   ** On success, [SQLITE_OK] is returned and the new [BLOB handle] is written
  4362         -** to *ppBlob. Otherwise an [error code] is returned and any value written
  4363         -** to *ppBlob should not be used by the caller.
         4428  +** to *ppBlob. Otherwise an [error code] is returned and *ppBlob is set
         4429  +** to be a null pointer.
  4364   4430   ** This function sets the [database connection] error code and message
  4365         -** accessible via [sqlite3_errcode()] and [sqlite3_errmsg()].
         4431  +** accessible via [sqlite3_errcode()] and [sqlite3_errmsg()] and related
         4432  +** functions.  Note that the *ppBlob variable is always initialized in a
         4433  +** way that makes it safe to invoke [sqlite3_blob_close()] on *ppBlob
         4434  +** regardless of the success or failure of this routine.
  4366   4435   **
  4367   4436   ** If the row that a BLOB handle points to is modified by an
  4368   4437   ** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects
  4369   4438   ** then the BLOB handle is marked as "expired".
  4370   4439   ** This is true if any column of the row is changed, even a column
  4371   4440   ** other than the one the BLOB handle is open on.
  4372   4441   ** Calls to [sqlite3_blob_read()] and [sqlite3_blob_write()] for
  4373   4442   ** a expired BLOB handle fail with an return code of [SQLITE_ABORT].
  4374   4443   ** Changes written into a BLOB prior to the BLOB expiring are not
  4375   4444   ** rollback by the expiration of the BLOB.  Such changes will eventually
  4376   4445   ** commit if the transaction continues to completion.
         4446  +**
         4447  +** Use the [sqlite3_blob_bytes()] interface to determine the size of
         4448  +** the opened blob.  The size of a blob may not be changed by this
         4449  +** underface.  Use the [UPDATE] SQL command to change the size of a
         4450  +** blob.
         4451  +**
         4452  +** The [sqlite3_bind_zeroblob()] and [sqlite3_result_zeroblob()] interfaces
         4453  +** and the built-in [zeroblob] SQL function can be used, if desired,
         4454  +** to create an empty, zero-filled blob in which to read or write using
         4455  +** this interface.
         4456  +**
         4457  +** To avoid a resource leak, every open [BLOB handle] should eventually
         4458  +** be released by a call to [sqlite3_blob_close()].
  4377   4459   **
  4378   4460   ** Requirements:
  4379   4461   ** [H17813] [H17814] [H17816] [H17819] [H17821] [H17824]
  4380   4462   */
  4381   4463   int sqlite3_blob_open(
  4382   4464     sqlite3*,
  4383   4465     const char *zDb,
................................................................................
  4393   4475   **
  4394   4476   ** Closes an open [BLOB handle].
  4395   4477   **
  4396   4478   ** Closing a BLOB shall cause the current transaction to commit
  4397   4479   ** if there are no other BLOBs, no pending prepared statements, and the
  4398   4480   ** database connection is in [autocommit mode].
  4399   4481   ** If any writes were made to the BLOB, they might be held in cache
  4400         -** until the close operation if they will fit. {END}
         4482  +** until the close operation if they will fit.
  4401   4483   **
  4402   4484   ** Closing the BLOB often forces the changes
  4403   4485   ** out to disk and so if any I/O errors occur, they will likely occur
  4404         -** at the time when the BLOB is closed.  {H17833} Any errors that occur during
         4486  +** at the time when the BLOB is closed.  Any errors that occur during
  4405   4487   ** closing are reported as a non-zero return value.
  4406   4488   **
  4407   4489   ** The BLOB is closed unconditionally.  Even if this routine returns
  4408   4490   ** an error code, the BLOB is still closed.
         4491  +**
         4492  +** Calling this routine with a null pointer (which as would be returned
         4493  +** by failed call to [sqlite3_blob_open()]) is a harmless no-op.
  4409   4494   **
  4410   4495   ** Requirements:
  4411   4496   ** [H17833] [H17836] [H17839]
  4412   4497   */
  4413   4498   int sqlite3_blob_close(sqlite3_blob *);
  4414   4499   
  4415   4500   /*
  4416   4501   ** CAPI3REF: Return The Size Of An Open BLOB {H17840} <S30230>
  4417   4502   **
  4418         -** Returns the size in bytes of the BLOB accessible via the open
  4419         -** []BLOB handle] in its only argument.
         4503  +** Returns the size in bytes of the BLOB accessible via the 
         4504  +** successfully opened [BLOB handle] in its only argument.  The
         4505  +** incremental blob I/O routines can only read or overwriting existing
         4506  +** blob content; they cannot change the size of a blob.
         4507  +**
         4508  +** This routine only works on a [BLOB handle] which has been created
         4509  +** by a prior successful call to [sqlite3_blob_open()] and which has not
         4510  +** been closed by [sqlite3_blob_close()].  Passing any other pointer in
         4511  +** to this routine results in undefined and probably undesirable behavior.
  4420   4512   **
  4421   4513   ** Requirements:
  4422   4514   ** [H17843]
  4423   4515   */
  4424   4516   int sqlite3_blob_bytes(sqlite3_blob *);
  4425   4517   
  4426   4518   /*
................................................................................
  4429   4521   ** This function is used to read data from an open [BLOB handle] into a
  4430   4522   ** caller-supplied buffer. N bytes of data are copied into buffer Z
  4431   4523   ** from the open BLOB, starting at offset iOffset.
  4432   4524   **
  4433   4525   ** If offset iOffset is less than N bytes from the end of the BLOB,
  4434   4526   ** [SQLITE_ERROR] is returned and no data is read.  If N or iOffset is
  4435   4527   ** less than zero, [SQLITE_ERROR] is returned and no data is read.
         4528  +** The size of the blob (and hence the maximum value of N+iOffset)
         4529  +** can be determined using the [sqlite3_blob_bytes()] interface.
  4436   4530   **
  4437   4531   ** An attempt to read from an expired [BLOB handle] fails with an
  4438   4532   ** error code of [SQLITE_ABORT].
  4439   4533   **
  4440   4534   ** On success, SQLITE_OK is returned.
  4441   4535   ** Otherwise, an [error code] or an [extended error code] is returned.
         4536  +**
         4537  +** This routine only works on a [BLOB handle] which has been created
         4538  +** by a prior successful call to [sqlite3_blob_open()] and which has not
         4539  +** been closed by [sqlite3_blob_close()].  Passing any other pointer in
         4540  +** to this routine results in undefined and probably undesirable behavior.
         4541  +**
         4542  +** See also: [sqlite3_blob_write()].
  4442   4543   **
  4443   4544   ** Requirements:
  4444   4545   ** [H17853] [H17856] [H17859] [H17862] [H17863] [H17865] [H17868]
  4445   4546   */
  4446   4547   int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
  4447   4548   
  4448   4549   /*
................................................................................
  4457   4558   ** this function returns [SQLITE_READONLY].
  4458   4559   **
  4459   4560   ** This function may only modify the contents of the BLOB; it is
  4460   4561   ** not possible to increase the size of a BLOB using this API.
  4461   4562   ** If offset iOffset is less than N bytes from the end of the BLOB,
  4462   4563   ** [SQLITE_ERROR] is returned and no data is written.  If N is
  4463   4564   ** less than zero [SQLITE_ERROR] is returned and no data is written.
         4565  +** The size of the BLOB (and hence the maximum value of N+iOffset)
         4566  +** can be determined using the [sqlite3_blob_bytes()] interface.
  4464   4567   **
  4465   4568   ** An attempt to write to an expired [BLOB handle] fails with an
  4466   4569   ** error code of [SQLITE_ABORT].  Writes to the BLOB that occurred
  4467   4570   ** before the [BLOB handle] expired are not rolled back by the
  4468   4571   ** expiration of the handle, though of course those changes might
  4469   4572   ** have been overwritten by the statement that expired the BLOB handle
  4470   4573   ** or by other independent statements.
  4471   4574   **
  4472   4575   ** On success, SQLITE_OK is returned.
  4473   4576   ** Otherwise, an  [error code] or an [extended error code] is returned.
         4577  +**
         4578  +** This routine only works on a [BLOB handle] which has been created
         4579  +** by a prior successful call to [sqlite3_blob_open()] and which has not
         4580  +** been closed by [sqlite3_blob_close()].  Passing any other pointer in
         4581  +** to this routine results in undefined and probably undesirable behavior.
         4582  +**
         4583  +** See also: [sqlite3_blob_read()].
  4474   4584   **
  4475   4585   ** Requirements:
  4476   4586   ** [H17873] [H17874] [H17875] [H17876] [H17877] [H17879] [H17882] [H17885]
  4477   4587   ** [H17888]
  4478   4588   */
  4479   4589   int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset);
  4480   4590   
................................................................................
  4818   4928   #define SQLITE_TESTCTRL_PRNG_SAVE                5
  4819   4929   #define SQLITE_TESTCTRL_PRNG_RESTORE             6
  4820   4930   #define SQLITE_TESTCTRL_PRNG_RESET               7
  4821   4931   #define SQLITE_TESTCTRL_BITVEC_TEST              8
  4822   4932   #define SQLITE_TESTCTRL_FAULT_INSTALL            9
  4823   4933   #define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS     10
  4824   4934   #define SQLITE_TESTCTRL_PENDING_BYTE            11
         4935  +#define SQLITE_TESTCTRL_ASSERT                  12
         4936  +#define SQLITE_TESTCTRL_ALWAYS                  13
  4825   4937   
  4826   4938   /*
  4827   4939   ** CAPI3REF: SQLite Runtime Status {H17200} <S60200>
  4828   4940   ** EXPERIMENTAL
  4829   4941   **
  4830   4942   ** This interface is used to retrieve runtime status information
  4831   4943   ** about the preformance of SQLite, and optionally to reset various

Changes to SQLite.Interop/src/sqlite3ext.h.

    11     11   *************************************************************************
    12     12   ** This header file defines the SQLite interface for use by
    13     13   ** shared libraries that want to be imported as extensions into
    14     14   ** an SQLite instance.  Shared libraries that intend to be loaded
    15     15   ** as extensions by SQLite should #include this file instead of 
    16     16   ** sqlite3.h.
    17     17   **
    18         -** @(#) $Id: sqlite3ext.h,v 1.16 2009/04/28 16:17:45 rmsimpson Exp $
           18  +** @(#) $Id: sqlite3ext.h,v 1.17 2009/06/19 21:04:12 rmsimpson Exp $
    19     19   */
    20     20   #ifndef _SQLITE3EXT_H_
    21     21   #define _SQLITE3EXT_H_
    22     22   #include "sqlite3.h"
    23     23   
    24     24   typedef struct sqlite3_api_routines sqlite3_api_routines;
    25     25   

Changes to System.Data.SQLite/AssemblyInfo.cs.

    43     43   //      Major Version
    44     44   //      Minor Version 
    45     45   //      Build Number
    46     46   //      Revision
    47     47   //
    48     48   // You can specify all the values or you can default the Revision and Build Numbers 
    49     49   // by using the '*' as shown below:
    50         -[assembly: AssemblyVersion("1.0.61.0")]
           50  +[assembly: AssemblyVersion("1.0.62.0")]
    51     51   #if !PLATFORM_COMPACTFRAMEWORK
    52         -[assembly: AssemblyFileVersion("1.0.61.0")]
           52  +[assembly: AssemblyFileVersion("1.0.62.0")]
    53     53   #endif

Changes to System.Data.SQLite/SQLite3.cs.

   170    170               if ((uint)Environment.TickCount - starttick > timeout)
   171    171               {
   172    172                 throw new SQLiteException(r, SQLiteLastError());
   173    173               }
   174    174               else
   175    175               {
   176    176                 // Otherwise sleep for a random amount of time up to 150ms
   177         -              System.Threading.Thread.CurrentThread.Join(rnd.Next(1, 150));
          177  +              System.Threading.Thread.Sleep(rnd.Next(1, 150));
   178    178               }
   179    179             }
   180    180           }
   181    181         }
   182    182       }
   183    183   
   184    184       internal override int Reset(SQLiteStatement stmt)
................................................................................
   311    311               if ((uint)Environment.TickCount - starttick > timeoutMS)
   312    312               {
   313    313                 throw new SQLiteException(n, SQLiteLastError());
   314    314               }
   315    315               else
   316    316               {
   317    317                 // Otherwise sleep for a random amount of time up to 150ms
   318         -              System.Threading.Thread.CurrentThread.Join(rnd.Next(1, 150));
          318  +              System.Threading.Thread.Sleep(rnd.Next(1, 150));
   319    319               }
   320    320             }
   321    321           }
   322    322   
   323    323           if (n > 0) throw new SQLiteException(n, SQLiteLastError());
   324    324   
   325    325           strRemain = UTF8ToString(ptr, len);
................................................................................
   590    590   
   591    591         if (bDest == null) return nlen;
   592    592   
   593    593         if (nCopied + nStart > bDest.Length) nCopied = bDest.Length - nStart;
   594    594         if (nCopied + nDataOffset > nlen) nCopied = nlen - nDataOffset;
   595    595   
   596    596         if (nCopied > 0)
   597         -        Marshal.Copy((IntPtr)(ptr.ToInt32() + nDataOffset), bDest, nStart, nCopied);
          597  +        Marshal.Copy((IntPtr)(ptr.ToInt64() + nDataOffset), bDest, nStart, nCopied);
   598    598         else nCopied = 0;
   599    599   
   600    600         return nCopied;
   601    601       }
   602    602   
   603    603       internal override long GetChars(SQLiteStatement stmt, int index, int nDataOffset, char[] bDest, int nStart, int nLength)
   604    604       {

Changes to System.Data.SQLite/SQLiteDataReader.cs.

   398    398       /// <returns>decimal</returns>
   399    399       public override decimal GetDecimal(int i)
   400    400       {
   401    401         if (i >= VisibleFieldCount && _keyInfo != null)
   402    402           return _keyInfo.GetDecimal(i - VisibleFieldCount);
   403    403   
   404    404         VerifyType(i, DbType.Decimal);
   405         -      return Decimal.Parse(_activeStatement._sql.GetText(_activeStatement, i), NumberStyles.AllowDecimalPoint | NumberStyles.AllowExponent, CultureInfo.InvariantCulture);
          405  +      return Decimal.Parse(_activeStatement._sql.GetText(_activeStatement, i), NumberStyles.AllowDecimalPoint | NumberStyles.AllowExponent | NumberStyles.AllowLeadingSign, CultureInfo.InvariantCulture);
   406    406       }
   407    407   
   408    408       /// <summary>
   409    409       /// Returns the column as a double
   410    410       /// </summary>
   411    411       /// <param name="i">The index of the column to retrieve</param>
   412    412       /// <returns>double</returns>

Changes to System.Data.SQLite/UnsafeNativeMethods.cs.

    19     19   #if !SQLITE_STANDARD
    20     20   
    21     21   #if !USE_INTEROP_DLL
    22     22   
    23     23   #if !PLATFORM_COMPACTFRAMEWORK
    24     24       private const string SQLITE_DLL = "System.Data.SQLite.DLL";
    25     25   #else
    26         -    internal const string SQLITE_DLL = "SQLite.Interop.061.DLL";
           26  +    internal const string SQLITE_DLL = "SQLite.Interop.062.DLL";
    27     27   #endif // PLATFORM_COMPACTFRAMEWORK
    28     28   
    29     29   #else
    30     30       private const string SQLITE_DLL = "SQLite.Interop.DLL";
    31     31   #endif // USE_INTEROP_DLL
    32     32   
    33     33   #else