amalgalite 1.4.0-x86-mingw32 → 1.4.1-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,7 +23,7 @@
23
23
  **
24
24
  ** The official C-language API documentation for SQLite is derived
25
25
  ** from comments in this file. This file is the authoritative source
26
- ** on how SQLite interfaces are suppose to operate.
26
+ ** on how SQLite interfaces are supposed 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
@@ -43,21 +43,25 @@ extern "C" {
43
43
 
44
44
 
45
45
  /*
46
- ** Add the ability to override 'extern'
46
+ ** Provide the ability to override linkage features of the interface.
47
47
  */
48
48
  #ifndef SQLITE_EXTERN
49
49
  # define SQLITE_EXTERN extern
50
50
  #endif
51
-
52
51
  #ifndef SQLITE_API
53
52
  # define SQLITE_API
54
53
  #endif
55
-
54
+ #ifndef SQLITE_CDECL
55
+ # define SQLITE_CDECL
56
+ #endif
57
+ #ifndef SQLITE_STDCALL
58
+ # define SQLITE_STDCALL
59
+ #endif
56
60
 
57
61
  /*
58
62
  ** These no-op macros are used in front of interfaces to mark those
59
63
  ** interfaces as either deprecated or experimental. New applications
60
- ** should not use deprecated interfaces - they are support for backwards
64
+ ** should not use deprecated interfaces - they are supported for backwards
61
65
  ** compatibility only. Application writers should be aware that
62
66
  ** experimental interfaces are subject to change in point releases.
63
67
  **
@@ -107,9 +111,9 @@ extern "C" {
107
111
  ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108
112
  ** [sqlite_version()] and [sqlite_source_id()].
109
113
  */
110
- #define SQLITE_VERSION "3.8.7.4"
111
- #define SQLITE_VERSION_NUMBER 3008007
112
- #define SQLITE_SOURCE_ID "2014-12-09 01:34:36 f66f7a17b78ba617acde90fc810107f34f1a1f2e"
114
+ #define SQLITE_VERSION "3.8.11.1"
115
+ #define SQLITE_VERSION_NUMBER 3008011
116
+ #define SQLITE_SOURCE_ID "2015-07-29 20:00:57 cf538e2783e468bbc25e7cb2a9ee64d3e0e80b2f"
113
117
 
114
118
  /*
115
119
  ** CAPI3REF: Run-Time Library Version Numbers
@@ -142,9 +146,9 @@ extern "C" {
142
146
  ** See also: [sqlite_version()] and [sqlite_source_id()].
143
147
  */
144
148
  SQLITE_API SQLITE_EXTERN const char sqlite3_version[];
145
- SQLITE_API const char *sqlite3_libversion(void);
146
- SQLITE_API const char *sqlite3_sourceid(void);
147
- SQLITE_API int sqlite3_libversion_number(void);
149
+ SQLITE_API const char *SQLITE_STDCALL sqlite3_libversion(void);
150
+ SQLITE_API const char *SQLITE_STDCALL sqlite3_sourceid(void);
151
+ SQLITE_API int SQLITE_STDCALL sqlite3_libversion_number(void);
148
152
 
149
153
  /*
150
154
  ** CAPI3REF: Run-Time Library Compilation Options Diagnostics
@@ -169,8 +173,8 @@ SQLITE_API int sqlite3_libversion_number(void);
169
173
  ** [sqlite_compileoption_get()] and the [compile_options pragma].
170
174
  */
171
175
  #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
172
- SQLITE_API int sqlite3_compileoption_used(const char *zOptName);
173
- SQLITE_API const char *sqlite3_compileoption_get(int N);
176
+ SQLITE_API int SQLITE_STDCALL sqlite3_compileoption_used(const char *zOptName);
177
+ SQLITE_API const char *SQLITE_STDCALL sqlite3_compileoption_get(int N);
174
178
  #endif
175
179
 
176
180
  /*
@@ -201,7 +205,7 @@ SQLITE_API const char *sqlite3_compileoption_get(int N);
201
205
  ** SQLITE_THREADSAFE=1 or =2 then mutexes are enabled by default but
202
206
  ** can be fully or partially disabled using a call to [sqlite3_config()]
203
207
  ** with the verbs [SQLITE_CONFIG_SINGLETHREAD], [SQLITE_CONFIG_MULTITHREAD],
204
- ** or [SQLITE_CONFIG_MUTEX]. ^(The return value of the
208
+ ** or [SQLITE_CONFIG_SERIALIZED]. ^(The return value of the
205
209
  ** sqlite3_threadsafe() function shows only the compile-time setting of
206
210
  ** thread safety, not any run-time changes to that setting made by
207
211
  ** sqlite3_config(). In other words, the return value from sqlite3_threadsafe()
@@ -209,7 +213,7 @@ SQLITE_API const char *sqlite3_compileoption_get(int N);
209
213
  **
210
214
  ** See the [threading mode] documentation for additional information.
211
215
  */
212
- SQLITE_API int sqlite3_threadsafe(void);
216
+ SQLITE_API int SQLITE_STDCALL sqlite3_threadsafe(void);
213
217
 
214
218
  /*
215
219
  ** CAPI3REF: Database Connection Handle
@@ -266,6 +270,7 @@ typedef sqlite_uint64 sqlite3_uint64;
266
270
 
267
271
  /*
268
272
  ** CAPI3REF: Closing A Database Connection
273
+ ** DESTRUCTOR: sqlite3
269
274
  **
270
275
  ** ^The sqlite3_close() and sqlite3_close_v2() routines are destructors
271
276
  ** for the [sqlite3] object.
@@ -305,8 +310,8 @@ typedef sqlite_uint64 sqlite3_uint64;
305
310
  ** ^Calling sqlite3_close() or sqlite3_close_v2() with a NULL pointer
306
311
  ** argument is a harmless no-op.
307
312
  */
308
- SQLITE_API int sqlite3_close(sqlite3*);
309
- SQLITE_API int sqlite3_close_v2(sqlite3*);
313
+ SQLITE_API int SQLITE_STDCALL sqlite3_close(sqlite3*);
314
+ SQLITE_API int SQLITE_STDCALL sqlite3_close_v2(sqlite3*);
310
315
 
311
316
  /*
312
317
  ** The type for a callback function.
@@ -317,6 +322,7 @@ typedef int (*sqlite3_callback)(void*,int,char**, char**);
317
322
 
318
323
  /*
319
324
  ** CAPI3REF: One-Step Query Execution Interface
325
+ ** METHOD: sqlite3
320
326
  **
321
327
  ** The sqlite3_exec() interface is a convenience wrapper around
322
328
  ** [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()],
@@ -376,7 +382,7 @@ typedef int (*sqlite3_callback)(void*,int,char**, char**);
376
382
  ** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running.
377
383
  ** </ul>
378
384
  */
379
- SQLITE_API int sqlite3_exec(
385
+ SQLITE_API int SQLITE_STDCALL sqlite3_exec(
380
386
  sqlite3*, /* An open database */
381
387
  const char *sql, /* SQL to be evaluated */
382
388
  int (*callback)(void*,int,char**,char**), /* Callback function */
@@ -756,14 +762,16 @@ struct sqlite3_io_methods {
756
762
  ** of the [sqlite3_io_methods] object and for the [sqlite3_file_control()]
757
763
  ** interface.
758
764
  **
765
+ ** <ul>
766
+ ** <li>[[SQLITE_FCNTL_LOCKSTATE]]
759
767
  ** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging. This
760
768
  ** opcode causes the xFileControl method to write the current state of
761
769
  ** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED],
762
770
  ** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE])
763
771
  ** into an integer that the pArg argument points to. This capability
764
- ** is used during testing and only needs to be supported when SQLITE_TEST
765
- ** is defined.
766
- ** <ul>
772
+ ** is used during testing and is only available when the SQLITE_TEST
773
+ ** compile-time option is used.
774
+ **
767
775
  ** <li>[[SQLITE_FCNTL_SIZE_HINT]]
768
776
  ** The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS
769
777
  ** layer a hint of how large the database file will grow to be during the
@@ -888,7 +896,9 @@ struct sqlite3_io_methods {
888
896
  ** [PRAGMA] processing continues. ^If the [SQLITE_FCNTL_PRAGMA]
889
897
  ** file control returns [SQLITE_OK], then the parser assumes that the
890
898
  ** VFS has handled the PRAGMA itself and the parser generates a no-op
891
- ** prepared statement. ^If the [SQLITE_FCNTL_PRAGMA] file control returns
899
+ ** prepared statement if result string is NULL, or that returns a copy
900
+ ** of the result string if the string is non-NULL.
901
+ ** ^If the [SQLITE_FCNTL_PRAGMA] file control returns
892
902
  ** any result code other than [SQLITE_OK] or [SQLITE_NOTFOUND], that means
893
903
  ** that the VFS encountered an error while handling the [PRAGMA] and the
894
904
  ** compilation of the PRAGMA fails with an error. ^The [SQLITE_FCNTL_PRAGMA]
@@ -946,12 +956,27 @@ struct sqlite3_io_methods {
946
956
  ** pointed to by the pArg argument. This capability is used during testing
947
957
  ** and only needs to be supported when SQLITE_TEST is defined.
948
958
  **
959
+ ** <li>[[SQLITE_FCNTL_WAL_BLOCK]]
960
+ ** The [SQLITE_FCNTL_WAL_BLOCK] is a signal to the VFS layer that it might
961
+ ** be advantageous to block on the next WAL lock if the lock is not immediately
962
+ ** available. The WAL subsystem issues this signal during rare
963
+ ** circumstances in order to fix a problem with priority inversion.
964
+ ** Applications should <em>not</em> use this file-control.
965
+ **
966
+ ** <li>[[SQLITE_FCNTL_ZIPVFS]]
967
+ ** The [SQLITE_FCNTL_ZIPVFS] opcode is implemented by zipvfs only. All other
968
+ ** VFS should return SQLITE_NOTFOUND for this opcode.
969
+ **
970
+ ** <li>[[SQLITE_FCNTL_RBU]]
971
+ ** The [SQLITE_FCNTL_RBU] opcode is implemented by the special VFS used by
972
+ ** the RBU extension only. All other VFS should return SQLITE_NOTFOUND for
973
+ ** this opcode.
949
974
  ** </ul>
950
975
  */
951
976
  #define SQLITE_FCNTL_LOCKSTATE 1
952
- #define SQLITE_GET_LOCKPROXYFILE 2
953
- #define SQLITE_SET_LOCKPROXYFILE 3
954
- #define SQLITE_LAST_ERRNO 4
977
+ #define SQLITE_FCNTL_GET_LOCKPROXYFILE 2
978
+ #define SQLITE_FCNTL_SET_LOCKPROXYFILE 3
979
+ #define SQLITE_FCNTL_LAST_ERRNO 4
955
980
  #define SQLITE_FCNTL_SIZE_HINT 5
956
981
  #define SQLITE_FCNTL_CHUNK_SIZE 6
957
982
  #define SQLITE_FCNTL_FILE_POINTER 7
@@ -970,6 +995,15 @@ struct sqlite3_io_methods {
970
995
  #define SQLITE_FCNTL_SYNC 21
971
996
  #define SQLITE_FCNTL_COMMIT_PHASETWO 22
972
997
  #define SQLITE_FCNTL_WIN32_SET_HANDLE 23
998
+ #define SQLITE_FCNTL_WAL_BLOCK 24
999
+ #define SQLITE_FCNTL_ZIPVFS 25
1000
+ #define SQLITE_FCNTL_RBU 26
1001
+
1002
+ /* deprecated names */
1003
+ #define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
1004
+ #define SQLITE_SET_LOCKPROXYFILE SQLITE_FCNTL_SET_LOCKPROXYFILE
1005
+ #define SQLITE_LAST_ERRNO SQLITE_FCNTL_LAST_ERRNO
1006
+
973
1007
 
974
1008
  /*
975
1009
  ** CAPI3REF: Mutex Handle
@@ -1221,7 +1255,7 @@ struct sqlite3_vfs {
1221
1255
  ** </ul>
1222
1256
  **
1223
1257
  ** When unlocking, the same SHARED or EXCLUSIVE flag must be supplied as
1224
- ** was given no the corresponding lock.
1258
+ ** was given on the corresponding lock.
1225
1259
  **
1226
1260
  ** The xShmLock method can transition between unlocked and SHARED or
1227
1261
  ** between unlocked and EXCLUSIVE. It cannot transition between SHARED
@@ -1318,10 +1352,10 @@ struct sqlite3_vfs {
1318
1352
  ** must return [SQLITE_OK] on success and some other [error code] upon
1319
1353
  ** failure.
1320
1354
  */
1321
- SQLITE_API int sqlite3_initialize(void);
1322
- SQLITE_API int sqlite3_shutdown(void);
1323
- SQLITE_API int sqlite3_os_init(void);
1324
- SQLITE_API int sqlite3_os_end(void);
1355
+ SQLITE_API int SQLITE_STDCALL sqlite3_initialize(void);
1356
+ SQLITE_API int SQLITE_STDCALL sqlite3_shutdown(void);
1357
+ SQLITE_API int SQLITE_STDCALL sqlite3_os_init(void);
1358
+ SQLITE_API int SQLITE_STDCALL sqlite3_os_end(void);
1325
1359
 
1326
1360
  /*
1327
1361
  ** CAPI3REF: Configuring The SQLite Library
@@ -1352,10 +1386,11 @@ SQLITE_API int sqlite3_os_end(void);
1352
1386
  ** ^If the option is unknown or SQLite is unable to set the option
1353
1387
  ** then this routine returns a non-zero [error code].
1354
1388
  */
1355
- SQLITE_API int sqlite3_config(int, ...);
1389
+ SQLITE_API int SQLITE_CDECL sqlite3_config(int, ...);
1356
1390
 
1357
1391
  /*
1358
1392
  ** CAPI3REF: Configure database connections
1393
+ ** METHOD: sqlite3
1359
1394
  **
1360
1395
  ** The sqlite3_db_config() interface is used to make configuration
1361
1396
  ** changes to a [database connection]. The interface is similar to
@@ -1370,7 +1405,7 @@ SQLITE_API int sqlite3_config(int, ...);
1370
1405
  ** ^Calls to sqlite3_db_config() return SQLITE_OK if and only if
1371
1406
  ** the call is considered successful.
1372
1407
  */
1373
- SQLITE_API int sqlite3_db_config(sqlite3*, int op, ...);
1408
+ SQLITE_API int SQLITE_CDECL sqlite3_db_config(sqlite3*, int op, ...);
1374
1409
 
1375
1410
  /*
1376
1411
  ** CAPI3REF: Memory Allocation Routines
@@ -1504,31 +1539,33 @@ struct sqlite3_mem_methods {
1504
1539
  ** SQLITE_CONFIG_SERIALIZED configuration option.</dd>
1505
1540
  **
1506
1541
  ** [[SQLITE_CONFIG_MALLOC]] <dt>SQLITE_CONFIG_MALLOC</dt>
1507
- ** <dd> ^(This option takes a single argument which is a pointer to an
1508
- ** instance of the [sqlite3_mem_methods] structure. The argument specifies
1542
+ ** <dd> ^(The SQLITE_CONFIG_MALLOC option takes a single argument which is
1543
+ ** a pointer to an instance of the [sqlite3_mem_methods] structure.
1544
+ ** The argument specifies
1509
1545
  ** alternative low-level memory allocation routines to be used in place of
1510
1546
  ** the memory allocation routines built into SQLite.)^ ^SQLite makes
1511
1547
  ** its own private copy of the content of the [sqlite3_mem_methods] structure
1512
1548
  ** before the [sqlite3_config()] call returns.</dd>
1513
1549
  **
1514
1550
  ** [[SQLITE_CONFIG_GETMALLOC]] <dt>SQLITE_CONFIG_GETMALLOC</dt>
1515
- ** <dd> ^(This option takes a single argument which is a pointer to an
1516
- ** instance of the [sqlite3_mem_methods] structure. The [sqlite3_mem_methods]
1551
+ ** <dd> ^(The SQLITE_CONFIG_GETMALLOC option takes a single argument which
1552
+ ** is a pointer to an instance of the [sqlite3_mem_methods] structure.
1553
+ ** The [sqlite3_mem_methods]
1517
1554
  ** structure is filled with the currently defined memory allocation routines.)^
1518
1555
  ** This option can be used to overload the default memory allocation
1519
1556
  ** routines with a wrapper that simulations memory allocation failure or
1520
1557
  ** tracks memory usage, for example. </dd>
1521
1558
  **
1522
1559
  ** [[SQLITE_CONFIG_MEMSTATUS]] <dt>SQLITE_CONFIG_MEMSTATUS</dt>
1523
- ** <dd> ^This option takes single argument of type int, interpreted as a
1524
- ** boolean, which enables or disables the collection of memory allocation
1525
- ** statistics. ^(When memory allocation statistics are disabled, the
1526
- ** following SQLite interfaces become non-operational:
1560
+ ** <dd> ^The SQLITE_CONFIG_MEMSTATUS option takes single argument of type int,
1561
+ ** interpreted as a boolean, which enables or disables the collection of
1562
+ ** memory allocation statistics. ^(When memory allocation statistics are
1563
+ ** disabled, the following SQLite interfaces become non-operational:
1527
1564
  ** <ul>
1528
1565
  ** <li> [sqlite3_memory_used()]
1529
1566
  ** <li> [sqlite3_memory_highwater()]
1530
1567
  ** <li> [sqlite3_soft_heap_limit64()]
1531
- ** <li> [sqlite3_status()]
1568
+ ** <li> [sqlite3_status64()]
1532
1569
  ** </ul>)^
1533
1570
  ** ^Memory allocation statistics are enabled by default unless SQLite is
1534
1571
  ** compiled with [SQLITE_DEFAULT_MEMSTATUS]=0 in which case memory
@@ -1536,53 +1573,67 @@ struct sqlite3_mem_methods {
1536
1573
  ** </dd>
1537
1574
  **
1538
1575
  ** [[SQLITE_CONFIG_SCRATCH]] <dt>SQLITE_CONFIG_SCRATCH</dt>
1539
- ** <dd> ^This option specifies a static memory buffer that SQLite can use for
1540
- ** scratch memory. There are three arguments: A pointer an 8-byte
1576
+ ** <dd> ^The SQLITE_CONFIG_SCRATCH option specifies a static memory buffer
1577
+ ** that SQLite can use for scratch memory. ^(There are three arguments
1578
+ ** to SQLITE_CONFIG_SCRATCH: A pointer an 8-byte
1541
1579
  ** aligned memory buffer from which the scratch allocations will be
1542
1580
  ** drawn, the size of each scratch allocation (sz),
1543
- ** and the maximum number of scratch allocations (N). The sz
1544
- ** argument must be a multiple of 16.
1581
+ ** and the maximum number of scratch allocations (N).)^
1545
1582
  ** The first argument must be a pointer to an 8-byte aligned buffer
1546
1583
  ** of at least sz*N bytes of memory.
1547
- ** ^SQLite will use no more than two scratch buffers per thread. So
1548
- ** N should be set to twice the expected maximum number of threads.
1549
- ** ^SQLite will never require a scratch buffer that is more than 6
1550
- ** times the database page size. ^If SQLite needs needs additional
1584
+ ** ^SQLite will not use more than one scratch buffers per thread.
1585
+ ** ^SQLite will never request a scratch buffer that is more than 6
1586
+ ** times the database page size.
1587
+ ** ^If SQLite needs needs additional
1551
1588
  ** scratch memory beyond what is provided by this configuration option, then
1552
- ** [sqlite3_malloc()] will be used to obtain the memory needed.</dd>
1589
+ ** [sqlite3_malloc()] will be used to obtain the memory needed.<p>
1590
+ ** ^When the application provides any amount of scratch memory using
1591
+ ** SQLITE_CONFIG_SCRATCH, SQLite avoids unnecessary large
1592
+ ** [sqlite3_malloc|heap allocations].
1593
+ ** This can help [Robson proof|prevent memory allocation failures] due to heap
1594
+ ** fragmentation in low-memory embedded systems.
1595
+ ** </dd>
1553
1596
  **
1554
1597
  ** [[SQLITE_CONFIG_PAGECACHE]] <dt>SQLITE_CONFIG_PAGECACHE</dt>
1555
- ** <dd> ^This option specifies a static memory buffer that SQLite can use for
1556
- ** the database page cache with the default page cache implementation.
1598
+ ** <dd> ^The SQLITE_CONFIG_PAGECACHE option specifies a static memory buffer
1599
+ ** that SQLite can use for the database page cache with the default page
1600
+ ** cache implementation.
1557
1601
  ** This configuration should not be used if an application-define page
1558
- ** cache implementation is loaded using the SQLITE_CONFIG_PCACHE2 option.
1559
- ** There are three arguments to this option: A pointer to 8-byte aligned
1602
+ ** cache implementation is loaded using the [SQLITE_CONFIG_PCACHE2]
1603
+ ** configuration option.
1604
+ ** ^There are three arguments to SQLITE_CONFIG_PAGECACHE: A pointer to
1605
+ ** 8-byte aligned
1560
1606
  ** memory, the size of each page buffer (sz), and the number of pages (N).
1561
1607
  ** The sz argument should be the size of the largest database page
1562
- ** (a power of two between 512 and 32768) plus a little extra for each
1563
- ** page header. ^The page header size is 20 to 40 bytes depending on
1564
- ** the host architecture. ^It is harmless, apart from the wasted memory,
1565
- ** to make sz a little too large. The first
1566
- ** argument should point to an allocation of at least sz*N bytes of memory.
1608
+ ** (a power of two between 512 and 65536) plus some extra bytes for each
1609
+ ** page header. ^The number of extra bytes needed by the page header
1610
+ ** can be determined using the [SQLITE_CONFIG_PCACHE_HDRSZ] option
1611
+ ** to [sqlite3_config()].
1612
+ ** ^It is harmless, apart from the wasted memory,
1613
+ ** for the sz parameter to be larger than necessary. The first
1614
+ ** argument should pointer to an 8-byte aligned block of memory that
1615
+ ** is at least sz*N bytes of memory, otherwise subsequent behavior is
1616
+ ** undefined.
1567
1617
  ** ^SQLite will use the memory provided by the first argument to satisfy its
1568
1618
  ** memory needs for the first N pages that it adds to cache. ^If additional
1569
1619
  ** page cache memory is needed beyond what is provided by this option, then
1570
- ** SQLite goes to [sqlite3_malloc()] for the additional storage space.
1571
- ** The pointer in the first argument must
1572
- ** be aligned to an 8-byte boundary or subsequent behavior of SQLite
1573
- ** will be undefined.</dd>
1620
+ ** SQLite goes to [sqlite3_malloc()] for the additional storage space.</dd>
1574
1621
  **
1575
1622
  ** [[SQLITE_CONFIG_HEAP]] <dt>SQLITE_CONFIG_HEAP</dt>
1576
- ** <dd> ^This option specifies a static memory buffer that SQLite will use
1577
- ** for all of its dynamic memory allocation needs beyond those provided
1578
- ** for by [SQLITE_CONFIG_SCRATCH] and [SQLITE_CONFIG_PAGECACHE].
1579
- ** There are three arguments: An 8-byte aligned pointer to the memory,
1623
+ ** <dd> ^The SQLITE_CONFIG_HEAP option specifies a static memory buffer
1624
+ ** that SQLite will use for all of its dynamic memory allocation needs
1625
+ ** beyond those provided for by [SQLITE_CONFIG_SCRATCH] and
1626
+ ** [SQLITE_CONFIG_PAGECACHE].
1627
+ ** ^The SQLITE_CONFIG_HEAP option is only available if SQLite is compiled
1628
+ ** with either [SQLITE_ENABLE_MEMSYS3] or [SQLITE_ENABLE_MEMSYS5] and returns
1629
+ ** [SQLITE_ERROR] if invoked otherwise.
1630
+ ** ^There are three arguments to SQLITE_CONFIG_HEAP:
1631
+ ** An 8-byte aligned pointer to the memory,
1580
1632
  ** the number of bytes in the memory buffer, and the minimum allocation size.
1581
1633
  ** ^If the first pointer (the memory pointer) is NULL, then SQLite reverts
1582
1634
  ** to using its default memory allocator (the system malloc() implementation),
1583
1635
  ** undoing any prior invocation of [SQLITE_CONFIG_MALLOC]. ^If the
1584
- ** memory pointer is not NULL and either [SQLITE_ENABLE_MEMSYS3] or
1585
- ** [SQLITE_ENABLE_MEMSYS5] are defined, then the alternative memory
1636
+ ** memory pointer is not NULL then the alternative memory
1586
1637
  ** allocator is engaged to handle all of SQLites memory allocation needs.
1587
1638
  ** The first pointer (the memory pointer) must be aligned to an 8-byte
1588
1639
  ** boundary or subsequent behavior of SQLite will be undefined.
@@ -1590,11 +1641,11 @@ struct sqlite3_mem_methods {
1590
1641
  ** for the minimum allocation size are 2**5 through 2**8.</dd>
1591
1642
  **
1592
1643
  ** [[SQLITE_CONFIG_MUTEX]] <dt>SQLITE_CONFIG_MUTEX</dt>
1593
- ** <dd> ^(This option takes a single argument which is a pointer to an
1594
- ** instance of the [sqlite3_mutex_methods] structure. The argument specifies
1595
- ** alternative low-level mutex routines to be used in place
1596
- ** the mutex routines built into SQLite.)^ ^SQLite makes a copy of the
1597
- ** content of the [sqlite3_mutex_methods] structure before the call to
1644
+ ** <dd> ^(The SQLITE_CONFIG_MUTEX option takes a single argument which is a
1645
+ ** pointer to an instance of the [sqlite3_mutex_methods] structure.
1646
+ ** The argument specifies alternative low-level mutex routines to be used
1647
+ ** in place the mutex routines built into SQLite.)^ ^SQLite makes a copy of
1648
+ ** the content of the [sqlite3_mutex_methods] structure before the call to
1598
1649
  ** [sqlite3_config()] returns. ^If SQLite is compiled with
1599
1650
  ** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
1600
1651
  ** the entire mutexing subsystem is omitted from the build and hence calls to
@@ -1602,8 +1653,8 @@ struct sqlite3_mem_methods {
1602
1653
  ** return [SQLITE_ERROR].</dd>
1603
1654
  **
1604
1655
  ** [[SQLITE_CONFIG_GETMUTEX]] <dt>SQLITE_CONFIG_GETMUTEX</dt>
1605
- ** <dd> ^(This option takes a single argument which is a pointer to an
1606
- ** instance of the [sqlite3_mutex_methods] structure. The
1656
+ ** <dd> ^(The SQLITE_CONFIG_GETMUTEX option takes a single argument which
1657
+ ** is a pointer to an instance of the [sqlite3_mutex_methods] structure. The
1607
1658
  ** [sqlite3_mutex_methods]
1608
1659
  ** structure is filled with the currently defined mutex routines.)^
1609
1660
  ** This option can be used to overload the default mutex allocation
@@ -1615,25 +1666,25 @@ struct sqlite3_mem_methods {
1615
1666
  ** return [SQLITE_ERROR].</dd>
1616
1667
  **
1617
1668
  ** [[SQLITE_CONFIG_LOOKASIDE]] <dt>SQLITE_CONFIG_LOOKASIDE</dt>
1618
- ** <dd> ^(This option takes two arguments that determine the default
1619
- ** memory allocation for the lookaside memory allocator on each
1620
- ** [database connection]. The first argument is the
1669
+ ** <dd> ^(The SQLITE_CONFIG_LOOKASIDE option takes two arguments that determine
1670
+ ** the default size of lookaside memory on each [database connection].
1671
+ ** The first argument is the
1621
1672
  ** size of each lookaside buffer slot and the second is the number of
1622
- ** slots allocated to each database connection.)^ ^(This option sets the
1623
- ** <i>default</i> lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE]
1624
- ** verb to [sqlite3_db_config()] can be used to change the lookaside
1673
+ ** slots allocated to each database connection.)^ ^(SQLITE_CONFIG_LOOKASIDE
1674
+ ** sets the <i>default</i> lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE]
1675
+ ** option to [sqlite3_db_config()] can be used to change the lookaside
1625
1676
  ** configuration on individual connections.)^ </dd>
1626
1677
  **
1627
1678
  ** [[SQLITE_CONFIG_PCACHE2]] <dt>SQLITE_CONFIG_PCACHE2</dt>
1628
- ** <dd> ^(This option takes a single argument which is a pointer to
1629
- ** an [sqlite3_pcache_methods2] object. This object specifies the interface
1630
- ** to a custom page cache implementation.)^ ^SQLite makes a copy of the
1631
- ** object and uses it for page cache memory allocations.</dd>
1679
+ ** <dd> ^(The SQLITE_CONFIG_PCACHE2 option takes a single argument which is
1680
+ ** a pointer to an [sqlite3_pcache_methods2] object. This object specifies
1681
+ ** the interface to a custom page cache implementation.)^
1682
+ ** ^SQLite makes a copy of the [sqlite3_pcache_methods2] object.</dd>
1632
1683
  **
1633
1684
  ** [[SQLITE_CONFIG_GETPCACHE2]] <dt>SQLITE_CONFIG_GETPCACHE2</dt>
1634
- ** <dd> ^(This option takes a single argument which is a pointer to an
1635
- ** [sqlite3_pcache_methods2] object. SQLite copies of the current
1636
- ** page cache implementation into that object.)^ </dd>
1685
+ ** <dd> ^(The SQLITE_CONFIG_GETPCACHE2 option takes a single argument which
1686
+ ** is a pointer to an [sqlite3_pcache_methods2] object. SQLite copies of
1687
+ ** the current page cache implementation into that object.)^ </dd>
1637
1688
  **
1638
1689
  ** [[SQLITE_CONFIG_LOG]] <dt>SQLITE_CONFIG_LOG</dt>
1639
1690
  ** <dd> The SQLITE_CONFIG_LOG option is used to configure the SQLite
@@ -1656,10 +1707,11 @@ struct sqlite3_mem_methods {
1656
1707
  ** function must be threadsafe. </dd>
1657
1708
  **
1658
1709
  ** [[SQLITE_CONFIG_URI]] <dt>SQLITE_CONFIG_URI
1659
- ** <dd>^(This option takes a single argument of type int. If non-zero, then
1660
- ** URI handling is globally enabled. If the parameter is zero, then URI handling
1661
- ** is globally disabled.)^ ^If URI handling is globally enabled, all filenames
1662
- ** passed to [sqlite3_open()], [sqlite3_open_v2()], [sqlite3_open16()] or
1710
+ ** <dd>^(The SQLITE_CONFIG_URI option takes a single argument of type int.
1711
+ ** If non-zero, then URI handling is globally enabled. If the parameter is zero,
1712
+ ** then URI handling is globally disabled.)^ ^If URI handling is globally
1713
+ ** enabled, all filenames passed to [sqlite3_open()], [sqlite3_open_v2()],
1714
+ ** [sqlite3_open16()] or
1663
1715
  ** specified as part of [ATTACH] commands are interpreted as URIs, regardless
1664
1716
  ** of whether or not the [SQLITE_OPEN_URI] flag is set when the database
1665
1717
  ** connection is opened. ^If it is globally disabled, filenames are
@@ -1669,9 +1721,10 @@ struct sqlite3_mem_methods {
1669
1721
  ** [SQLITE_USE_URI] symbol defined.)^
1670
1722
  **
1671
1723
  ** [[SQLITE_CONFIG_COVERING_INDEX_SCAN]] <dt>SQLITE_CONFIG_COVERING_INDEX_SCAN
1672
- ** <dd>^This option takes a single integer argument which is interpreted as
1673
- ** a boolean in order to enable or disable the use of covering indices for
1674
- ** full table scans in the query optimizer. ^The default setting is determined
1724
+ ** <dd>^The SQLITE_CONFIG_COVERING_INDEX_SCAN option takes a single integer
1725
+ ** argument which is interpreted as a boolean in order to enable or disable
1726
+ ** the use of covering indices for full table scans in the query optimizer.
1727
+ ** ^The default setting is determined
1675
1728
  ** by the [SQLITE_ALLOW_COVERING_INDEX_SCAN] compile-time option, or is "on"
1676
1729
  ** if that compile-time option is omitted.
1677
1730
  ** The ability to disable the use of covering indices for full table scans
@@ -1711,18 +1764,37 @@ struct sqlite3_mem_methods {
1711
1764
  ** ^The default setting can be overridden by each database connection using
1712
1765
  ** either the [PRAGMA mmap_size] command, or by using the
1713
1766
  ** [SQLITE_FCNTL_MMAP_SIZE] file control. ^(The maximum allowed mmap size
1714
- ** cannot be changed at run-time. Nor may the maximum allowed mmap size
1715
- ** exceed the compile-time maximum mmap size set by the
1767
+ ** will be silently truncated if necessary so that it does not exceed the
1768
+ ** compile-time maximum mmap size set by the
1716
1769
  ** [SQLITE_MAX_MMAP_SIZE] compile-time option.)^
1717
1770
  ** ^If either argument to this option is negative, then that argument is
1718
1771
  ** changed to its compile-time default.
1719
1772
  **
1720
1773
  ** [[SQLITE_CONFIG_WIN32_HEAPSIZE]]
1721
1774
  ** <dt>SQLITE_CONFIG_WIN32_HEAPSIZE
1722
- ** <dd>^This option is only available if SQLite is compiled for Windows
1723
- ** with the [SQLITE_WIN32_MALLOC] pre-processor macro defined.
1724
- ** SQLITE_CONFIG_WIN32_HEAPSIZE takes a 32-bit unsigned integer value
1775
+ ** <dd>^The SQLITE_CONFIG_WIN32_HEAPSIZE option is only available if SQLite is
1776
+ ** compiled for Windows with the [SQLITE_WIN32_MALLOC] pre-processor macro
1777
+ ** defined. ^SQLITE_CONFIG_WIN32_HEAPSIZE takes a 32-bit unsigned integer value
1725
1778
  ** that specifies the maximum size of the created heap.
1779
+ **
1780
+ ** [[SQLITE_CONFIG_PCACHE_HDRSZ]]
1781
+ ** <dt>SQLITE_CONFIG_PCACHE_HDRSZ
1782
+ ** <dd>^The SQLITE_CONFIG_PCACHE_HDRSZ option takes a single parameter which
1783
+ ** is a pointer to an integer and writes into that integer the number of extra
1784
+ ** bytes per page required for each page in [SQLITE_CONFIG_PAGECACHE].
1785
+ ** The amount of extra space required can change depending on the compiler,
1786
+ ** target platform, and SQLite version.
1787
+ **
1788
+ ** [[SQLITE_CONFIG_PMASZ]]
1789
+ ** <dt>SQLITE_CONFIG_PMASZ
1790
+ ** <dd>^The SQLITE_CONFIG_PMASZ option takes a single parameter which
1791
+ ** is an unsigned integer and sets the "Minimum PMA Size" for the multithreaded
1792
+ ** sorter to that integer. The default minimum PMA Size is set by the
1793
+ ** [SQLITE_SORTER_PMASZ] compile-time option. New threads are launched
1794
+ ** to help with sort operations when multithreaded sorting
1795
+ ** is enabled (using the [PRAGMA threads] command) and the amount of content
1796
+ ** to be sorted exceeds the page size times the minimum of the
1797
+ ** [PRAGMA cache_size] setting and this value.
1726
1798
  ** </dl>
1727
1799
  */
1728
1800
  #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
@@ -1748,6 +1820,8 @@ struct sqlite3_mem_methods {
1748
1820
  #define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */
1749
1821
  #define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */
1750
1822
  #define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */
1823
+ #define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */
1824
+ #define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */
1751
1825
 
1752
1826
  /*
1753
1827
  ** CAPI3REF: Database Connection Configuration Options
@@ -1814,15 +1888,17 @@ struct sqlite3_mem_methods {
1814
1888
 
1815
1889
  /*
1816
1890
  ** CAPI3REF: Enable Or Disable Extended Result Codes
1891
+ ** METHOD: sqlite3
1817
1892
  **
1818
1893
  ** ^The sqlite3_extended_result_codes() routine enables or disables the
1819
1894
  ** [extended result codes] feature of SQLite. ^The extended result
1820
1895
  ** codes are disabled by default for historical compatibility.
1821
1896
  */
1822
- SQLITE_API int sqlite3_extended_result_codes(sqlite3*, int onoff);
1897
+ SQLITE_API int SQLITE_STDCALL sqlite3_extended_result_codes(sqlite3*, int onoff);
1823
1898
 
1824
1899
  /*
1825
1900
  ** CAPI3REF: Last Insert Rowid
1901
+ ** METHOD: sqlite3
1826
1902
  **
1827
1903
  ** ^Each entry in most SQLite tables (except for [WITHOUT ROWID] tables)
1828
1904
  ** has a unique 64-bit signed
@@ -1870,52 +1946,51 @@ SQLITE_API int sqlite3_extended_result_codes(sqlite3*, int onoff);
1870
1946
  ** unpredictable and might not equal either the old or the new
1871
1947
  ** last insert [rowid].
1872
1948
  */
1873
- SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);
1949
+ SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_last_insert_rowid(sqlite3*);
1874
1950
 
1875
1951
  /*
1876
1952
  ** CAPI3REF: Count The Number Of Rows Modified
1953
+ ** METHOD: sqlite3
1877
1954
  **
1878
- ** ^This function returns the number of database rows that were changed
1879
- ** or inserted or deleted by the most recently completed SQL statement
1880
- ** on the [database connection] specified by the first parameter.
1881
- ** ^(Only changes that are directly specified by the [INSERT], [UPDATE],
1882
- ** or [DELETE] statement are counted. Auxiliary changes caused by
1883
- ** triggers or [foreign key actions] are not counted.)^ Use the
1884
- ** [sqlite3_total_changes()] function to find the total number of changes
1885
- ** including changes caused by triggers and foreign key actions.
1886
- **
1887
- ** ^Changes to a view that are simulated by an [INSTEAD OF trigger]
1888
- ** are not counted. Only real table changes are counted.
1889
- **
1890
- ** ^(A "row change" is a change to a single row of a single table
1891
- ** caused by an INSERT, DELETE, or UPDATE statement. Rows that
1892
- ** are changed as side effects of [REPLACE] constraint resolution,
1893
- ** rollback, ABORT processing, [DROP TABLE], or by any other
1894
- ** mechanisms do not count as direct row changes.)^
1895
- **
1896
- ** A "trigger context" is a scope of execution that begins and
1897
- ** ends with the script of a [CREATE TRIGGER | trigger].
1898
- ** Most SQL statements are
1899
- ** evaluated outside of any trigger. This is the "top level"
1900
- ** trigger context. If a trigger fires from the top level, a
1901
- ** new trigger context is entered for the duration of that one
1902
- ** trigger. Subtriggers create subcontexts for their duration.
1903
- **
1904
- ** ^Calling [sqlite3_exec()] or [sqlite3_step()] recursively does
1905
- ** not create a new trigger context.
1906
- **
1907
- ** ^This function returns the number of direct row changes in the
1908
- ** most recent INSERT, UPDATE, or DELETE statement within the same
1909
- ** trigger context.
1910
- **
1911
- ** ^Thus, when called from the top level, this function returns the
1912
- ** number of changes in the most recent INSERT, UPDATE, or DELETE
1913
- ** that also occurred at the top level. ^(Within the body of a trigger,
1914
- ** the sqlite3_changes() interface can be called to find the number of
1915
- ** changes in the most recently completed INSERT, UPDATE, or DELETE
1916
- ** statement within the body of the same trigger.
1917
- ** However, the number returned does not include changes
1918
- ** caused by subtriggers since those have their own context.)^
1955
+ ** ^This function returns the number of rows modified, inserted or
1956
+ ** deleted by the most recently completed INSERT, UPDATE or DELETE
1957
+ ** statement on the database connection specified by the only parameter.
1958
+ ** ^Executing any other type of SQL statement does not modify the value
1959
+ ** returned by this function.
1960
+ **
1961
+ ** ^Only changes made directly by the INSERT, UPDATE or DELETE statement are
1962
+ ** considered - auxiliary changes caused by [CREATE TRIGGER | triggers],
1963
+ ** [foreign key actions] or [REPLACE] constraint resolution are not counted.
1964
+ **
1965
+ ** Changes to a view that are intercepted by
1966
+ ** [INSTEAD OF trigger | INSTEAD OF triggers] are not counted. ^The value
1967
+ ** returned by sqlite3_changes() immediately after an INSERT, UPDATE or
1968
+ ** DELETE statement run on a view is always zero. Only changes made to real
1969
+ ** tables are counted.
1970
+ **
1971
+ ** Things are more complicated if the sqlite3_changes() function is
1972
+ ** executed while a trigger program is running. This may happen if the
1973
+ ** program uses the [changes() SQL function], or if some other callback
1974
+ ** function invokes sqlite3_changes() directly. Essentially:
1975
+ **
1976
+ ** <ul>
1977
+ ** <li> ^(Before entering a trigger program the value returned by
1978
+ ** sqlite3_changes() function is saved. After the trigger program
1979
+ ** has finished, the original value is restored.)^
1980
+ **
1981
+ ** <li> ^(Within a trigger program each INSERT, UPDATE and DELETE
1982
+ ** statement sets the value returned by sqlite3_changes()
1983
+ ** upon completion as normal. Of course, this value will not include
1984
+ ** any changes performed by sub-triggers, as the sqlite3_changes()
1985
+ ** value will be saved and restored after each sub-trigger has run.)^
1986
+ ** </ul>
1987
+ **
1988
+ ** ^This means that if the changes() SQL function (or similar) is used
1989
+ ** by the first INSERT, UPDATE or DELETE statement within a trigger, it
1990
+ ** returns the value as set when the calling statement began executing.
1991
+ ** ^If it is used by the second or subsequent such statement within a trigger
1992
+ ** program, the value returned reflects the number of rows modified by the
1993
+ ** previous INSERT, UPDATE or DELETE statement within the same trigger.
1919
1994
  **
1920
1995
  ** See also the [sqlite3_total_changes()] interface, the
1921
1996
  ** [count_changes pragma], and the [changes() SQL function].
@@ -1924,25 +1999,23 @@ SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);
1924
1999
  ** while [sqlite3_changes()] is running then the value returned
1925
2000
  ** is unpredictable and not meaningful.
1926
2001
  */
1927
- SQLITE_API int sqlite3_changes(sqlite3*);
2002
+ SQLITE_API int SQLITE_STDCALL sqlite3_changes(sqlite3*);
1928
2003
 
1929
2004
  /*
1930
2005
  ** CAPI3REF: Total Number Of Rows Modified
2006
+ ** METHOD: sqlite3
1931
2007
  **
1932
- ** ^This function returns the number of row changes caused by [INSERT],
1933
- ** [UPDATE] or [DELETE] statements since the [database connection] was opened.
1934
- ** ^(The count returned by sqlite3_total_changes() includes all changes
1935
- ** from all [CREATE TRIGGER | trigger] contexts and changes made by
1936
- ** [foreign key actions]. However,
1937
- ** the count does not include changes used to implement [REPLACE] constraints,
1938
- ** do rollbacks or ABORT processing, or [DROP TABLE] processing. The
1939
- ** count does not include rows of views that fire an [INSTEAD OF trigger],
1940
- ** though if the INSTEAD OF trigger makes changes of its own, those changes
1941
- ** are counted.)^
1942
- ** ^The sqlite3_total_changes() function counts the changes as soon as
1943
- ** the statement that makes them is completed (when the statement handle
1944
- ** is passed to [sqlite3_reset()] or [sqlite3_finalize()]).
1945
- **
2008
+ ** ^This function returns the total number of rows inserted, modified or
2009
+ ** deleted by all [INSERT], [UPDATE] or [DELETE] statements completed
2010
+ ** since the database connection was opened, including those executed as
2011
+ ** part of trigger programs. ^Executing any other type of SQL statement
2012
+ ** does not affect the value returned by sqlite3_total_changes().
2013
+ **
2014
+ ** ^Changes made as part of [foreign key actions] are included in the
2015
+ ** count, but those made as part of REPLACE constraint resolution are
2016
+ ** not. ^Changes to a view that are intercepted by INSTEAD OF triggers
2017
+ ** are not counted.
2018
+ **
1946
2019
  ** See also the [sqlite3_changes()] interface, the
1947
2020
  ** [count_changes pragma], and the [total_changes() SQL function].
1948
2021
  **
@@ -1950,10 +2023,11 @@ SQLITE_API int sqlite3_changes(sqlite3*);
1950
2023
  ** while [sqlite3_total_changes()] is running then the value
1951
2024
  ** returned is unpredictable and not meaningful.
1952
2025
  */
1953
- SQLITE_API int sqlite3_total_changes(sqlite3*);
2026
+ SQLITE_API int SQLITE_STDCALL sqlite3_total_changes(sqlite3*);
1954
2027
 
1955
2028
  /*
1956
2029
  ** CAPI3REF: Interrupt A Long-Running Query
2030
+ ** METHOD: sqlite3
1957
2031
  **
1958
2032
  ** ^This function causes any pending database operation to abort and
1959
2033
  ** return at its earliest opportunity. This routine is typically
@@ -1989,7 +2063,7 @@ SQLITE_API int sqlite3_total_changes(sqlite3*);
1989
2063
  ** If the database connection closes while [sqlite3_interrupt()]
1990
2064
  ** is running then bad things will likely happen.
1991
2065
  */
1992
- SQLITE_API void sqlite3_interrupt(sqlite3*);
2066
+ SQLITE_API void SQLITE_STDCALL sqlite3_interrupt(sqlite3*);
1993
2067
 
1994
2068
  /*
1995
2069
  ** CAPI3REF: Determine If An SQL Statement Is Complete
@@ -2024,11 +2098,13 @@ SQLITE_API void sqlite3_interrupt(sqlite3*);
2024
2098
  ** The input to [sqlite3_complete16()] must be a zero-terminated
2025
2099
  ** UTF-16 string in native byte order.
2026
2100
  */
2027
- SQLITE_API int sqlite3_complete(const char *sql);
2028
- SQLITE_API int sqlite3_complete16(const void *sql);
2101
+ SQLITE_API int SQLITE_STDCALL sqlite3_complete(const char *sql);
2102
+ SQLITE_API int SQLITE_STDCALL sqlite3_complete16(const void *sql);
2029
2103
 
2030
2104
  /*
2031
2105
  ** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors
2106
+ ** KEYWORDS: {busy-handler callback} {busy handler}
2107
+ ** METHOD: sqlite3
2032
2108
  **
2033
2109
  ** ^The sqlite3_busy_handler(D,X,P) routine sets a callback function X
2034
2110
  ** that might be invoked with argument P whenever
@@ -2045,7 +2121,7 @@ SQLITE_API int sqlite3_complete16(const void *sql);
2045
2121
  ** ^The first argument to the busy handler is a copy of the void* pointer which
2046
2122
  ** is the third argument to sqlite3_busy_handler(). ^The second argument to
2047
2123
  ** the busy handler callback is the number of times that the busy handler has
2048
- ** been invoked for the same locking event. ^If the
2124
+ ** been invoked previously for the same locking event. ^If the
2049
2125
  ** busy callback returns 0, then no additional attempts are made to
2050
2126
  ** access the database and [SQLITE_BUSY] is returned
2051
2127
  ** to the application.
@@ -2084,10 +2160,11 @@ SQLITE_API int sqlite3_complete16(const void *sql);
2084
2160
  ** A busy handler must not close the database connection
2085
2161
  ** or [prepared statement] that invoked the busy handler.
2086
2162
  */
2087
- SQLITE_API int sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*);
2163
+ SQLITE_API int SQLITE_STDCALL sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*);
2088
2164
 
2089
2165
  /*
2090
2166
  ** CAPI3REF: Set A Busy Timeout
2167
+ ** METHOD: sqlite3
2091
2168
  **
2092
2169
  ** ^This routine sets a [sqlite3_busy_handler | busy handler] that sleeps
2093
2170
  ** for a specified amount of time when a table is locked. ^The handler
@@ -2106,10 +2183,11 @@ SQLITE_API int sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*);
2106
2183
  **
2107
2184
  ** See also: [PRAGMA busy_timeout]
2108
2185
  */
2109
- SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms);
2186
+ SQLITE_API int SQLITE_STDCALL sqlite3_busy_timeout(sqlite3*, int ms);
2110
2187
 
2111
2188
  /*
2112
2189
  ** CAPI3REF: Convenience Routines For Running Queries
2190
+ ** METHOD: sqlite3
2113
2191
  **
2114
2192
  ** This is a legacy interface that is preserved for backwards compatibility.
2115
2193
  ** Use of this interface is not recommended.
@@ -2180,7 +2258,7 @@ SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms);
2180
2258
  ** reflected in subsequent calls to [sqlite3_errcode()] or
2181
2259
  ** [sqlite3_errmsg()].
2182
2260
  */
2183
- SQLITE_API int sqlite3_get_table(
2261
+ SQLITE_API int SQLITE_STDCALL sqlite3_get_table(
2184
2262
  sqlite3 *db, /* An open database */
2185
2263
  const char *zSql, /* SQL to be evaluated */
2186
2264
  char ***pazResult, /* Results of the query */
@@ -2188,13 +2266,17 @@ SQLITE_API int sqlite3_get_table(
2188
2266
  int *pnColumn, /* Number of result columns written here */
2189
2267
  char **pzErrmsg /* Error msg written here */
2190
2268
  );
2191
- SQLITE_API void sqlite3_free_table(char **result);
2269
+ SQLITE_API void SQLITE_STDCALL sqlite3_free_table(char **result);
2192
2270
 
2193
2271
  /*
2194
2272
  ** CAPI3REF: Formatted String Printing Functions
2195
2273
  **
2196
2274
  ** These routines are work-alikes of the "printf()" family of functions
2197
2275
  ** from the standard C library.
2276
+ ** These routines understand most of the common K&R formatting options,
2277
+ ** plus some additional non-standard formats, detailed below.
2278
+ ** Note that some of the more obscure formatting options from recent
2279
+ ** C-library standards are omitted from this implementation.
2198
2280
  **
2199
2281
  ** ^The sqlite3_mprintf() and sqlite3_vmprintf() routines write their
2200
2282
  ** results into memory obtained from [sqlite3_malloc()].
@@ -2227,7 +2309,7 @@ SQLITE_API void sqlite3_free_table(char **result);
2227
2309
  ** These routines all implement some additional formatting
2228
2310
  ** options that are useful for constructing SQL statements.
2229
2311
  ** All of the usual printf() formatting options apply. In addition, there
2230
- ** is are "%q", "%Q", and "%z" options.
2312
+ ** is are "%q", "%Q", "%w" and "%z" options.
2231
2313
  **
2232
2314
  ** ^(The %q option works like %s in that it substitutes a nul-terminated
2233
2315
  ** string from the argument list. But %q also doubles every '\'' character.
@@ -2280,14 +2362,20 @@ SQLITE_API void sqlite3_free_table(char **result);
2280
2362
  ** The code above will render a correct SQL statement in the zSQL
2281
2363
  ** variable even if the zText variable is a NULL pointer.
2282
2364
  **
2365
+ ** ^(The "%w" formatting option is like "%q" except that it expects to
2366
+ ** be contained within double-quotes instead of single quotes, and it
2367
+ ** escapes the double-quote character instead of the single-quote
2368
+ ** character.)^ The "%w" formatting option is intended for safely inserting
2369
+ ** table and column names into a constructed SQL statement.
2370
+ **
2283
2371
  ** ^(The "%z" formatting option works like "%s" but with the
2284
2372
  ** addition that after the string has been read and copied into
2285
2373
  ** the result, [sqlite3_free()] is called on the input string.)^
2286
2374
  */
2287
- SQLITE_API char *sqlite3_mprintf(const char*,...);
2288
- SQLITE_API char *sqlite3_vmprintf(const char*, va_list);
2289
- SQLITE_API char *sqlite3_snprintf(int,char*,const char*, ...);
2290
- SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list);
2375
+ SQLITE_API char *SQLITE_CDECL sqlite3_mprintf(const char*,...);
2376
+ SQLITE_API char *SQLITE_STDCALL sqlite3_vmprintf(const char*, va_list);
2377
+ SQLITE_API char *SQLITE_CDECL sqlite3_snprintf(int,char*,const char*, ...);
2378
+ SQLITE_API char *SQLITE_STDCALL sqlite3_vsnprintf(int,char*,const char*, va_list);
2291
2379
 
2292
2380
  /*
2293
2381
  ** CAPI3REF: Memory Allocation Subsystem
@@ -2377,12 +2465,12 @@ SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list);
2377
2465
  ** a block of memory after it has been released using
2378
2466
  ** [sqlite3_free()] or [sqlite3_realloc()].
2379
2467
  */
2380
- SQLITE_API void *sqlite3_malloc(int);
2381
- SQLITE_API void *sqlite3_malloc64(sqlite3_uint64);
2382
- SQLITE_API void *sqlite3_realloc(void*, int);
2383
- SQLITE_API void *sqlite3_realloc64(void*, sqlite3_uint64);
2384
- SQLITE_API void sqlite3_free(void*);
2385
- SQLITE_API sqlite3_uint64 sqlite3_msize(void*);
2468
+ SQLITE_API void *SQLITE_STDCALL sqlite3_malloc(int);
2469
+ SQLITE_API void *SQLITE_STDCALL sqlite3_malloc64(sqlite3_uint64);
2470
+ SQLITE_API void *SQLITE_STDCALL sqlite3_realloc(void*, int);
2471
+ SQLITE_API void *SQLITE_STDCALL sqlite3_realloc64(void*, sqlite3_uint64);
2472
+ SQLITE_API void SQLITE_STDCALL sqlite3_free(void*);
2473
+ SQLITE_API sqlite3_uint64 SQLITE_STDCALL sqlite3_msize(void*);
2386
2474
 
2387
2475
  /*
2388
2476
  ** CAPI3REF: Memory Allocator Statistics
@@ -2407,8 +2495,8 @@ SQLITE_API sqlite3_uint64 sqlite3_msize(void*);
2407
2495
  ** by [sqlite3_memory_highwater(1)] is the high-water mark
2408
2496
  ** prior to the reset.
2409
2497
  */
2410
- SQLITE_API sqlite3_int64 sqlite3_memory_used(void);
2411
- SQLITE_API sqlite3_int64 sqlite3_memory_highwater(int resetFlag);
2498
+ SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_memory_used(void);
2499
+ SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_memory_highwater(int resetFlag);
2412
2500
 
2413
2501
  /*
2414
2502
  ** CAPI3REF: Pseudo-Random Number Generator
@@ -2420,20 +2508,22 @@ SQLITE_API sqlite3_int64 sqlite3_memory_highwater(int resetFlag);
2420
2508
  ** applications to access the same PRNG for other purposes.
2421
2509
  **
2422
2510
  ** ^A call to this routine stores N bytes of randomness into buffer P.
2423
- ** ^If N is less than one, then P can be a NULL pointer.
2511
+ ** ^The P parameter can be a NULL pointer.
2424
2512
  **
2425
2513
  ** ^If this routine has not been previously called or if the previous
2426
- ** call had N less than one, then the PRNG is seeded using randomness
2427
- ** obtained from the xRandomness method of the default [sqlite3_vfs] object.
2428
- ** ^If the previous call to this routine had an N of 1 or more then
2429
- ** the pseudo-randomness is generated
2514
+ ** call had N less than one or a NULL pointer for P, then the PRNG is
2515
+ ** seeded using randomness obtained from the xRandomness method of
2516
+ ** the default [sqlite3_vfs] object.
2517
+ ** ^If the previous call to this routine had an N of 1 or more and a
2518
+ ** non-NULL P then the pseudo-randomness is generated
2430
2519
  ** internally and without recourse to the [sqlite3_vfs] xRandomness
2431
2520
  ** method.
2432
2521
  */
2433
- SQLITE_API void sqlite3_randomness(int N, void *P);
2522
+ SQLITE_API void SQLITE_STDCALL sqlite3_randomness(int N, void *P);
2434
2523
 
2435
2524
  /*
2436
2525
  ** CAPI3REF: Compile-Time Authorization Callbacks
2526
+ ** METHOD: sqlite3
2437
2527
  **
2438
2528
  ** ^This routine registers an authorizer callback with a particular
2439
2529
  ** [database connection], supplied in the first argument.
@@ -2512,7 +2602,7 @@ SQLITE_API void sqlite3_randomness(int N, void *P);
2512
2602
  ** as stated in the previous paragraph, sqlite3_step() invokes
2513
2603
  ** sqlite3_prepare_v2() to reprepare a statement after a schema change.
2514
2604
  */
2515
- SQLITE_API int sqlite3_set_authorizer(
2605
+ SQLITE_API int SQLITE_STDCALL sqlite3_set_authorizer(
2516
2606
  sqlite3*,
2517
2607
  int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),
2518
2608
  void *pUserData
@@ -2590,6 +2680,7 @@ SQLITE_API int sqlite3_set_authorizer(
2590
2680
 
2591
2681
  /*
2592
2682
  ** CAPI3REF: Tracing And Profiling Functions
2683
+ ** METHOD: sqlite3
2593
2684
  **
2594
2685
  ** These routines register callback functions that can be used for
2595
2686
  ** tracing and profiling the execution of SQL statements.
@@ -2616,12 +2707,13 @@ SQLITE_API int sqlite3_set_authorizer(
2616
2707
  ** sqlite3_profile() function is considered experimental and is
2617
2708
  ** subject to change in future versions of SQLite.
2618
2709
  */
2619
- SQLITE_API void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*);
2620
- SQLITE_API SQLITE_EXPERIMENTAL void *sqlite3_profile(sqlite3*,
2710
+ SQLITE_API void *SQLITE_STDCALL sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*);
2711
+ SQLITE_API SQLITE_EXPERIMENTAL void *SQLITE_STDCALL sqlite3_profile(sqlite3*,
2621
2712
  void(*xProfile)(void*,const char*,sqlite3_uint64), void*);
2622
2713
 
2623
2714
  /*
2624
2715
  ** CAPI3REF: Query Progress Callbacks
2716
+ ** METHOD: sqlite3
2625
2717
  **
2626
2718
  ** ^The sqlite3_progress_handler(D,N,X,P) interface causes the callback
2627
2719
  ** function X to be invoked periodically during long running calls to
@@ -2651,10 +2743,11 @@ SQLITE_API SQLITE_EXPERIMENTAL void *sqlite3_profile(sqlite3*,
2651
2743
  ** database connections for the meaning of "modify" in this paragraph.
2652
2744
  **
2653
2745
  */
2654
- SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
2746
+ SQLITE_API void SQLITE_STDCALL sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
2655
2747
 
2656
2748
  /*
2657
2749
  ** CAPI3REF: Opening A New Database Connection
2750
+ ** CONSTRUCTOR: sqlite3
2658
2751
  **
2659
2752
  ** ^These routines open an SQLite database file as specified by the
2660
2753
  ** filename argument. ^The filename argument is interpreted as UTF-8 for
@@ -2879,15 +2972,15 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
2879
2972
  **
2880
2973
  ** See also: [sqlite3_temp_directory]
2881
2974
  */
2882
- SQLITE_API int sqlite3_open(
2975
+ SQLITE_API int SQLITE_STDCALL sqlite3_open(
2883
2976
  const char *filename, /* Database filename (UTF-8) */
2884
2977
  sqlite3 **ppDb /* OUT: SQLite db handle */
2885
2978
  );
2886
- SQLITE_API int sqlite3_open16(
2979
+ SQLITE_API int SQLITE_STDCALL sqlite3_open16(
2887
2980
  const void *filename, /* Database filename (UTF-16) */
2888
2981
  sqlite3 **ppDb /* OUT: SQLite db handle */
2889
2982
  );
2890
- SQLITE_API int sqlite3_open_v2(
2983
+ SQLITE_API int SQLITE_STDCALL sqlite3_open_v2(
2891
2984
  const char *filename, /* Database filename (UTF-8) */
2892
2985
  sqlite3 **ppDb, /* OUT: SQLite db handle */
2893
2986
  int flags, /* Flags */
@@ -2933,19 +3026,22 @@ SQLITE_API int sqlite3_open_v2(
2933
3026
  ** VFS method, then the behavior of this routine is undefined and probably
2934
3027
  ** undesirable.
2935
3028
  */
2936
- SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam);
2937
- SQLITE_API int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault);
2938
- SQLITE_API sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int64);
3029
+ SQLITE_API const char *SQLITE_STDCALL sqlite3_uri_parameter(const char *zFilename, const char *zParam);
3030
+ SQLITE_API int SQLITE_STDCALL sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault);
3031
+ SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_uri_int64(const char*, const char*, sqlite3_int64);
2939
3032
 
2940
3033
 
2941
3034
  /*
2942
3035
  ** CAPI3REF: Error Codes And Messages
2943
- **
2944
- ** ^The sqlite3_errcode() interface returns the numeric [result code] or
2945
- ** [extended result code] for the most recent failed sqlite3_* API call
2946
- ** associated with a [database connection]. If a prior API call failed
2947
- ** but the most recent API call succeeded, the return value from
2948
- ** sqlite3_errcode() is undefined. ^The sqlite3_extended_errcode()
3036
+ ** METHOD: sqlite3
3037
+ **
3038
+ ** ^If the most recent sqlite3_* API call associated with
3039
+ ** [database connection] D failed, then the sqlite3_errcode(D) interface
3040
+ ** returns the numeric [result code] or [extended result code] for that
3041
+ ** API call.
3042
+ ** If the most recent API call was successful,
3043
+ ** then the return value from sqlite3_errcode() is undefined.
3044
+ ** ^The sqlite3_extended_errcode()
2949
3045
  ** interface is the same except that it always returns the
2950
3046
  ** [extended result code] even when extended result codes are
2951
3047
  ** disabled.
@@ -2976,40 +3072,41 @@ SQLITE_API sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int
2976
3072
  ** was invoked incorrectly by the application. In that case, the
2977
3073
  ** error code and message may or may not be set.
2978
3074
  */
2979
- SQLITE_API int sqlite3_errcode(sqlite3 *db);
2980
- SQLITE_API int sqlite3_extended_errcode(sqlite3 *db);
2981
- SQLITE_API const char *sqlite3_errmsg(sqlite3*);
2982
- SQLITE_API const void *sqlite3_errmsg16(sqlite3*);
2983
- SQLITE_API const char *sqlite3_errstr(int);
3075
+ SQLITE_API int SQLITE_STDCALL sqlite3_errcode(sqlite3 *db);
3076
+ SQLITE_API int SQLITE_STDCALL sqlite3_extended_errcode(sqlite3 *db);
3077
+ SQLITE_API const char *SQLITE_STDCALL sqlite3_errmsg(sqlite3*);
3078
+ SQLITE_API const void *SQLITE_STDCALL sqlite3_errmsg16(sqlite3*);
3079
+ SQLITE_API const char *SQLITE_STDCALL sqlite3_errstr(int);
2984
3080
 
2985
3081
  /*
2986
- ** CAPI3REF: SQL Statement Object
3082
+ ** CAPI3REF: Prepared Statement Object
2987
3083
  ** KEYWORDS: {prepared statement} {prepared statements}
2988
3084
  **
2989
- ** An instance of this object represents a single SQL statement.
2990
- ** This object is variously known as a "prepared statement" or a
2991
- ** "compiled SQL statement" or simply as a "statement".
3085
+ ** An instance of this object represents a single SQL statement that
3086
+ ** has been compiled into binary form and is ready to be evaluated.
3087
+ **
3088
+ ** Think of each SQL statement as a separate computer program. The
3089
+ ** original SQL text is source code. A prepared statement object
3090
+ ** is the compiled object code. All SQL must be converted into a
3091
+ ** prepared statement before it can be run.
2992
3092
  **
2993
- ** The life of a statement object goes something like this:
3093
+ ** The life-cycle of a prepared statement object usually goes like this:
2994
3094
  **
2995
3095
  ** <ol>
2996
- ** <li> Create the object using [sqlite3_prepare_v2()] or a related
2997
- ** function.
2998
- ** <li> Bind values to [host parameters] using the sqlite3_bind_*()
3096
+ ** <li> Create the prepared statement object using [sqlite3_prepare_v2()].
3097
+ ** <li> Bind values to [parameters] using the sqlite3_bind_*()
2999
3098
  ** interfaces.
3000
3099
  ** <li> Run the SQL by calling [sqlite3_step()] one or more times.
3001
- ** <li> Reset the statement using [sqlite3_reset()] then go back
3100
+ ** <li> Reset the prepared statement using [sqlite3_reset()] then go back
3002
3101
  ** to step 2. Do this zero or more times.
3003
3102
  ** <li> Destroy the object using [sqlite3_finalize()].
3004
3103
  ** </ol>
3005
- **
3006
- ** Refer to documentation on individual methods above for additional
3007
- ** information.
3008
3104
  */
3009
3105
  typedef struct sqlite3_stmt sqlite3_stmt;
3010
3106
 
3011
3107
  /*
3012
3108
  ** CAPI3REF: Run-time Limits
3109
+ ** METHOD: sqlite3
3013
3110
  **
3014
3111
  ** ^(This interface allows the size of various constructs to be limited
3015
3112
  ** on a connection by connection basis. The first parameter is the
@@ -3047,7 +3144,7 @@ typedef struct sqlite3_stmt sqlite3_stmt;
3047
3144
  **
3048
3145
  ** New run-time limit categories may be added in future releases.
3049
3146
  */
3050
- SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
3147
+ SQLITE_API int SQLITE_STDCALL sqlite3_limit(sqlite3*, int id, int newVal);
3051
3148
 
3052
3149
  /*
3053
3150
  ** CAPI3REF: Run-Time Limit Categories
@@ -3121,6 +3218,8 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
3121
3218
  /*
3122
3219
  ** CAPI3REF: Compiling An SQL Statement
3123
3220
  ** KEYWORDS: {SQL statement compiler}
3221
+ ** METHOD: sqlite3
3222
+ ** CONSTRUCTOR: sqlite3_stmt
3124
3223
  **
3125
3224
  ** To execute an SQL query, it must first be compiled into a byte-code
3126
3225
  ** program using one of these routines.
@@ -3134,16 +3233,14 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
3134
3233
  ** interfaces use UTF-8, and sqlite3_prepare16() and sqlite3_prepare16_v2()
3135
3234
  ** use UTF-16.
3136
3235
  **
3137
- ** ^If the nByte argument is less than zero, then zSql is read up to the
3138
- ** first zero terminator. ^If nByte is non-negative, then it is the maximum
3139
- ** number of bytes read from zSql. ^When nByte is non-negative, the
3140
- ** zSql string ends at either the first '\000' or '\u0000' character or
3141
- ** the nByte-th byte, whichever comes first. If the caller knows
3142
- ** that the supplied string is nul-terminated, then there is a small
3143
- ** performance advantage to be gained by passing an nByte parameter that
3144
- ** is equal to the number of bytes in the input string <i>including</i>
3145
- ** the nul-terminator bytes as this saves SQLite from having to
3146
- ** make a copy of the input string.
3236
+ ** ^If the nByte argument is negative, then zSql is read up to the
3237
+ ** first zero terminator. ^If nByte is positive, then it is the
3238
+ ** number of bytes read from zSql. ^If nByte is zero, then no prepared
3239
+ ** statement is generated.
3240
+ ** If the caller knows that the supplied string is nul-terminated, then
3241
+ ** there is a small performance advantage to passing an nByte parameter that
3242
+ ** is the number of bytes in the input string <i>including</i>
3243
+ ** the nul-terminator.
3147
3244
  **
3148
3245
  ** ^If pzTail is not NULL then *pzTail is made to point to the first byte
3149
3246
  ** past the end of the first SQL statement in zSql. These routines only
@@ -3199,28 +3296,28 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
3199
3296
  ** </li>
3200
3297
  ** </ol>
3201
3298
  */
3202
- SQLITE_API int sqlite3_prepare(
3299
+ SQLITE_API int SQLITE_STDCALL sqlite3_prepare(
3203
3300
  sqlite3 *db, /* Database handle */
3204
3301
  const char *zSql, /* SQL statement, UTF-8 encoded */
3205
3302
  int nByte, /* Maximum length of zSql in bytes. */
3206
3303
  sqlite3_stmt **ppStmt, /* OUT: Statement handle */
3207
3304
  const char **pzTail /* OUT: Pointer to unused portion of zSql */
3208
3305
  );
3209
- SQLITE_API int sqlite3_prepare_v2(
3306
+ SQLITE_API int SQLITE_STDCALL sqlite3_prepare_v2(
3210
3307
  sqlite3 *db, /* Database handle */
3211
3308
  const char *zSql, /* SQL statement, UTF-8 encoded */
3212
3309
  int nByte, /* Maximum length of zSql in bytes. */
3213
3310
  sqlite3_stmt **ppStmt, /* OUT: Statement handle */
3214
3311
  const char **pzTail /* OUT: Pointer to unused portion of zSql */
3215
3312
  );
3216
- SQLITE_API int sqlite3_prepare16(
3313
+ SQLITE_API int SQLITE_STDCALL sqlite3_prepare16(
3217
3314
  sqlite3 *db, /* Database handle */
3218
3315
  const void *zSql, /* SQL statement, UTF-16 encoded */
3219
3316
  int nByte, /* Maximum length of zSql in bytes. */
3220
3317
  sqlite3_stmt **ppStmt, /* OUT: Statement handle */
3221
3318
  const void **pzTail /* OUT: Pointer to unused portion of zSql */
3222
3319
  );
3223
- SQLITE_API int sqlite3_prepare16_v2(
3320
+ SQLITE_API int SQLITE_STDCALL sqlite3_prepare16_v2(
3224
3321
  sqlite3 *db, /* Database handle */
3225
3322
  const void *zSql, /* SQL statement, UTF-16 encoded */
3226
3323
  int nByte, /* Maximum length of zSql in bytes. */
@@ -3230,15 +3327,17 @@ SQLITE_API int sqlite3_prepare16_v2(
3230
3327
 
3231
3328
  /*
3232
3329
  ** CAPI3REF: Retrieving Statement SQL
3330
+ ** METHOD: sqlite3_stmt
3233
3331
  **
3234
3332
  ** ^This interface can be used to retrieve a saved copy of the original
3235
3333
  ** SQL text used to create a [prepared statement] if that statement was
3236
3334
  ** compiled using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()].
3237
3335
  */
3238
- SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt);
3336
+ SQLITE_API const char *SQLITE_STDCALL sqlite3_sql(sqlite3_stmt *pStmt);
3239
3337
 
3240
3338
  /*
3241
3339
  ** CAPI3REF: Determine If An SQL Statement Writes The Database
3340
+ ** METHOD: sqlite3_stmt
3242
3341
  **
3243
3342
  ** ^The sqlite3_stmt_readonly(X) interface returns true (non-zero) if
3244
3343
  ** and only if the [prepared statement] X makes no direct changes to
@@ -3266,10 +3365,11 @@ SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt);
3266
3365
  ** change the configuration of a database connection, they do not make
3267
3366
  ** changes to the content of the database files on disk.
3268
3367
  */
3269
- SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
3368
+ SQLITE_API int SQLITE_STDCALL sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
3270
3369
 
3271
3370
  /*
3272
3371
  ** CAPI3REF: Determine If A Prepared Statement Has Been Reset
3372
+ ** METHOD: sqlite3_stmt
3273
3373
  **
3274
3374
  ** ^The sqlite3_stmt_busy(S) interface returns true (non-zero) if the
3275
3375
  ** [prepared statement] S has been stepped at least once using
@@ -3285,7 +3385,7 @@ SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
3285
3385
  ** for example, in diagnostic routines to search for prepared
3286
3386
  ** statements that are holding a transaction open.
3287
3387
  */
3288
- SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*);
3388
+ SQLITE_API int SQLITE_STDCALL sqlite3_stmt_busy(sqlite3_stmt*);
3289
3389
 
3290
3390
  /*
3291
3391
  ** CAPI3REF: Dynamically Typed Value Object
@@ -3300,7 +3400,9 @@ SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*);
3300
3400
  ** Some interfaces require a protected sqlite3_value. Other interfaces
3301
3401
  ** will accept either a protected or an unprotected sqlite3_value.
3302
3402
  ** Every interface that accepts sqlite3_value arguments specifies
3303
- ** whether or not it requires a protected sqlite3_value.
3403
+ ** whether or not it requires a protected sqlite3_value. The
3404
+ ** [sqlite3_value_dup()] interface can be used to construct a new
3405
+ ** protected sqlite3_value from an unprotected sqlite3_value.
3304
3406
  **
3305
3407
  ** The terms "protected" and "unprotected" refer to whether or not
3306
3408
  ** a mutex is held. An internal mutex is held for a protected
@@ -3344,6 +3446,7 @@ typedef struct sqlite3_context sqlite3_context;
3344
3446
  ** CAPI3REF: Binding Values To Prepared Statements
3345
3447
  ** KEYWORDS: {host parameter} {host parameters} {host parameter name}
3346
3448
  ** KEYWORDS: {SQL parameter} {SQL parameters} {parameter binding}
3449
+ ** METHOD: sqlite3_stmt
3347
3450
  **
3348
3451
  ** ^(In the SQL statement text input to [sqlite3_prepare_v2()] and its variants,
3349
3452
  ** literals may be replaced by a [parameter] that matches one of following
@@ -3446,22 +3549,24 @@ typedef struct sqlite3_context sqlite3_context;
3446
3549
  ** See also: [sqlite3_bind_parameter_count()],
3447
3550
  ** [sqlite3_bind_parameter_name()], and [sqlite3_bind_parameter_index()].
3448
3551
  */
3449
- SQLITE_API int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));
3450
- SQLITE_API int sqlite3_bind_blob64(sqlite3_stmt*, int, const void*, sqlite3_uint64,
3552
+ SQLITE_API int SQLITE_STDCALL sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));
3553
+ SQLITE_API int SQLITE_STDCALL sqlite3_bind_blob64(sqlite3_stmt*, int, const void*, sqlite3_uint64,
3451
3554
  void(*)(void*));
3452
- SQLITE_API int sqlite3_bind_double(sqlite3_stmt*, int, double);
3453
- SQLITE_API int sqlite3_bind_int(sqlite3_stmt*, int, int);
3454
- SQLITE_API int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64);
3455
- SQLITE_API int sqlite3_bind_null(sqlite3_stmt*, int);
3456
- SQLITE_API int sqlite3_bind_text(sqlite3_stmt*,int,const char*,int,void(*)(void*));
3457
- SQLITE_API int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*));
3458
- SQLITE_API int sqlite3_bind_text64(sqlite3_stmt*, int, const char*, sqlite3_uint64,
3555
+ SQLITE_API int SQLITE_STDCALL sqlite3_bind_double(sqlite3_stmt*, int, double);
3556
+ SQLITE_API int SQLITE_STDCALL sqlite3_bind_int(sqlite3_stmt*, int, int);
3557
+ SQLITE_API int SQLITE_STDCALL sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64);
3558
+ SQLITE_API int SQLITE_STDCALL sqlite3_bind_null(sqlite3_stmt*, int);
3559
+ SQLITE_API int SQLITE_STDCALL sqlite3_bind_text(sqlite3_stmt*,int,const char*,int,void(*)(void*));
3560
+ SQLITE_API int SQLITE_STDCALL sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*));
3561
+ SQLITE_API int SQLITE_STDCALL sqlite3_bind_text64(sqlite3_stmt*, int, const char*, sqlite3_uint64,
3459
3562
  void(*)(void*), unsigned char encoding);
3460
- SQLITE_API int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
3461
- SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
3563
+ SQLITE_API int SQLITE_STDCALL sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
3564
+ SQLITE_API int SQLITE_STDCALL sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
3565
+ SQLITE_API int SQLITE_STDCALL sqlite3_bind_zeroblob64(sqlite3_stmt*, int, sqlite3_uint64);
3462
3566
 
3463
3567
  /*
3464
3568
  ** CAPI3REF: Number Of SQL Parameters
3569
+ ** METHOD: sqlite3_stmt
3465
3570
  **
3466
3571
  ** ^This routine can be used to find the number of [SQL parameters]
3467
3572
  ** in a [prepared statement]. SQL parameters are tokens of the
@@ -3478,10 +3583,11 @@ SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
3478
3583
  ** [sqlite3_bind_parameter_name()], and
3479
3584
  ** [sqlite3_bind_parameter_index()].
3480
3585
  */
3481
- SQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt*);
3586
+ SQLITE_API int SQLITE_STDCALL sqlite3_bind_parameter_count(sqlite3_stmt*);
3482
3587
 
3483
3588
  /*
3484
3589
  ** CAPI3REF: Name Of A Host Parameter
3590
+ ** METHOD: sqlite3_stmt
3485
3591
  **
3486
3592
  ** ^The sqlite3_bind_parameter_name(P,N) interface returns
3487
3593
  ** the name of the N-th [SQL parameter] in the [prepared statement] P.
@@ -3505,10 +3611,11 @@ SQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt*);
3505
3611
  ** [sqlite3_bind_parameter_count()], and
3506
3612
  ** [sqlite3_bind_parameter_index()].
3507
3613
  */
3508
- SQLITE_API const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int);
3614
+ SQLITE_API const char *SQLITE_STDCALL sqlite3_bind_parameter_name(sqlite3_stmt*, int);
3509
3615
 
3510
3616
  /*
3511
3617
  ** CAPI3REF: Index Of A Parameter With A Given Name
3618
+ ** METHOD: sqlite3_stmt
3512
3619
  **
3513
3620
  ** ^Return the index of an SQL parameter given its name. ^The
3514
3621
  ** index value returned is suitable for use as the second
@@ -3521,19 +3628,21 @@ SQLITE_API const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int);
3521
3628
  ** [sqlite3_bind_parameter_count()], and
3522
3629
  ** [sqlite3_bind_parameter_index()].
3523
3630
  */
3524
- SQLITE_API int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName);
3631
+ SQLITE_API int SQLITE_STDCALL sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName);
3525
3632
 
3526
3633
  /*
3527
3634
  ** CAPI3REF: Reset All Bindings On A Prepared Statement
3635
+ ** METHOD: sqlite3_stmt
3528
3636
  **
3529
3637
  ** ^Contrary to the intuition of many, [sqlite3_reset()] does not reset
3530
3638
  ** the [sqlite3_bind_blob | bindings] on a [prepared statement].
3531
3639
  ** ^Use this routine to reset all host parameters to NULL.
3532
3640
  */
3533
- SQLITE_API int sqlite3_clear_bindings(sqlite3_stmt*);
3641
+ SQLITE_API int SQLITE_STDCALL sqlite3_clear_bindings(sqlite3_stmt*);
3534
3642
 
3535
3643
  /*
3536
3644
  ** CAPI3REF: Number Of Columns In A Result Set
3645
+ ** METHOD: sqlite3_stmt
3537
3646
  **
3538
3647
  ** ^Return the number of columns in the result set returned by the
3539
3648
  ** [prepared statement]. ^This routine returns 0 if pStmt is an SQL
@@ -3541,10 +3650,11 @@ SQLITE_API int sqlite3_clear_bindings(sqlite3_stmt*);
3541
3650
  **
3542
3651
  ** See also: [sqlite3_data_count()]
3543
3652
  */
3544
- SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt);
3653
+ SQLITE_API int SQLITE_STDCALL sqlite3_column_count(sqlite3_stmt *pStmt);
3545
3654
 
3546
3655
  /*
3547
3656
  ** CAPI3REF: Column Names In A Result Set
3657
+ ** METHOD: sqlite3_stmt
3548
3658
  **
3549
3659
  ** ^These routines return the name assigned to a particular column
3550
3660
  ** in the result set of a [SELECT] statement. ^The sqlite3_column_name()
@@ -3569,11 +3679,12 @@ SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt);
3569
3679
  ** then the name of the column is unspecified and may change from
3570
3680
  ** one release of SQLite to the next.
3571
3681
  */
3572
- SQLITE_API const char *sqlite3_column_name(sqlite3_stmt*, int N);
3573
- SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt*, int N);
3682
+ SQLITE_API const char *SQLITE_STDCALL sqlite3_column_name(sqlite3_stmt*, int N);
3683
+ SQLITE_API const void *SQLITE_STDCALL sqlite3_column_name16(sqlite3_stmt*, int N);
3574
3684
 
3575
3685
  /*
3576
3686
  ** CAPI3REF: Source Of Data In A Query Result
3687
+ ** METHOD: sqlite3_stmt
3577
3688
  **
3578
3689
  ** ^These routines provide a means to determine the database, table, and
3579
3690
  ** table column that is the origin of a particular result column in
@@ -3617,15 +3728,16 @@ SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt*, int N);
3617
3728
  ** for the same [prepared statement] and result column
3618
3729
  ** at the same time then the results are undefined.
3619
3730
  */
3620
- SQLITE_API const char *sqlite3_column_database_name(sqlite3_stmt*,int);
3621
- SQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt*,int);
3622
- SQLITE_API const char *sqlite3_column_table_name(sqlite3_stmt*,int);
3623
- SQLITE_API const void *sqlite3_column_table_name16(sqlite3_stmt*,int);
3624
- SQLITE_API const char *sqlite3_column_origin_name(sqlite3_stmt*,int);
3625
- SQLITE_API const void *sqlite3_column_origin_name16(sqlite3_stmt*,int);
3731
+ SQLITE_API const char *SQLITE_STDCALL sqlite3_column_database_name(sqlite3_stmt*,int);
3732
+ SQLITE_API const void *SQLITE_STDCALL sqlite3_column_database_name16(sqlite3_stmt*,int);
3733
+ SQLITE_API const char *SQLITE_STDCALL sqlite3_column_table_name(sqlite3_stmt*,int);
3734
+ SQLITE_API const void *SQLITE_STDCALL sqlite3_column_table_name16(sqlite3_stmt*,int);
3735
+ SQLITE_API const char *SQLITE_STDCALL sqlite3_column_origin_name(sqlite3_stmt*,int);
3736
+ SQLITE_API const void *SQLITE_STDCALL sqlite3_column_origin_name16(sqlite3_stmt*,int);
3626
3737
 
3627
3738
  /*
3628
3739
  ** CAPI3REF: Declared Datatype Of A Query Result
3740
+ ** METHOD: sqlite3_stmt
3629
3741
  **
3630
3742
  ** ^(The first parameter is a [prepared statement].
3631
3743
  ** If this statement is a [SELECT] statement and the Nth column of the
@@ -3653,11 +3765,12 @@ SQLITE_API const void *sqlite3_column_origin_name16(sqlite3_stmt*,int);
3653
3765
  ** is associated with individual values, not with the containers
3654
3766
  ** used to hold those values.
3655
3767
  */
3656
- SQLITE_API const char *sqlite3_column_decltype(sqlite3_stmt*,int);
3657
- SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
3768
+ SQLITE_API const char *SQLITE_STDCALL sqlite3_column_decltype(sqlite3_stmt*,int);
3769
+ SQLITE_API const void *SQLITE_STDCALL sqlite3_column_decltype16(sqlite3_stmt*,int);
3658
3770
 
3659
3771
  /*
3660
3772
  ** CAPI3REF: Evaluate An SQL Statement
3773
+ ** METHOD: sqlite3_stmt
3661
3774
  **
3662
3775
  ** After a [prepared statement] has been prepared using either
3663
3776
  ** [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] or one of the legacy
@@ -3733,10 +3846,11 @@ SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
3733
3846
  ** then the more specific [error codes] are returned directly
3734
3847
  ** by sqlite3_step(). The use of the "v2" interface is recommended.
3735
3848
  */
3736
- SQLITE_API int sqlite3_step(sqlite3_stmt*);
3849
+ SQLITE_API int SQLITE_STDCALL sqlite3_step(sqlite3_stmt*);
3737
3850
 
3738
3851
  /*
3739
3852
  ** CAPI3REF: Number of columns in a result set
3853
+ ** METHOD: sqlite3_stmt
3740
3854
  **
3741
3855
  ** ^The sqlite3_data_count(P) interface returns the number of columns in the
3742
3856
  ** current row of the result set of [prepared statement] P.
@@ -3753,7 +3867,7 @@ SQLITE_API int sqlite3_step(sqlite3_stmt*);
3753
3867
  **
3754
3868
  ** See also: [sqlite3_column_count()]
3755
3869
  */
3756
- SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
3870
+ SQLITE_API int SQLITE_STDCALL sqlite3_data_count(sqlite3_stmt *pStmt);
3757
3871
 
3758
3872
  /*
3759
3873
  ** CAPI3REF: Fundamental Datatypes
@@ -3790,8 +3904,7 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
3790
3904
  /*
3791
3905
  ** CAPI3REF: Result Values From A Query
3792
3906
  ** KEYWORDS: {column access functions}
3793
- **
3794
- ** These routines form the "result set" interface.
3907
+ ** METHOD: sqlite3_stmt
3795
3908
  **
3796
3909
  ** ^These routines return information about a single column of the current
3797
3910
  ** result row of a query. ^In every case the first argument is a pointer
@@ -3852,13 +3965,14 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
3852
3965
  ** even empty strings, are always zero-terminated. ^The return
3853
3966
  ** value from sqlite3_column_blob() for a zero-length BLOB is a NULL pointer.
3854
3967
  **
3855
- ** ^The object returned by [sqlite3_column_value()] is an
3856
- ** [unprotected sqlite3_value] object. An unprotected sqlite3_value object
3857
- ** may only be used with [sqlite3_bind_value()] and [sqlite3_result_value()].
3968
+ ** <b>Warning:</b> ^The object returned by [sqlite3_column_value()] is an
3969
+ ** [unprotected sqlite3_value] object. In a multithreaded environment,
3970
+ ** an unprotected sqlite3_value object may only be used safely with
3971
+ ** [sqlite3_bind_value()] and [sqlite3_result_value()].
3858
3972
  ** If the [unprotected sqlite3_value] object returned by
3859
3973
  ** [sqlite3_column_value()] is used in any other way, including calls
3860
3974
  ** to routines like [sqlite3_value_int()], [sqlite3_value_text()],
3861
- ** or [sqlite3_value_bytes()], then the behavior is undefined.
3975
+ ** or [sqlite3_value_bytes()], the behavior is not threadsafe.
3862
3976
  **
3863
3977
  ** These routines attempt to convert the value where appropriate. ^For
3864
3978
  ** example, if the internal representation is FLOAT and a text result
@@ -3889,12 +4003,6 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
3889
4003
  ** </table>
3890
4004
  ** </blockquote>)^
3891
4005
  **
3892
- ** The table above makes reference to standard C library functions atoi()
3893
- ** and atof(). SQLite does not really use these functions. It has its
3894
- ** own equivalent internal routines. The atoi() and atof() names are
3895
- ** used in the table for brevity and because they are familiar to most
3896
- ** C programmers.
3897
- **
3898
4006
  ** Note that when type conversions occur, pointers returned by prior
3899
4007
  ** calls to sqlite3_column_blob(), sqlite3_column_text(), and/or
3900
4008
  ** sqlite3_column_text16() may be invalidated.
@@ -3919,7 +4027,7 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
3919
4027
  ** of conversion are done in place when it is possible, but sometimes they
3920
4028
  ** are not possible and in those cases prior pointers are invalidated.
3921
4029
  **
3922
- ** The safest and easiest to remember policy is to invoke these routines
4030
+ ** The safest policy is to invoke these routines
3923
4031
  ** in one of the following ways:
3924
4032
  **
3925
4033
  ** <ul>
@@ -3939,7 +4047,7 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
3939
4047
  ** ^The pointers returned are valid until a type conversion occurs as
3940
4048
  ** described above, or until [sqlite3_step()] or [sqlite3_reset()] or
3941
4049
  ** [sqlite3_finalize()] is called. ^The memory space used to hold strings
3942
- ** and BLOBs is freed automatically. Do <b>not</b> pass the pointers returned
4050
+ ** and BLOBs is freed automatically. Do <em>not</em> pass the pointers returned
3943
4051
  ** from [sqlite3_column_blob()], [sqlite3_column_text()], etc. into
3944
4052
  ** [sqlite3_free()].
3945
4053
  **
@@ -3949,19 +4057,20 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
3949
4057
  ** pointer. Subsequent calls to [sqlite3_errcode()] will return
3950
4058
  ** [SQLITE_NOMEM].)^
3951
4059
  */
3952
- SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol);
3953
- SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
3954
- SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
3955
- SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol);
3956
- SQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol);
3957
- SQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol);
3958
- SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol);
3959
- SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt*, int iCol);
3960
- SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol);
3961
- SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol);
4060
+ SQLITE_API const void *SQLITE_STDCALL sqlite3_column_blob(sqlite3_stmt*, int iCol);
4061
+ SQLITE_API int SQLITE_STDCALL sqlite3_column_bytes(sqlite3_stmt*, int iCol);
4062
+ SQLITE_API int SQLITE_STDCALL sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
4063
+ SQLITE_API double SQLITE_STDCALL sqlite3_column_double(sqlite3_stmt*, int iCol);
4064
+ SQLITE_API int SQLITE_STDCALL sqlite3_column_int(sqlite3_stmt*, int iCol);
4065
+ SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_column_int64(sqlite3_stmt*, int iCol);
4066
+ SQLITE_API const unsigned char *SQLITE_STDCALL sqlite3_column_text(sqlite3_stmt*, int iCol);
4067
+ SQLITE_API const void *SQLITE_STDCALL sqlite3_column_text16(sqlite3_stmt*, int iCol);
4068
+ SQLITE_API int SQLITE_STDCALL sqlite3_column_type(sqlite3_stmt*, int iCol);
4069
+ SQLITE_API sqlite3_value *SQLITE_STDCALL sqlite3_column_value(sqlite3_stmt*, int iCol);
3962
4070
 
3963
4071
  /*
3964
4072
  ** CAPI3REF: Destroy A Prepared Statement Object
4073
+ ** DESTRUCTOR: sqlite3_stmt
3965
4074
  **
3966
4075
  ** ^The sqlite3_finalize() function is called to delete a [prepared statement].
3967
4076
  ** ^If the most recent evaluation of the statement encountered no errors
@@ -3985,10 +4094,11 @@ SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol);
3985
4094
  ** statement after it has been finalized can result in undefined and
3986
4095
  ** undesirable behavior such as segfaults and heap corruption.
3987
4096
  */
3988
- SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt);
4097
+ SQLITE_API int SQLITE_STDCALL sqlite3_finalize(sqlite3_stmt *pStmt);
3989
4098
 
3990
4099
  /*
3991
4100
  ** CAPI3REF: Reset A Prepared Statement Object
4101
+ ** METHOD: sqlite3_stmt
3992
4102
  **
3993
4103
  ** The sqlite3_reset() function is called to reset a [prepared statement]
3994
4104
  ** object back to its initial state, ready to be re-executed.
@@ -4011,13 +4121,14 @@ SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt);
4011
4121
  ** ^The [sqlite3_reset(S)] interface does not change the values
4012
4122
  ** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S.
4013
4123
  */
4014
- SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
4124
+ SQLITE_API int SQLITE_STDCALL sqlite3_reset(sqlite3_stmt *pStmt);
4015
4125
 
4016
4126
  /*
4017
4127
  ** CAPI3REF: Create Or Redefine SQL Functions
4018
4128
  ** KEYWORDS: {function creation routines}
4019
4129
  ** KEYWORDS: {application-defined SQL function}
4020
4130
  ** KEYWORDS: {application-defined SQL functions}
4131
+ ** METHOD: sqlite3
4021
4132
  **
4022
4133
  ** ^These functions (collectively known as "function creation routines")
4023
4134
  ** are used to add SQL functions or aggregates or to redefine the behavior
@@ -4110,7 +4221,7 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
4110
4221
  ** close the database connection nor finalize or reset the prepared
4111
4222
  ** statement in which the function is running.
4112
4223
  */
4113
- SQLITE_API int sqlite3_create_function(
4224
+ SQLITE_API int SQLITE_STDCALL sqlite3_create_function(
4114
4225
  sqlite3 *db,
4115
4226
  const char *zFunctionName,
4116
4227
  int nArg,
@@ -4120,7 +4231,7 @@ SQLITE_API int sqlite3_create_function(
4120
4231
  void (*xStep)(sqlite3_context*,int,sqlite3_value**),
4121
4232
  void (*xFinal)(sqlite3_context*)
4122
4233
  );
4123
- SQLITE_API int sqlite3_create_function16(
4234
+ SQLITE_API int SQLITE_STDCALL sqlite3_create_function16(
4124
4235
  sqlite3 *db,
4125
4236
  const void *zFunctionName,
4126
4237
  int nArg,
@@ -4130,7 +4241,7 @@ SQLITE_API int sqlite3_create_function16(
4130
4241
  void (*xStep)(sqlite3_context*,int,sqlite3_value**),
4131
4242
  void (*xFinal)(sqlite3_context*)
4132
4243
  );
4133
- SQLITE_API int sqlite3_create_function_v2(
4244
+ SQLITE_API int SQLITE_STDCALL sqlite3_create_function_v2(
4134
4245
  sqlite3 *db,
4135
4246
  const char *zFunctionName,
4136
4247
  int nArg,
@@ -4148,9 +4259,9 @@ SQLITE_API int sqlite3_create_function_v2(
4148
4259
  ** These constant define integer codes that represent the various
4149
4260
  ** text encodings supported by SQLite.
4150
4261
  */
4151
- #define SQLITE_UTF8 1
4152
- #define SQLITE_UTF16LE 2
4153
- #define SQLITE_UTF16BE 3
4262
+ #define SQLITE_UTF8 1 /* IMP: R-37514-35566 */
4263
+ #define SQLITE_UTF16LE 2 /* IMP: R-03371-37637 */
4264
+ #define SQLITE_UTF16BE 3 /* IMP: R-51971-34154 */
4154
4265
  #define SQLITE_UTF16 4 /* Use native byte order */
4155
4266
  #define SQLITE_ANY 5 /* Deprecated */
4156
4267
  #define SQLITE_UTF16_ALIGNED 8 /* sqlite3_create_collation only */
@@ -4172,25 +4283,26 @@ SQLITE_API int sqlite3_create_function_v2(
4172
4283
  ** These functions are [deprecated]. In order to maintain
4173
4284
  ** backwards compatibility with older code, these functions continue
4174
4285
  ** to be supported. However, new applications should avoid
4175
- ** the use of these functions. To help encourage people to avoid
4176
- ** using these functions, we are not going to tell you what they do.
4286
+ ** the use of these functions. To encourage programmers to avoid
4287
+ ** these functions, we will not explain what they do.
4177
4288
  */
4178
4289
  #ifndef SQLITE_OMIT_DEPRECATED
4179
- SQLITE_API SQLITE_DEPRECATED int sqlite3_aggregate_count(sqlite3_context*);
4180
- SQLITE_API SQLITE_DEPRECATED int sqlite3_expired(sqlite3_stmt*);
4181
- SQLITE_API SQLITE_DEPRECATED int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*);
4182
- SQLITE_API SQLITE_DEPRECATED int sqlite3_global_recover(void);
4183
- SQLITE_API SQLITE_DEPRECATED void sqlite3_thread_cleanup(void);
4184
- SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),
4290
+ SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_aggregate_count(sqlite3_context*);
4291
+ SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_expired(sqlite3_stmt*);
4292
+ SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*);
4293
+ SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_global_recover(void);
4294
+ SQLITE_API SQLITE_DEPRECATED void SQLITE_STDCALL sqlite3_thread_cleanup(void);
4295
+ SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),
4185
4296
  void*,sqlite3_int64);
4186
4297
  #endif
4187
4298
 
4188
4299
  /*
4189
- ** CAPI3REF: Obtaining SQL Function Parameter Values
4300
+ ** CAPI3REF: Obtaining SQL Values
4301
+ ** METHOD: sqlite3_value
4190
4302
  **
4191
4303
  ** The C-language implementation of SQL functions and aggregates uses
4192
4304
  ** this set of interface routines to access the parameter values on
4193
- ** the function or aggregate.
4305
+ ** the function or aggregate.
4194
4306
  **
4195
4307
  ** The xFunc (for scalar functions) or xStep (for aggregates) parameters
4196
4308
  ** to [sqlite3_create_function()] and [sqlite3_create_function16()]
@@ -4230,21 +4342,39 @@ SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int6
4230
4342
  ** These routines must be called from the same thread as
4231
4343
  ** the SQL function that supplied the [sqlite3_value*] parameters.
4232
4344
  */
4233
- SQLITE_API const void *sqlite3_value_blob(sqlite3_value*);
4234
- SQLITE_API int sqlite3_value_bytes(sqlite3_value*);
4235
- SQLITE_API int sqlite3_value_bytes16(sqlite3_value*);
4236
- SQLITE_API double sqlite3_value_double(sqlite3_value*);
4237
- SQLITE_API int sqlite3_value_int(sqlite3_value*);
4238
- SQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*);
4239
- SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value*);
4240
- SQLITE_API const void *sqlite3_value_text16(sqlite3_value*);
4241
- SQLITE_API const void *sqlite3_value_text16le(sqlite3_value*);
4242
- SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*);
4243
- SQLITE_API int sqlite3_value_type(sqlite3_value*);
4244
- SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);
4345
+ SQLITE_API const void *SQLITE_STDCALL sqlite3_value_blob(sqlite3_value*);
4346
+ SQLITE_API int SQLITE_STDCALL sqlite3_value_bytes(sqlite3_value*);
4347
+ SQLITE_API int SQLITE_STDCALL sqlite3_value_bytes16(sqlite3_value*);
4348
+ SQLITE_API double SQLITE_STDCALL sqlite3_value_double(sqlite3_value*);
4349
+ SQLITE_API int SQLITE_STDCALL sqlite3_value_int(sqlite3_value*);
4350
+ SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_value_int64(sqlite3_value*);
4351
+ SQLITE_API const unsigned char *SQLITE_STDCALL sqlite3_value_text(sqlite3_value*);
4352
+ SQLITE_API const void *SQLITE_STDCALL sqlite3_value_text16(sqlite3_value*);
4353
+ SQLITE_API const void *SQLITE_STDCALL sqlite3_value_text16le(sqlite3_value*);
4354
+ SQLITE_API const void *SQLITE_STDCALL sqlite3_value_text16be(sqlite3_value*);
4355
+ SQLITE_API int SQLITE_STDCALL sqlite3_value_type(sqlite3_value*);
4356
+ SQLITE_API int SQLITE_STDCALL sqlite3_value_numeric_type(sqlite3_value*);
4357
+
4358
+ /*
4359
+ ** CAPI3REF: Copy And Free SQL Values
4360
+ ** METHOD: sqlite3_value
4361
+ **
4362
+ ** ^The sqlite3_value_dup(V) interface makes a copy of the [sqlite3_value]
4363
+ ** object D and returns a pointer to that copy. ^The [sqlite3_value] returned
4364
+ ** is a [protected sqlite3_value] object even if the input is not.
4365
+ ** ^The sqlite3_value_dup(V) interface returns NULL if V is NULL or if a
4366
+ ** memory allocation fails.
4367
+ **
4368
+ ** ^The sqlite3_value_free(V) interface frees an [sqlite3_value] object
4369
+ ** previously obtained from [sqlite3_value_dup()]. ^If V is a NULL pointer
4370
+ ** then sqlite3_value_free(V) is a harmless no-op.
4371
+ */
4372
+ SQLITE_API SQLITE_EXPERIMENTAL sqlite3_value *SQLITE_STDCALL sqlite3_value_dup(const sqlite3_value*);
4373
+ SQLITE_API SQLITE_EXPERIMENTAL void SQLITE_STDCALL sqlite3_value_free(sqlite3_value*);
4245
4374
 
4246
4375
  /*
4247
4376
  ** CAPI3REF: Obtain Aggregate Function Context
4377
+ ** METHOD: sqlite3_context
4248
4378
  **
4249
4379
  ** Implementations of aggregate SQL functions use this
4250
4380
  ** routine to allocate memory for storing their state.
@@ -4285,10 +4415,11 @@ SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);
4285
4415
  ** This routine must be called from the same thread in which
4286
4416
  ** the aggregate SQL function is running.
4287
4417
  */
4288
- SQLITE_API void *sqlite3_aggregate_context(sqlite3_context*, int nBytes);
4418
+ SQLITE_API void *SQLITE_STDCALL sqlite3_aggregate_context(sqlite3_context*, int nBytes);
4289
4419
 
4290
4420
  /*
4291
4421
  ** CAPI3REF: User Data For Functions
4422
+ ** METHOD: sqlite3_context
4292
4423
  **
4293
4424
  ** ^The sqlite3_user_data() interface returns a copy of
4294
4425
  ** the pointer that was the pUserData parameter (the 5th parameter)
@@ -4299,10 +4430,11 @@ SQLITE_API void *sqlite3_aggregate_context(sqlite3_context*, int nBytes);
4299
4430
  ** This routine must be called from the same thread in which
4300
4431
  ** the application-defined function is running.
4301
4432
  */
4302
- SQLITE_API void *sqlite3_user_data(sqlite3_context*);
4433
+ SQLITE_API void *SQLITE_STDCALL sqlite3_user_data(sqlite3_context*);
4303
4434
 
4304
4435
  /*
4305
4436
  ** CAPI3REF: Database Connection For Functions
4437
+ ** METHOD: sqlite3_context
4306
4438
  **
4307
4439
  ** ^The sqlite3_context_db_handle() interface returns a copy of
4308
4440
  ** the pointer to the [database connection] (the 1st parameter)
@@ -4310,10 +4442,11 @@ SQLITE_API void *sqlite3_user_data(sqlite3_context*);
4310
4442
  ** and [sqlite3_create_function16()] routines that originally
4311
4443
  ** registered the application defined function.
4312
4444
  */
4313
- SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*);
4445
+ SQLITE_API sqlite3 *SQLITE_STDCALL sqlite3_context_db_handle(sqlite3_context*);
4314
4446
 
4315
4447
  /*
4316
4448
  ** CAPI3REF: Function Auxiliary Data
4449
+ ** METHOD: sqlite3_context
4317
4450
  **
4318
4451
  ** These functions may be used by (non-aggregate) SQL functions to
4319
4452
  ** associate metadata with argument values. If the same value is passed to
@@ -4362,8 +4495,8 @@ SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*);
4362
4495
  ** These routines must be called from the same thread in which
4363
4496
  ** the SQL function is running.
4364
4497
  */
4365
- SQLITE_API void *sqlite3_get_auxdata(sqlite3_context*, int N);
4366
- SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*));
4498
+ SQLITE_API void *SQLITE_STDCALL sqlite3_get_auxdata(sqlite3_context*, int N);
4499
+ SQLITE_API void SQLITE_STDCALL sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*));
4367
4500
 
4368
4501
 
4369
4502
  /*
@@ -4386,6 +4519,7 @@ typedef void (*sqlite3_destructor_type)(void*);
4386
4519
 
4387
4520
  /*
4388
4521
  ** CAPI3REF: Setting The Result Of An SQL Function
4522
+ ** METHOD: sqlite3_context
4389
4523
  **
4390
4524
  ** These routines are used by the xFunc or xFinal callbacks that
4391
4525
  ** implement SQL functions and aggregates. See
@@ -4401,9 +4535,9 @@ typedef void (*sqlite3_destructor_type)(void*);
4401
4535
  ** to by the second parameter and which is N bytes long where N is the
4402
4536
  ** third parameter.
4403
4537
  **
4404
- ** ^The sqlite3_result_zeroblob() interfaces set the result of
4405
- ** the application-defined function to be a BLOB containing all zero
4406
- ** bytes and N bytes in size, where N is the value of the 2nd parameter.
4538
+ ** ^The sqlite3_result_zeroblob(C,N) and sqlite3_result_zeroblob64(C,N)
4539
+ ** interfaces set the result of the application-defined function to be
4540
+ ** a BLOB containing all zero bytes and N bytes in size.
4407
4541
  **
4408
4542
  ** ^The sqlite3_result_double() interface sets the result from
4409
4543
  ** an application-defined function to be a floating point value specified
@@ -4485,7 +4619,7 @@ typedef void (*sqlite3_destructor_type)(void*);
4485
4619
  ** from [sqlite3_malloc()] before it returns.
4486
4620
  **
4487
4621
  ** ^The sqlite3_result_value() interface sets the result of
4488
- ** the application-defined function to be a copy the
4622
+ ** the application-defined function to be a copy of the
4489
4623
  ** [unprotected sqlite3_value] object specified by the 2nd parameter. ^The
4490
4624
  ** sqlite3_result_value() interface makes a copy of the [sqlite3_value]
4491
4625
  ** so that the [sqlite3_value] specified in the parameter may change or
@@ -4498,28 +4632,31 @@ typedef void (*sqlite3_destructor_type)(void*);
4498
4632
  ** than the one containing the application-defined function that received
4499
4633
  ** the [sqlite3_context] pointer, the results are undefined.
4500
4634
  */
4501
- SQLITE_API void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));
4502
- SQLITE_API void sqlite3_result_blob64(sqlite3_context*,const void*,sqlite3_uint64,void(*)(void*));
4503
- SQLITE_API void sqlite3_result_double(sqlite3_context*, double);
4504
- SQLITE_API void sqlite3_result_error(sqlite3_context*, const char*, int);
4505
- SQLITE_API void sqlite3_result_error16(sqlite3_context*, const void*, int);
4506
- SQLITE_API void sqlite3_result_error_toobig(sqlite3_context*);
4507
- SQLITE_API void sqlite3_result_error_nomem(sqlite3_context*);
4508
- SQLITE_API void sqlite3_result_error_code(sqlite3_context*, int);
4509
- SQLITE_API void sqlite3_result_int(sqlite3_context*, int);
4510
- SQLITE_API void sqlite3_result_int64(sqlite3_context*, sqlite3_int64);
4511
- SQLITE_API void sqlite3_result_null(sqlite3_context*);
4512
- SQLITE_API void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*));
4513
- SQLITE_API void sqlite3_result_text64(sqlite3_context*, const char*,sqlite3_uint64,
4635
+ SQLITE_API void SQLITE_STDCALL sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));
4636
+ SQLITE_API void SQLITE_STDCALL sqlite3_result_blob64(sqlite3_context*,const void*,
4637
+ sqlite3_uint64,void(*)(void*));
4638
+ SQLITE_API void SQLITE_STDCALL sqlite3_result_double(sqlite3_context*, double);
4639
+ SQLITE_API void SQLITE_STDCALL sqlite3_result_error(sqlite3_context*, const char*, int);
4640
+ SQLITE_API void SQLITE_STDCALL sqlite3_result_error16(sqlite3_context*, const void*, int);
4641
+ SQLITE_API void SQLITE_STDCALL sqlite3_result_error_toobig(sqlite3_context*);
4642
+ SQLITE_API void SQLITE_STDCALL sqlite3_result_error_nomem(sqlite3_context*);
4643
+ SQLITE_API void SQLITE_STDCALL sqlite3_result_error_code(sqlite3_context*, int);
4644
+ SQLITE_API void SQLITE_STDCALL sqlite3_result_int(sqlite3_context*, int);
4645
+ SQLITE_API void SQLITE_STDCALL sqlite3_result_int64(sqlite3_context*, sqlite3_int64);
4646
+ SQLITE_API void SQLITE_STDCALL sqlite3_result_null(sqlite3_context*);
4647
+ SQLITE_API void SQLITE_STDCALL sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*));
4648
+ SQLITE_API void SQLITE_STDCALL sqlite3_result_text64(sqlite3_context*, const char*,sqlite3_uint64,
4514
4649
  void(*)(void*), unsigned char encoding);
4515
- SQLITE_API void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*));
4516
- SQLITE_API void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));
4517
- SQLITE_API void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*));
4518
- SQLITE_API void sqlite3_result_value(sqlite3_context*, sqlite3_value*);
4519
- SQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n);
4650
+ SQLITE_API void SQLITE_STDCALL sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*));
4651
+ SQLITE_API void SQLITE_STDCALL sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));
4652
+ SQLITE_API void SQLITE_STDCALL sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*));
4653
+ SQLITE_API void SQLITE_STDCALL sqlite3_result_value(sqlite3_context*, sqlite3_value*);
4654
+ SQLITE_API void SQLITE_STDCALL sqlite3_result_zeroblob(sqlite3_context*, int n);
4655
+ SQLITE_API int SQLITE_STDCALL sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n);
4520
4656
 
4521
4657
  /*
4522
4658
  ** CAPI3REF: Define New Collating Sequences
4659
+ ** METHOD: sqlite3
4523
4660
  **
4524
4661
  ** ^These functions add, remove, or modify a [collation] associated
4525
4662
  ** with the [database connection] specified as the first argument.
@@ -4597,14 +4734,14 @@ SQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n);
4597
4734
  **
4598
4735
  ** See also: [sqlite3_collation_needed()] and [sqlite3_collation_needed16()].
4599
4736
  */
4600
- SQLITE_API int sqlite3_create_collation(
4737
+ SQLITE_API int SQLITE_STDCALL sqlite3_create_collation(
4601
4738
  sqlite3*,
4602
4739
  const char *zName,
4603
4740
  int eTextRep,
4604
4741
  void *pArg,
4605
4742
  int(*xCompare)(void*,int,const void*,int,const void*)
4606
4743
  );
4607
- SQLITE_API int sqlite3_create_collation_v2(
4744
+ SQLITE_API int SQLITE_STDCALL sqlite3_create_collation_v2(
4608
4745
  sqlite3*,
4609
4746
  const char *zName,
4610
4747
  int eTextRep,
@@ -4612,7 +4749,7 @@ SQLITE_API int sqlite3_create_collation_v2(
4612
4749
  int(*xCompare)(void*,int,const void*,int,const void*),
4613
4750
  void(*xDestroy)(void*)
4614
4751
  );
4615
- SQLITE_API int sqlite3_create_collation16(
4752
+ SQLITE_API int SQLITE_STDCALL sqlite3_create_collation16(
4616
4753
  sqlite3*,
4617
4754
  const void *zName,
4618
4755
  int eTextRep,
@@ -4622,6 +4759,7 @@ SQLITE_API int sqlite3_create_collation16(
4622
4759
 
4623
4760
  /*
4624
4761
  ** CAPI3REF: Collation Needed Callbacks
4762
+ ** METHOD: sqlite3
4625
4763
  **
4626
4764
  ** ^To avoid having to register all collation sequences before a database
4627
4765
  ** can be used, a single callback function may be registered with the
@@ -4646,12 +4784,12 @@ SQLITE_API int sqlite3_create_collation16(
4646
4784
  ** [sqlite3_create_collation()], [sqlite3_create_collation16()], or
4647
4785
  ** [sqlite3_create_collation_v2()].
4648
4786
  */
4649
- SQLITE_API int sqlite3_collation_needed(
4787
+ SQLITE_API int SQLITE_STDCALL sqlite3_collation_needed(
4650
4788
  sqlite3*,
4651
4789
  void*,
4652
4790
  void(*)(void*,sqlite3*,int eTextRep,const char*)
4653
4791
  );
4654
- SQLITE_API int sqlite3_collation_needed16(
4792
+ SQLITE_API int SQLITE_STDCALL sqlite3_collation_needed16(
4655
4793
  sqlite3*,
4656
4794
  void*,
4657
4795
  void(*)(void*,sqlite3*,int eTextRep,const void*)
@@ -4665,11 +4803,11 @@ SQLITE_API int sqlite3_collation_needed16(
4665
4803
  ** The code to implement this API is not available in the public release
4666
4804
  ** of SQLite.
4667
4805
  */
4668
- SQLITE_API int sqlite3_key(
4806
+ SQLITE_API int SQLITE_STDCALL sqlite3_key(
4669
4807
  sqlite3 *db, /* Database to be rekeyed */
4670
4808
  const void *pKey, int nKey /* The key */
4671
4809
  );
4672
- SQLITE_API int sqlite3_key_v2(
4810
+ SQLITE_API int SQLITE_STDCALL sqlite3_key_v2(
4673
4811
  sqlite3 *db, /* Database to be rekeyed */
4674
4812
  const char *zDbName, /* Name of the database */
4675
4813
  const void *pKey, int nKey /* The key */
@@ -4683,11 +4821,11 @@ SQLITE_API int sqlite3_key_v2(
4683
4821
  ** The code to implement this API is not available in the public release
4684
4822
  ** of SQLite.
4685
4823
  */
4686
- SQLITE_API int sqlite3_rekey(
4824
+ SQLITE_API int SQLITE_STDCALL sqlite3_rekey(
4687
4825
  sqlite3 *db, /* Database to be rekeyed */
4688
4826
  const void *pKey, int nKey /* The new key */
4689
4827
  );
4690
- SQLITE_API int sqlite3_rekey_v2(
4828
+ SQLITE_API int SQLITE_STDCALL sqlite3_rekey_v2(
4691
4829
  sqlite3 *db, /* Database to be rekeyed */
4692
4830
  const char *zDbName, /* Name of the database */
4693
4831
  const void *pKey, int nKey /* The new key */
@@ -4697,7 +4835,7 @@ SQLITE_API int sqlite3_rekey_v2(
4697
4835
  ** Specify the activation key for a SEE database. Unless
4698
4836
  ** activated, none of the SEE routines will work.
4699
4837
  */
4700
- SQLITE_API void sqlite3_activate_see(
4838
+ SQLITE_API void SQLITE_STDCALL sqlite3_activate_see(
4701
4839
  const char *zPassPhrase /* Activation phrase */
4702
4840
  );
4703
4841
  #endif
@@ -4707,7 +4845,7 @@ SQLITE_API void sqlite3_activate_see(
4707
4845
  ** Specify the activation key for a CEROD database. Unless
4708
4846
  ** activated, none of the CEROD routines will work.
4709
4847
  */
4710
- SQLITE_API void sqlite3_activate_cerod(
4848
+ SQLITE_API void SQLITE_STDCALL sqlite3_activate_cerod(
4711
4849
  const char *zPassPhrase /* Activation phrase */
4712
4850
  );
4713
4851
  #endif
@@ -4729,7 +4867,7 @@ SQLITE_API void sqlite3_activate_cerod(
4729
4867
  ** all, then the behavior of sqlite3_sleep() may deviate from the description
4730
4868
  ** in the previous paragraphs.
4731
4869
  */
4732
- SQLITE_API int sqlite3_sleep(int);
4870
+ SQLITE_API int SQLITE_STDCALL sqlite3_sleep(int);
4733
4871
 
4734
4872
  /*
4735
4873
  ** CAPI3REF: Name Of The Folder Holding Temporary Files
@@ -4829,6 +4967,7 @@ SQLITE_API SQLITE_EXTERN char *sqlite3_data_directory;
4829
4967
  /*
4830
4968
  ** CAPI3REF: Test For Auto-Commit Mode
4831
4969
  ** KEYWORDS: {autocommit mode}
4970
+ ** METHOD: sqlite3
4832
4971
  **
4833
4972
  ** ^The sqlite3_get_autocommit() interface returns non-zero or
4834
4973
  ** zero if the given database connection is or is not in autocommit mode,
@@ -4847,10 +4986,11 @@ SQLITE_API SQLITE_EXTERN char *sqlite3_data_directory;
4847
4986
  ** connection while this routine is running, then the return value
4848
4987
  ** is undefined.
4849
4988
  */
4850
- SQLITE_API int sqlite3_get_autocommit(sqlite3*);
4989
+ SQLITE_API int SQLITE_STDCALL sqlite3_get_autocommit(sqlite3*);
4851
4990
 
4852
4991
  /*
4853
4992
  ** CAPI3REF: Find The Database Handle Of A Prepared Statement
4993
+ ** METHOD: sqlite3_stmt
4854
4994
  **
4855
4995
  ** ^The sqlite3_db_handle interface returns the [database connection] handle
4856
4996
  ** to which a [prepared statement] belongs. ^The [database connection]
@@ -4859,10 +4999,11 @@ SQLITE_API int sqlite3_get_autocommit(sqlite3*);
4859
4999
  ** to the [sqlite3_prepare_v2()] call (or its variants) that was used to
4860
5000
  ** create the statement in the first place.
4861
5001
  */
4862
- SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*);
5002
+ SQLITE_API sqlite3 *SQLITE_STDCALL sqlite3_db_handle(sqlite3_stmt*);
4863
5003
 
4864
5004
  /*
4865
5005
  ** CAPI3REF: Return The Filename For A Database Connection
5006
+ ** METHOD: sqlite3
4866
5007
  **
4867
5008
  ** ^The sqlite3_db_filename(D,N) interface returns a pointer to a filename
4868
5009
  ** associated with database N of connection D. ^The main database file
@@ -4875,19 +5016,21 @@ SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*);
4875
5016
  ** will be an absolute pathname, even if the filename used
4876
5017
  ** to open the database originally was a URI or relative pathname.
4877
5018
  */
4878
- SQLITE_API const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName);
5019
+ SQLITE_API const char *SQLITE_STDCALL sqlite3_db_filename(sqlite3 *db, const char *zDbName);
4879
5020
 
4880
5021
  /*
4881
5022
  ** CAPI3REF: Determine if a database is read-only
5023
+ ** METHOD: sqlite3
4882
5024
  **
4883
5025
  ** ^The sqlite3_db_readonly(D,N) interface returns 1 if the database N
4884
5026
  ** of connection D is read-only, 0 if it is read/write, or -1 if N is not
4885
5027
  ** the name of a database on connection D.
4886
5028
  */
4887
- SQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName);
5029
+ SQLITE_API int SQLITE_STDCALL sqlite3_db_readonly(sqlite3 *db, const char *zDbName);
4888
5030
 
4889
5031
  /*
4890
5032
  ** CAPI3REF: Find the next prepared statement
5033
+ ** METHOD: sqlite3
4891
5034
  **
4892
5035
  ** ^This interface returns a pointer to the next [prepared statement] after
4893
5036
  ** pStmt associated with the [database connection] pDb. ^If pStmt is NULL
@@ -4899,10 +5042,11 @@ SQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName);
4899
5042
  ** [sqlite3_next_stmt(D,S)] must refer to an open database
4900
5043
  ** connection and in particular must not be a NULL pointer.
4901
5044
  */
4902
- SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt);
5045
+ SQLITE_API sqlite3_stmt *SQLITE_STDCALL sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt);
4903
5046
 
4904
5047
  /*
4905
5048
  ** CAPI3REF: Commit And Rollback Notification Callbacks
5049
+ ** METHOD: sqlite3
4906
5050
  **
4907
5051
  ** ^The sqlite3_commit_hook() interface registers a callback
4908
5052
  ** function to be invoked whenever a transaction is [COMMIT | committed].
@@ -4947,11 +5091,12 @@ SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt);
4947
5091
  **
4948
5092
  ** See also the [sqlite3_update_hook()] interface.
4949
5093
  */
4950
- SQLITE_API void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*);
4951
- SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
5094
+ SQLITE_API void *SQLITE_STDCALL sqlite3_commit_hook(sqlite3*, int(*)(void*), void*);
5095
+ SQLITE_API void *SQLITE_STDCALL sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
4952
5096
 
4953
5097
  /*
4954
5098
  ** CAPI3REF: Data Change Notification Callbacks
5099
+ ** METHOD: sqlite3
4955
5100
  **
4956
5101
  ** ^The sqlite3_update_hook() interface registers a callback function
4957
5102
  ** with the [database connection] identified by the first argument
@@ -4998,7 +5143,7 @@ SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
4998
5143
  ** See also the [sqlite3_commit_hook()] and [sqlite3_rollback_hook()]
4999
5144
  ** interfaces.
5000
5145
  */
5001
- SQLITE_API void *sqlite3_update_hook(
5146
+ SQLITE_API void *SQLITE_STDCALL sqlite3_update_hook(
5002
5147
  sqlite3*,
5003
5148
  void(*)(void *,int ,char const *,char const *,sqlite3_int64),
5004
5149
  void*
@@ -5028,12 +5173,17 @@ SQLITE_API void *sqlite3_update_hook(
5028
5173
  ** future releases of SQLite. Applications that care about shared
5029
5174
  ** cache setting should set it explicitly.
5030
5175
  **
5176
+ ** Note: This method is disabled on MacOS X 10.7 and iOS version 5.0
5177
+ ** and will always return SQLITE_MISUSE. On those systems,
5178
+ ** shared cache mode should be enabled per-database connection via
5179
+ ** [sqlite3_open_v2()] with [SQLITE_OPEN_SHAREDCACHE].
5180
+ **
5031
5181
  ** This interface is threadsafe on processors where writing a
5032
5182
  ** 32-bit integer is atomic.
5033
5183
  **
5034
5184
  ** See Also: [SQLite Shared-Cache Mode]
5035
5185
  */
5036
- SQLITE_API int sqlite3_enable_shared_cache(int);
5186
+ SQLITE_API int SQLITE_STDCALL sqlite3_enable_shared_cache(int);
5037
5187
 
5038
5188
  /*
5039
5189
  ** CAPI3REF: Attempt To Free Heap Memory
@@ -5049,10 +5199,11 @@ SQLITE_API int sqlite3_enable_shared_cache(int);
5049
5199
  **
5050
5200
  ** See also: [sqlite3_db_release_memory()]
5051
5201
  */
5052
- SQLITE_API int sqlite3_release_memory(int);
5202
+ SQLITE_API int SQLITE_STDCALL sqlite3_release_memory(int);
5053
5203
 
5054
5204
  /*
5055
5205
  ** CAPI3REF: Free Memory Used By A Database Connection
5206
+ ** METHOD: sqlite3
5056
5207
  **
5057
5208
  ** ^The sqlite3_db_release_memory(D) interface attempts to free as much heap
5058
5209
  ** memory as possible from database connection D. Unlike the
@@ -5062,7 +5213,7 @@ SQLITE_API int sqlite3_release_memory(int);
5062
5213
  **
5063
5214
  ** See also: [sqlite3_release_memory()]
5064
5215
  */
5065
- SQLITE_API int sqlite3_db_release_memory(sqlite3*);
5216
+ SQLITE_API int SQLITE_STDCALL sqlite3_db_release_memory(sqlite3*);
5066
5217
 
5067
5218
  /*
5068
5219
  ** CAPI3REF: Impose A Limit On Heap Size
@@ -5114,7 +5265,7 @@ SQLITE_API int sqlite3_db_release_memory(sqlite3*);
5114
5265
  ** The circumstances under which SQLite will enforce the soft heap limit may
5115
5266
  ** changes in future releases of SQLite.
5116
5267
  */
5117
- SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N);
5268
+ SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_soft_heap_limit64(sqlite3_int64 N);
5118
5269
 
5119
5270
  /*
5120
5271
  ** CAPI3REF: Deprecated Soft Heap Limit Interface
@@ -5125,26 +5276,34 @@ SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N);
5125
5276
  ** only. All new applications should use the
5126
5277
  ** [sqlite3_soft_heap_limit64()] interface rather than this one.
5127
5278
  */
5128
- SQLITE_API SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N);
5279
+ SQLITE_API SQLITE_DEPRECATED void SQLITE_STDCALL sqlite3_soft_heap_limit(int N);
5129
5280
 
5130
5281
 
5131
5282
  /*
5132
5283
  ** CAPI3REF: Extract Metadata About A Column Of A Table
5133
- **
5134
- ** ^This routine returns metadata about a specific column of a specific
5135
- ** database table accessible using the [database connection] handle
5136
- ** passed as the first function argument.
5284
+ ** METHOD: sqlite3
5285
+ **
5286
+ ** ^(The sqlite3_table_column_metadata(X,D,T,C,....) routine returns
5287
+ ** information about column C of table T in database D
5288
+ ** on [database connection] X.)^ ^The sqlite3_table_column_metadata()
5289
+ ** interface returns SQLITE_OK and fills in the non-NULL pointers in
5290
+ ** the final five arguments with appropriate values if the specified
5291
+ ** column exists. ^The sqlite3_table_column_metadata() interface returns
5292
+ ** SQLITE_ERROR and if the specified column does not exist.
5293
+ ** ^If the column-name parameter to sqlite3_table_column_metadata() is a
5294
+ ** NULL pointer, then this routine simply checks for the existance of the
5295
+ ** table and returns SQLITE_OK if the table exists and SQLITE_ERROR if it
5296
+ ** does not.
5137
5297
  **
5138
5298
  ** ^The column is identified by the second, third and fourth parameters to
5139
- ** this function. ^The second parameter is either the name of the database
5299
+ ** this function. ^(The second parameter is either the name of the database
5140
5300
  ** (i.e. "main", "temp", or an attached database) containing the specified
5141
- ** table or NULL. ^If it is NULL, then all attached databases are searched
5301
+ ** table or NULL.)^ ^If it is NULL, then all attached databases are searched
5142
5302
  ** for the table using the same algorithm used by the database engine to
5143
5303
  ** resolve unqualified table references.
5144
5304
  **
5145
5305
  ** ^The third and fourth parameters to this function are the table and column
5146
- ** name of the desired column, respectively. Neither of these parameters
5147
- ** may be NULL.
5306
+ ** name of the desired column, respectively.
5148
5307
  **
5149
5308
  ** ^Metadata is returned by writing to the memory locations passed as the 5th
5150
5309
  ** and subsequent parameters to this function. ^Any of these arguments may be
@@ -5163,16 +5322,17 @@ SQLITE_API SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N);
5163
5322
  ** </blockquote>)^
5164
5323
  **
5165
5324
  ** ^The memory pointed to by the character pointers returned for the
5166
- ** declaration type and collation sequence is valid only until the next
5325
+ ** declaration type and collation sequence is valid until the next
5167
5326
  ** call to any SQLite API function.
5168
5327
  **
5169
5328
  ** ^If the specified table is actually a view, an [error code] is returned.
5170
5329
  **
5171
- ** ^If the specified column is "rowid", "oid" or "_rowid_" and an
5330
+ ** ^If the specified column is "rowid", "oid" or "_rowid_" and the table
5331
+ ** is not a [WITHOUT ROWID] table and an
5172
5332
  ** [INTEGER PRIMARY KEY] column has been explicitly declared, then the output
5173
5333
  ** parameters are set for the explicitly declared column. ^(If there is no
5174
- ** explicitly declared [INTEGER PRIMARY KEY] column, then the output
5175
- ** parameters are set as follows:
5334
+ ** [INTEGER PRIMARY KEY] column, then the outputs
5335
+ ** for the [rowid] are set as follows:
5176
5336
  **
5177
5337
  ** <pre>
5178
5338
  ** data type: "INTEGER"
@@ -5182,15 +5342,11 @@ SQLITE_API SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N);
5182
5342
  ** auto increment: 0
5183
5343
  ** </pre>)^
5184
5344
  **
5185
- ** ^(This function may load one or more schemas from database files. If an
5186
- ** error occurs during this process, or if the requested table or column
5187
- ** cannot be found, an [error code] is returned and an error message left
5188
- ** in the [database connection] (to be retrieved using sqlite3_errmsg()).)^
5189
- **
5190
- ** ^This API is only available if the library was compiled with the
5191
- ** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol defined.
5345
+ ** ^This function causes all database schemas to be read from disk and
5346
+ ** parsed, if that has not already been done, and returns an error if
5347
+ ** any errors are encountered while loading the schema.
5192
5348
  */
5193
- SQLITE_API int sqlite3_table_column_metadata(
5349
+ SQLITE_API int SQLITE_STDCALL sqlite3_table_column_metadata(
5194
5350
  sqlite3 *db, /* Connection handle */
5195
5351
  const char *zDbName, /* Database name or NULL */
5196
5352
  const char *zTableName, /* Table name */
@@ -5204,6 +5360,7 @@ SQLITE_API int sqlite3_table_column_metadata(
5204
5360
 
5205
5361
  /*
5206
5362
  ** CAPI3REF: Load An Extension
5363
+ ** METHOD: sqlite3
5207
5364
  **
5208
5365
  ** ^This interface loads an SQLite extension library from the named file.
5209
5366
  **
@@ -5236,7 +5393,7 @@ SQLITE_API int sqlite3_table_column_metadata(
5236
5393
  **
5237
5394
  ** See also the [load_extension() SQL function].
5238
5395
  */
5239
- SQLITE_API int sqlite3_load_extension(
5396
+ SQLITE_API int SQLITE_STDCALL sqlite3_load_extension(
5240
5397
  sqlite3 *db, /* Load the extension into this database connection */
5241
5398
  const char *zFile, /* Name of the shared library containing extension */
5242
5399
  const char *zProc, /* Entry point. Derived from zFile if 0 */
@@ -5245,6 +5402,7 @@ SQLITE_API int sqlite3_load_extension(
5245
5402
 
5246
5403
  /*
5247
5404
  ** CAPI3REF: Enable Or Disable Extension Loading
5405
+ ** METHOD: sqlite3
5248
5406
  **
5249
5407
  ** ^So as not to open security holes in older applications that are
5250
5408
  ** unprepared to deal with [extension loading], and as a means of disabling
@@ -5256,7 +5414,7 @@ SQLITE_API int sqlite3_load_extension(
5256
5414
  ** to turn extension loading on and call it with onoff==0 to turn
5257
5415
  ** it back off again.
5258
5416
  */
5259
- SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff);
5417
+ SQLITE_API int SQLITE_STDCALL sqlite3_enable_load_extension(sqlite3 *db, int onoff);
5260
5418
 
5261
5419
  /*
5262
5420
  ** CAPI3REF: Automatically Load Statically Linked Extensions
@@ -5294,7 +5452,7 @@ SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff);
5294
5452
  ** See also: [sqlite3_reset_auto_extension()]
5295
5453
  ** and [sqlite3_cancel_auto_extension()]
5296
5454
  */
5297
- SQLITE_API int sqlite3_auto_extension(void (*xEntryPoint)(void));
5455
+ SQLITE_API int SQLITE_STDCALL sqlite3_auto_extension(void (*xEntryPoint)(void));
5298
5456
 
5299
5457
  /*
5300
5458
  ** CAPI3REF: Cancel Automatic Extension Loading
@@ -5306,7 +5464,7 @@ SQLITE_API int sqlite3_auto_extension(void (*xEntryPoint)(void));
5306
5464
  ** unregistered and it returns 0 if X was not on the list of initialization
5307
5465
  ** routines.
5308
5466
  */
5309
- SQLITE_API int sqlite3_cancel_auto_extension(void (*xEntryPoint)(void));
5467
+ SQLITE_API int SQLITE_STDCALL sqlite3_cancel_auto_extension(void (*xEntryPoint)(void));
5310
5468
 
5311
5469
  /*
5312
5470
  ** CAPI3REF: Reset Automatic Extension Loading
@@ -5314,7 +5472,7 @@ SQLITE_API int sqlite3_cancel_auto_extension(void (*xEntryPoint)(void));
5314
5472
  ** ^This interface disables all automatic extensions previously
5315
5473
  ** registered using [sqlite3_auto_extension()].
5316
5474
  */
5317
- SQLITE_API void sqlite3_reset_auto_extension(void);
5475
+ SQLITE_API void SQLITE_STDCALL sqlite3_reset_auto_extension(void);
5318
5476
 
5319
5477
  /*
5320
5478
  ** The interface to the virtual-table mechanism is currently considered
@@ -5494,6 +5652,7 @@ struct sqlite3_index_info {
5494
5652
 
5495
5653
  /*
5496
5654
  ** CAPI3REF: Register A Virtual Table Implementation
5655
+ ** METHOD: sqlite3
5497
5656
  **
5498
5657
  ** ^These routines are used to register a new [virtual table module] name.
5499
5658
  ** ^Module names must be registered before
@@ -5517,13 +5676,13 @@ struct sqlite3_index_info {
5517
5676
  ** interface is equivalent to sqlite3_create_module_v2() with a NULL
5518
5677
  ** destructor.
5519
5678
  */
5520
- SQLITE_API int sqlite3_create_module(
5679
+ SQLITE_API int SQLITE_STDCALL sqlite3_create_module(
5521
5680
  sqlite3 *db, /* SQLite connection to register module with */
5522
5681
  const char *zName, /* Name of the module */
5523
5682
  const sqlite3_module *p, /* Methods for the module */
5524
5683
  void *pClientData /* Client data for xCreate/xConnect */
5525
5684
  );
5526
- SQLITE_API int sqlite3_create_module_v2(
5685
+ SQLITE_API int SQLITE_STDCALL sqlite3_create_module_v2(
5527
5686
  sqlite3 *db, /* SQLite connection to register module with */
5528
5687
  const char *zName, /* Name of the module */
5529
5688
  const sqlite3_module *p, /* Methods for the module */
@@ -5551,7 +5710,7 @@ SQLITE_API int sqlite3_create_module_v2(
5551
5710
  */
5552
5711
  struct sqlite3_vtab {
5553
5712
  const sqlite3_module *pModule; /* The module for this virtual table */
5554
- int nRef; /* NO LONGER USED */
5713
+ int nRef; /* Number of open cursors */
5555
5714
  char *zErrMsg; /* Error message from sqlite3_mprintf() */
5556
5715
  /* Virtual table implementations will typically add additional fields */
5557
5716
  };
@@ -5586,10 +5745,11 @@ struct sqlite3_vtab_cursor {
5586
5745
  ** to declare the format (the names and datatypes of the columns) of
5587
5746
  ** the virtual tables they implement.
5588
5747
  */
5589
- SQLITE_API int sqlite3_declare_vtab(sqlite3*, const char *zSQL);
5748
+ SQLITE_API int SQLITE_STDCALL sqlite3_declare_vtab(sqlite3*, const char *zSQL);
5590
5749
 
5591
5750
  /*
5592
5751
  ** CAPI3REF: Overload A Function For A Virtual Table
5752
+ ** METHOD: sqlite3
5593
5753
  **
5594
5754
  ** ^(Virtual tables can provide alternative implementations of functions
5595
5755
  ** using the [xFindFunction] method of the [virtual table module].
@@ -5604,7 +5764,7 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3*, const char *zSQL);
5604
5764
  ** purpose is to be a placeholder function that can be overloaded
5605
5765
  ** by a [virtual table].
5606
5766
  */
5607
- SQLITE_API int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg);
5767
+ SQLITE_API int SQLITE_STDCALL sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg);
5608
5768
 
5609
5769
  /*
5610
5770
  ** The interface to the virtual-table mechanism defined above (back up
@@ -5632,6 +5792,8 @@ typedef struct sqlite3_blob sqlite3_blob;
5632
5792
 
5633
5793
  /*
5634
5794
  ** CAPI3REF: Open A BLOB For Incremental I/O
5795
+ ** METHOD: sqlite3
5796
+ ** CONSTRUCTOR: sqlite3_blob
5635
5797
  **
5636
5798
  ** ^(This interfaces opens a [BLOB handle | handle] to the BLOB located
5637
5799
  ** in row iRow, column zColumn, table zTable in database zDb;
@@ -5641,26 +5803,42 @@ typedef struct sqlite3_blob sqlite3_blob;
5641
5803
  ** SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;
5642
5804
  ** </pre>)^
5643
5805
  **
5806
+ ** ^(Parameter zDb is not the filename that contains the database, but
5807
+ ** rather the symbolic name of the database. For attached databases, this is
5808
+ ** the name that appears after the AS keyword in the [ATTACH] statement.
5809
+ ** For the main database file, the database name is "main". For TEMP
5810
+ ** tables, the database name is "temp".)^
5811
+ **
5644
5812
  ** ^If the flags parameter is non-zero, then the BLOB is opened for read
5645
- ** and write access. ^If it is zero, the BLOB is opened for read access.
5646
- ** ^It is not possible to open a column that is part of an index or primary
5647
- ** key for writing. ^If [foreign key constraints] are enabled, it is
5648
- ** not possible to open a column that is part of a [child key] for writing.
5649
- **
5650
- ** ^Note that the database name is not the filename that contains
5651
- ** the database but rather the symbolic name of the database that
5652
- ** appears after the AS keyword when the database is connected using [ATTACH].
5653
- ** ^For the main database file, the database name is "main".
5654
- ** ^For TEMP tables, the database name is "temp".
5655
- **
5656
- ** ^(On success, [SQLITE_OK] is returned and the new [BLOB handle] is written
5657
- ** to *ppBlob. Otherwise an [error code] is returned and *ppBlob is set
5658
- ** to be a null pointer.)^
5659
- ** ^This function sets the [database connection] error code and message
5660
- ** accessible via [sqlite3_errcode()] and [sqlite3_errmsg()] and related
5661
- ** functions. ^Note that the *ppBlob variable is always initialized in a
5662
- ** way that makes it safe to invoke [sqlite3_blob_close()] on *ppBlob
5663
- ** regardless of the success or failure of this routine.
5813
+ ** and write access. ^If the flags parameter is zero, the BLOB is opened for
5814
+ ** read-only access.
5815
+ **
5816
+ ** ^(On success, [SQLITE_OK] is returned and the new [BLOB handle] is stored
5817
+ ** in *ppBlob. Otherwise an [error code] is returned and, unless the error
5818
+ ** code is SQLITE_MISUSE, *ppBlob is set to NULL.)^ ^This means that, provided
5819
+ ** the API is not misused, it is always safe to call [sqlite3_blob_close()]
5820
+ ** on *ppBlob after this function it returns.
5821
+ **
5822
+ ** This function fails with SQLITE_ERROR if any of the following are true:
5823
+ ** <ul>
5824
+ ** <li> ^(Database zDb does not exist)^,
5825
+ ** <li> ^(Table zTable does not exist within database zDb)^,
5826
+ ** <li> ^(Table zTable is a WITHOUT ROWID table)^,
5827
+ ** <li> ^(Column zColumn does not exist)^,
5828
+ ** <li> ^(Row iRow is not present in the table)^,
5829
+ ** <li> ^(The specified column of row iRow contains a value that is not
5830
+ ** a TEXT or BLOB value)^,
5831
+ ** <li> ^(Column zColumn is part of an index, PRIMARY KEY or UNIQUE
5832
+ ** constraint and the blob is being opened for read/write access)^,
5833
+ ** <li> ^([foreign key constraints | Foreign key constraints] are enabled,
5834
+ ** column zColumn is part of a [child key] definition and the blob is
5835
+ ** being opened for read/write access)^.
5836
+ ** </ul>
5837
+ **
5838
+ ** ^Unless it returns SQLITE_MISUSE, this function sets the
5839
+ ** [database connection] error code and message accessible via
5840
+ ** [sqlite3_errcode()] and [sqlite3_errmsg()] and related functions.
5841
+ **
5664
5842
  **
5665
5843
  ** ^(If the row that a BLOB handle points to is modified by an
5666
5844
  ** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects
@@ -5678,18 +5856,14 @@ typedef struct sqlite3_blob sqlite3_blob;
5678
5856
  ** interface. Use the [UPDATE] SQL command to change the size of a
5679
5857
  ** blob.
5680
5858
  **
5681
- ** ^The [sqlite3_blob_open()] interface will fail for a [WITHOUT ROWID]
5682
- ** table. Incremental BLOB I/O is not possible on [WITHOUT ROWID] tables.
5683
- **
5684
5859
  ** ^The [sqlite3_bind_zeroblob()] and [sqlite3_result_zeroblob()] interfaces
5685
- ** and the built-in [zeroblob] SQL function can be used, if desired,
5686
- ** to create an empty, zero-filled blob in which to read or write using
5687
- ** this interface.
5860
+ ** and the built-in [zeroblob] SQL function may be used to create a
5861
+ ** zero-filled blob to read or write using the incremental-blob interface.
5688
5862
  **
5689
5863
  ** To avoid a resource leak, every open [BLOB handle] should eventually
5690
5864
  ** be released by a call to [sqlite3_blob_close()].
5691
5865
  */
5692
- SQLITE_API int sqlite3_blob_open(
5866
+ SQLITE_API int SQLITE_STDCALL sqlite3_blob_open(
5693
5867
  sqlite3*,
5694
5868
  const char *zDb,
5695
5869
  const char *zTable,
@@ -5701,6 +5875,7 @@ SQLITE_API int sqlite3_blob_open(
5701
5875
 
5702
5876
  /*
5703
5877
  ** CAPI3REF: Move a BLOB Handle to a New Row
5878
+ ** METHOD: sqlite3_blob
5704
5879
  **
5705
5880
  ** ^This function is used to move an existing blob handle so that it points
5706
5881
  ** to a different row of the same database table. ^The new row is identified
@@ -5721,34 +5896,34 @@ SQLITE_API int sqlite3_blob_open(
5721
5896
  **
5722
5897
  ** ^This function sets the database handle error code and message.
5723
5898
  */
5724
- SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64);
5899
+ SQLITE_API int SQLITE_STDCALL sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64);
5725
5900
 
5726
5901
  /*
5727
5902
  ** CAPI3REF: Close A BLOB Handle
5903
+ ** DESTRUCTOR: sqlite3_blob
5728
5904
  **
5729
- ** ^Closes an open [BLOB handle].
5730
- **
5731
- ** ^Closing a BLOB shall cause the current transaction to commit
5732
- ** if there are no other BLOBs, no pending prepared statements, and the
5733
- ** database connection is in [autocommit mode].
5734
- ** ^If any writes were made to the BLOB, they might be held in cache
5735
- ** until the close operation if they will fit.
5905
+ ** ^This function closes an open [BLOB handle]. ^(The BLOB handle is closed
5906
+ ** unconditionally. Even if this routine returns an error code, the
5907
+ ** handle is still closed.)^
5736
5908
  **
5737
- ** ^(Closing the BLOB often forces the changes
5738
- ** out to disk and so if any I/O errors occur, they will likely occur
5739
- ** at the time when the BLOB is closed. Any errors that occur during
5740
- ** closing are reported as a non-zero return value.)^
5909
+ ** ^If the blob handle being closed was opened for read-write access, and if
5910
+ ** the database is in auto-commit mode and there are no other open read-write
5911
+ ** blob handles or active write statements, the current transaction is
5912
+ ** committed. ^If an error occurs while committing the transaction, an error
5913
+ ** code is returned and the transaction rolled back.
5741
5914
  **
5742
- ** ^(The BLOB is closed unconditionally. Even if this routine returns
5743
- ** an error code, the BLOB is still closed.)^
5744
- **
5745
- ** ^Calling this routine with a null pointer (such as would be returned
5746
- ** by a failed call to [sqlite3_blob_open()]) is a harmless no-op.
5915
+ ** Calling this function with an argument that is not a NULL pointer or an
5916
+ ** open blob handle results in undefined behaviour. ^Calling this routine
5917
+ ** with a null pointer (such as would be returned by a failed call to
5918
+ ** [sqlite3_blob_open()]) is a harmless no-op. ^Otherwise, if this function
5919
+ ** is passed a valid open blob handle, the values returned by the
5920
+ ** sqlite3_errcode() and sqlite3_errmsg() functions are set before returning.
5747
5921
  */
5748
- SQLITE_API int sqlite3_blob_close(sqlite3_blob *);
5922
+ SQLITE_API int SQLITE_STDCALL sqlite3_blob_close(sqlite3_blob *);
5749
5923
 
5750
5924
  /*
5751
5925
  ** CAPI3REF: Return The Size Of An Open BLOB
5926
+ ** METHOD: sqlite3_blob
5752
5927
  **
5753
5928
  ** ^Returns the size in bytes of the BLOB accessible via the
5754
5929
  ** successfully opened [BLOB handle] in its only argument. ^The
@@ -5760,10 +5935,11 @@ SQLITE_API int sqlite3_blob_close(sqlite3_blob *);
5760
5935
  ** been closed by [sqlite3_blob_close()]. Passing any other pointer in
5761
5936
  ** to this routine results in undefined and probably undesirable behavior.
5762
5937
  */
5763
- SQLITE_API int sqlite3_blob_bytes(sqlite3_blob *);
5938
+ SQLITE_API int SQLITE_STDCALL sqlite3_blob_bytes(sqlite3_blob *);
5764
5939
 
5765
5940
  /*
5766
5941
  ** CAPI3REF: Read Data From A BLOB Incrementally
5942
+ ** METHOD: sqlite3_blob
5767
5943
  **
5768
5944
  ** ^(This function is used to read data from an open [BLOB handle] into a
5769
5945
  ** caller-supplied buffer. N bytes of data are copied into buffer Z
@@ -5788,26 +5964,33 @@ SQLITE_API int sqlite3_blob_bytes(sqlite3_blob *);
5788
5964
  **
5789
5965
  ** See also: [sqlite3_blob_write()].
5790
5966
  */
5791
- SQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
5967
+ SQLITE_API int SQLITE_STDCALL sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
5792
5968
 
5793
5969
  /*
5794
5970
  ** CAPI3REF: Write Data Into A BLOB Incrementally
5971
+ ** METHOD: sqlite3_blob
5795
5972
  **
5796
- ** ^This function is used to write data into an open [BLOB handle] from a
5797
- ** caller-supplied buffer. ^N bytes of data are copied from the buffer Z
5798
- ** into the open BLOB, starting at offset iOffset.
5973
+ ** ^(This function is used to write data into an open [BLOB handle] from a
5974
+ ** caller-supplied buffer. N bytes of data are copied from the buffer Z
5975
+ ** into the open BLOB, starting at offset iOffset.)^
5976
+ **
5977
+ ** ^(On success, sqlite3_blob_write() returns SQLITE_OK.
5978
+ ** Otherwise, an [error code] or an [extended error code] is returned.)^
5979
+ ** ^Unless SQLITE_MISUSE is returned, this function sets the
5980
+ ** [database connection] error code and message accessible via
5981
+ ** [sqlite3_errcode()] and [sqlite3_errmsg()] and related functions.
5799
5982
  **
5800
5983
  ** ^If the [BLOB handle] passed as the first argument was not opened for
5801
5984
  ** writing (the flags parameter to [sqlite3_blob_open()] was zero),
5802
5985
  ** this function returns [SQLITE_READONLY].
5803
5986
  **
5804
- ** ^This function may only modify the contents of the BLOB; it is
5987
+ ** This function may only modify the contents of the BLOB; it is
5805
5988
  ** not possible to increase the size of a BLOB using this API.
5806
5989
  ** ^If offset iOffset is less than N bytes from the end of the BLOB,
5807
- ** [SQLITE_ERROR] is returned and no data is written. ^If N is
5808
- ** less than zero [SQLITE_ERROR] is returned and no data is written.
5809
- ** The size of the BLOB (and hence the maximum value of N+iOffset)
5810
- ** can be determined using the [sqlite3_blob_bytes()] interface.
5990
+ ** [SQLITE_ERROR] is returned and no data is written. The size of the
5991
+ ** BLOB (and hence the maximum value of N+iOffset) can be determined
5992
+ ** using the [sqlite3_blob_bytes()] interface. ^If N or iOffset are less
5993
+ ** than zero [SQLITE_ERROR] is returned and no data is written.
5811
5994
  **
5812
5995
  ** ^An attempt to write to an expired [BLOB handle] fails with an
5813
5996
  ** error code of [SQLITE_ABORT]. ^Writes to the BLOB that occurred
@@ -5816,9 +5999,6 @@ SQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
5816
5999
  ** have been overwritten by the statement that expired the BLOB handle
5817
6000
  ** or by other independent statements.
5818
6001
  **
5819
- ** ^(On success, sqlite3_blob_write() returns SQLITE_OK.
5820
- ** Otherwise, an [error code] or an [extended error code] is returned.)^
5821
- **
5822
6002
  ** This routine only works on a [BLOB handle] which has been created
5823
6003
  ** by a prior successful call to [sqlite3_blob_open()] and which has not
5824
6004
  ** been closed by [sqlite3_blob_close()]. Passing any other pointer in
@@ -5826,7 +6006,7 @@ SQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
5826
6006
  **
5827
6007
  ** See also: [sqlite3_blob_read()].
5828
6008
  */
5829
- SQLITE_API int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset);
6009
+ SQLITE_API int SQLITE_STDCALL sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset);
5830
6010
 
5831
6011
  /*
5832
6012
  ** CAPI3REF: Virtual File System Objects
@@ -5857,9 +6037,9 @@ SQLITE_API int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOff
5857
6037
  ** ^(If the default VFS is unregistered, another VFS is chosen as
5858
6038
  ** the default. The choice for the new VFS is arbitrary.)^
5859
6039
  */
5860
- SQLITE_API sqlite3_vfs *sqlite3_vfs_find(const char *zVfsName);
5861
- SQLITE_API int sqlite3_vfs_register(sqlite3_vfs*, int makeDflt);
5862
- SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
6040
+ SQLITE_API sqlite3_vfs *SQLITE_STDCALL sqlite3_vfs_find(const char *zVfsName);
6041
+ SQLITE_API int SQLITE_STDCALL sqlite3_vfs_register(sqlite3_vfs*, int makeDflt);
6042
+ SQLITE_API int SQLITE_STDCALL sqlite3_vfs_unregister(sqlite3_vfs*);
5863
6043
 
5864
6044
  /*
5865
6045
  ** CAPI3REF: Mutexes
@@ -5871,34 +6051,34 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
5871
6051
  **
5872
6052
  ** The SQLite source code contains multiple implementations
5873
6053
  ** of these mutex routines. An appropriate implementation
5874
- ** is selected automatically at compile-time. ^(The following
6054
+ ** is selected automatically at compile-time. The following
5875
6055
  ** implementations are available in the SQLite core:
5876
6056
  **
5877
6057
  ** <ul>
5878
6058
  ** <li> SQLITE_MUTEX_PTHREADS
5879
6059
  ** <li> SQLITE_MUTEX_W32
5880
6060
  ** <li> SQLITE_MUTEX_NOOP
5881
- ** </ul>)^
6061
+ ** </ul>
5882
6062
  **
5883
- ** ^The SQLITE_MUTEX_NOOP implementation is a set of routines
6063
+ ** The SQLITE_MUTEX_NOOP implementation is a set of routines
5884
6064
  ** that does no real locking and is appropriate for use in
5885
- ** a single-threaded application. ^The SQLITE_MUTEX_PTHREADS and
6065
+ ** a single-threaded application. The SQLITE_MUTEX_PTHREADS and
5886
6066
  ** SQLITE_MUTEX_W32 implementations are appropriate for use on Unix
5887
6067
  ** and Windows.
5888
6068
  **
5889
- ** ^(If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor
6069
+ ** If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor
5890
6070
  ** macro defined (with "-DSQLITE_MUTEX_APPDEF=1"), then no mutex
5891
6071
  ** implementation is included with the library. In this case the
5892
6072
  ** application must supply a custom mutex implementation using the
5893
6073
  ** [SQLITE_CONFIG_MUTEX] option of the sqlite3_config() function
5894
6074
  ** before calling sqlite3_initialize() or any other public sqlite3_
5895
- ** function that calls sqlite3_initialize().)^
6075
+ ** function that calls sqlite3_initialize().
5896
6076
  **
5897
6077
  ** ^The sqlite3_mutex_alloc() routine allocates a new
5898
- ** mutex and returns a pointer to it. ^If it returns NULL
5899
- ** that means that a mutex could not be allocated. ^SQLite
5900
- ** will unwind its stack and return an error. ^(The argument
5901
- ** to sqlite3_mutex_alloc() is one of these integer constants:
6078
+ ** mutex and returns a pointer to it. ^The sqlite3_mutex_alloc()
6079
+ ** routine returns NULL if it is unable to allocate the requested
6080
+ ** mutex. The argument to sqlite3_mutex_alloc() must one of these
6081
+ ** integer constants:
5902
6082
  **
5903
6083
  ** <ul>
5904
6084
  ** <li> SQLITE_MUTEX_FAST
@@ -5911,7 +6091,8 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
5911
6091
  ** <li> SQLITE_MUTEX_STATIC_PMEM
5912
6092
  ** <li> SQLITE_MUTEX_STATIC_APP1
5913
6093
  ** <li> SQLITE_MUTEX_STATIC_APP2
5914
- ** </ul>)^
6094
+ ** <li> SQLITE_MUTEX_STATIC_APP3
6095
+ ** </ul>
5915
6096
  **
5916
6097
  ** ^The first two constants (SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE)
5917
6098
  ** cause sqlite3_mutex_alloc() to create
@@ -5919,14 +6100,14 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
5919
6100
  ** is used but not necessarily so when SQLITE_MUTEX_FAST is used.
5920
6101
  ** The mutex implementation does not need to make a distinction
5921
6102
  ** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does
5922
- ** not want to. ^SQLite will only request a recursive mutex in
5923
- ** cases where it really needs one. ^If a faster non-recursive mutex
6103
+ ** not want to. SQLite will only request a recursive mutex in
6104
+ ** cases where it really needs one. If a faster non-recursive mutex
5924
6105
  ** implementation is available on the host platform, the mutex subsystem
5925
6106
  ** might return such a mutex in response to SQLITE_MUTEX_FAST.
5926
6107
  **
5927
6108
  ** ^The other allowed parameters to sqlite3_mutex_alloc() (anything other
5928
6109
  ** than SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) each return
5929
- ** a pointer to a static preexisting mutex. ^Six static mutexes are
6110
+ ** a pointer to a static preexisting mutex. ^Nine static mutexes are
5930
6111
  ** used by the current version of SQLite. Future versions of SQLite
5931
6112
  ** may add additional static mutexes. Static mutexes are for internal
5932
6113
  ** use by SQLite only. Applications that use SQLite mutexes should
@@ -5935,16 +6116,13 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
5935
6116
  **
5936
6117
  ** ^Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST
5937
6118
  ** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc()
5938
- ** returns a different mutex on every call. ^But for the static
6119
+ ** returns a different mutex on every call. ^For the static
5939
6120
  ** mutex types, the same mutex is returned on every call that has
5940
6121
  ** the same type number.
5941
6122
  **
5942
6123
  ** ^The sqlite3_mutex_free() routine deallocates a previously
5943
- ** allocated dynamic mutex. ^SQLite is careful to deallocate every
5944
- ** dynamic mutex that it allocates. The dynamic mutexes must not be in
5945
- ** use when they are deallocated. Attempting to deallocate a static
5946
- ** mutex results in undefined behavior. ^SQLite never deallocates
5947
- ** a static mutex.
6124
+ ** allocated dynamic mutex. Attempting to deallocate a static
6125
+ ** mutex results in undefined behavior.
5948
6126
  **
5949
6127
  ** ^The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt
5950
6128
  ** to enter a mutex. ^If another thread is already within the mutex,
@@ -5952,23 +6130,21 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
5952
6130
  ** SQLITE_BUSY. ^The sqlite3_mutex_try() interface returns [SQLITE_OK]
5953
6131
  ** upon successful entry. ^(Mutexes created using
5954
6132
  ** SQLITE_MUTEX_RECURSIVE can be entered multiple times by the same thread.
5955
- ** In such cases the,
6133
+ ** In such cases, the
5956
6134
  ** mutex must be exited an equal number of times before another thread
5957
- ** can enter.)^ ^(If the same thread tries to enter any other
5958
- ** kind of mutex more than once, the behavior is undefined.
5959
- ** SQLite will never exhibit
5960
- ** such behavior in its own use of mutexes.)^
6135
+ ** can enter.)^ If the same thread tries to enter any mutex other
6136
+ ** than an SQLITE_MUTEX_RECURSIVE more than once, the behavior is undefined.
5961
6137
  **
5962
6138
  ** ^(Some systems (for example, Windows 95) do not support the operation
5963
6139
  ** implemented by sqlite3_mutex_try(). On those systems, sqlite3_mutex_try()
5964
- ** will always return SQLITE_BUSY. The SQLite core only ever uses
5965
- ** sqlite3_mutex_try() as an optimization so this is acceptable behavior.)^
6140
+ ** will always return SQLITE_BUSY. The SQLite core only ever uses
6141
+ ** sqlite3_mutex_try() as an optimization so this is acceptable
6142
+ ** behavior.)^
5966
6143
  **
5967
6144
  ** ^The sqlite3_mutex_leave() routine exits a mutex that was
5968
- ** previously entered by the same thread. ^(The behavior
6145
+ ** previously entered by the same thread. The behavior
5969
6146
  ** is undefined if the mutex is not currently entered by the
5970
- ** calling thread or is not currently allocated. SQLite will
5971
- ** never do either.)^
6147
+ ** calling thread or is not currently allocated.
5972
6148
  **
5973
6149
  ** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), or
5974
6150
  ** sqlite3_mutex_leave() is a NULL pointer, then all three routines
@@ -5976,11 +6152,11 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
5976
6152
  **
5977
6153
  ** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()].
5978
6154
  */
5979
- SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int);
5980
- SQLITE_API void sqlite3_mutex_free(sqlite3_mutex*);
5981
- SQLITE_API void sqlite3_mutex_enter(sqlite3_mutex*);
5982
- SQLITE_API int sqlite3_mutex_try(sqlite3_mutex*);
5983
- SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex*);
6155
+ SQLITE_API sqlite3_mutex *SQLITE_STDCALL sqlite3_mutex_alloc(int);
6156
+ SQLITE_API void SQLITE_STDCALL sqlite3_mutex_free(sqlite3_mutex*);
6157
+ SQLITE_API void SQLITE_STDCALL sqlite3_mutex_enter(sqlite3_mutex*);
6158
+ SQLITE_API int SQLITE_STDCALL sqlite3_mutex_try(sqlite3_mutex*);
6159
+ SQLITE_API void SQLITE_STDCALL sqlite3_mutex_leave(sqlite3_mutex*);
5984
6160
 
5985
6161
  /*
5986
6162
  ** CAPI3REF: Mutex Methods Object
@@ -5989,9 +6165,9 @@ SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex*);
5989
6165
  ** used to allocate and use mutexes.
5990
6166
  **
5991
6167
  ** Usually, the default mutex implementations provided by SQLite are
5992
- ** sufficient, however the user has the option of substituting a custom
6168
+ ** sufficient, however the application has the option of substituting a custom
5993
6169
  ** implementation for specialized deployments or systems for which SQLite
5994
- ** does not provide a suitable implementation. In this case, the user
6170
+ ** does not provide a suitable implementation. In this case, the application
5995
6171
  ** creates and populates an instance of this structure to pass
5996
6172
  ** to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option.
5997
6173
  ** Additionally, an instance of this structure can be used as an
@@ -6032,13 +6208,13 @@ SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex*);
6032
6208
  ** (i.e. it is acceptable to provide an implementation that segfaults if
6033
6209
  ** it is passed a NULL pointer).
6034
6210
  **
6035
- ** The xMutexInit() method must be threadsafe. ^It must be harmless to
6211
+ ** The xMutexInit() method must be threadsafe. It must be harmless to
6036
6212
  ** invoke xMutexInit() multiple times within the same process and without
6037
6213
  ** intervening calls to xMutexEnd(). Second and subsequent calls to
6038
6214
  ** xMutexInit() must be no-ops.
6039
6215
  **
6040
- ** ^xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()]
6041
- ** and its associates). ^Similarly, xMutexAlloc() must not use SQLite memory
6216
+ ** xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()]
6217
+ ** and its associates). Similarly, xMutexAlloc() must not use SQLite memory
6042
6218
  ** allocation for a static mutex. ^However xMutexAlloc() may use SQLite
6043
6219
  ** memory allocation for a fast or recursive mutex.
6044
6220
  **
@@ -6064,34 +6240,34 @@ struct sqlite3_mutex_methods {
6064
6240
  ** CAPI3REF: Mutex Verification Routines
6065
6241
  **
6066
6242
  ** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routines
6067
- ** are intended for use inside assert() statements. ^The SQLite core
6243
+ ** are intended for use inside assert() statements. The SQLite core
6068
6244
  ** never uses these routines except inside an assert() and applications
6069
- ** are advised to follow the lead of the core. ^The SQLite core only
6245
+ ** are advised to follow the lead of the core. The SQLite core only
6070
6246
  ** provides implementations for these routines when it is compiled
6071
- ** with the SQLITE_DEBUG flag. ^External mutex implementations
6247
+ ** with the SQLITE_DEBUG flag. External mutex implementations
6072
6248
  ** are only required to provide these routines if SQLITE_DEBUG is
6073
6249
  ** defined and if NDEBUG is not defined.
6074
6250
  **
6075
- ** ^These routines should return true if the mutex in their argument
6251
+ ** These routines should return true if the mutex in their argument
6076
6252
  ** is held or not held, respectively, by the calling thread.
6077
6253
  **
6078
- ** ^The implementation is not required to provide versions of these
6254
+ ** The implementation is not required to provide versions of these
6079
6255
  ** routines that actually work. If the implementation does not provide working
6080
6256
  ** versions of these routines, it should at least provide stubs that always
6081
6257
  ** return true so that one does not get spurious assertion failures.
6082
6258
  **
6083
- ** ^If the argument to sqlite3_mutex_held() is a NULL pointer then
6259
+ ** If the argument to sqlite3_mutex_held() is a NULL pointer then
6084
6260
  ** the routine should return 1. This seems counter-intuitive since
6085
6261
  ** clearly the mutex cannot be held if it does not exist. But
6086
6262
  ** the reason the mutex does not exist is because the build is not
6087
6263
  ** using mutexes. And we do not want the assert() containing the
6088
6264
  ** call to sqlite3_mutex_held() to fail, so a non-zero return is
6089
- ** the appropriate thing to do. ^The sqlite3_mutex_notheld()
6265
+ ** the appropriate thing to do. The sqlite3_mutex_notheld()
6090
6266
  ** interface should also return 1 when given a NULL pointer.
6091
6267
  */
6092
6268
  #ifndef NDEBUG
6093
- SQLITE_API int sqlite3_mutex_held(sqlite3_mutex*);
6094
- SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*);
6269
+ SQLITE_API int SQLITE_STDCALL sqlite3_mutex_held(sqlite3_mutex*);
6270
+ SQLITE_API int SQLITE_STDCALL sqlite3_mutex_notheld(sqlite3_mutex*);
6095
6271
  #endif
6096
6272
 
6097
6273
  /*
@@ -6117,9 +6293,13 @@ SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*);
6117
6293
  #define SQLITE_MUTEX_STATIC_APP1 8 /* For use by application */
6118
6294
  #define SQLITE_MUTEX_STATIC_APP2 9 /* For use by application */
6119
6295
  #define SQLITE_MUTEX_STATIC_APP3 10 /* For use by application */
6296
+ #define SQLITE_MUTEX_STATIC_VFS1 11 /* For use by built-in VFS */
6297
+ #define SQLITE_MUTEX_STATIC_VFS2 12 /* For use by extension VFS */
6298
+ #define SQLITE_MUTEX_STATIC_VFS3 13 /* For use by application VFS */
6120
6299
 
6121
6300
  /*
6122
6301
  ** CAPI3REF: Retrieve the mutex for a database connection
6302
+ ** METHOD: sqlite3
6123
6303
  **
6124
6304
  ** ^This interface returns a pointer the [sqlite3_mutex] object that
6125
6305
  ** serializes access to the [database connection] given in the argument
@@ -6127,10 +6307,11 @@ SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*);
6127
6307
  ** ^If the [threading mode] is Single-thread or Multi-thread then this
6128
6308
  ** routine returns a NULL pointer.
6129
6309
  */
6130
- SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*);
6310
+ SQLITE_API sqlite3_mutex *SQLITE_STDCALL sqlite3_db_mutex(sqlite3*);
6131
6311
 
6132
6312
  /*
6133
6313
  ** CAPI3REF: Low-Level Control Of Database Files
6314
+ ** METHOD: sqlite3
6134
6315
  **
6135
6316
  ** ^The [sqlite3_file_control()] interface makes a direct call to the
6136
6317
  ** xFileControl method for the [sqlite3_io_methods] object associated
@@ -6161,7 +6342,7 @@ SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*);
6161
6342
  **
6162
6343
  ** See also: [SQLITE_FCNTL_LOCKSTATE]
6163
6344
  */
6164
- SQLITE_API int sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*);
6345
+ SQLITE_API int SQLITE_STDCALL sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*);
6165
6346
 
6166
6347
  /*
6167
6348
  ** CAPI3REF: Testing Interface
@@ -6180,7 +6361,7 @@ SQLITE_API int sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*
6180
6361
  ** Unlike most of the SQLite API, this function is not guaranteed to
6181
6362
  ** operate consistently from one release to the next.
6182
6363
  */
6183
- SQLITE_API int sqlite3_test_control(int op, ...);
6364
+ SQLITE_API int SQLITE_CDECL sqlite3_test_control(int op, ...);
6184
6365
 
6185
6366
  /*
6186
6367
  ** CAPI3REF: Testing Interface Operation Codes
@@ -6214,12 +6395,13 @@ SQLITE_API int sqlite3_test_control(int op, ...);
6214
6395
  #define SQLITE_TESTCTRL_BYTEORDER 22
6215
6396
  #define SQLITE_TESTCTRL_ISINIT 23
6216
6397
  #define SQLITE_TESTCTRL_SORTER_MMAP 24
6217
- #define SQLITE_TESTCTRL_LAST 24
6398
+ #define SQLITE_TESTCTRL_IMPOSTER 25
6399
+ #define SQLITE_TESTCTRL_LAST 25
6218
6400
 
6219
6401
  /*
6220
6402
  ** CAPI3REF: SQLite Runtime Status
6221
6403
  **
6222
- ** ^This interface is used to retrieve runtime status information
6404
+ ** ^These interfaces are used to retrieve runtime status information
6223
6405
  ** about the performance of SQLite, and optionally to reset various
6224
6406
  ** highwater marks. ^The first argument is an integer code for
6225
6407
  ** the specific parameter to measure. ^(Recognized integer codes
@@ -6233,19 +6415,22 @@ SQLITE_API int sqlite3_test_control(int op, ...);
6233
6415
  ** ^(Other parameters record only the highwater mark and not the current
6234
6416
  ** value. For these latter parameters nothing is written into *pCurrent.)^
6235
6417
  **
6236
- ** ^The sqlite3_status() routine returns SQLITE_OK on success and a
6237
- ** non-zero [error code] on failure.
6418
+ ** ^The sqlite3_status() and sqlite3_status64() routines return
6419
+ ** SQLITE_OK on success and a non-zero [error code] on failure.
6238
6420
  **
6239
- ** This routine is threadsafe but is not atomic. This routine can be
6240
- ** called while other threads are running the same or different SQLite
6241
- ** interfaces. However the values returned in *pCurrent and
6242
- ** *pHighwater reflect the status of SQLite at different points in time
6243
- ** and it is possible that another thread might change the parameter
6244
- ** in between the times when *pCurrent and *pHighwater are written.
6421
+ ** If either the current value or the highwater mark is too large to
6422
+ ** be represented by a 32-bit integer, then the values returned by
6423
+ ** sqlite3_status() are undefined.
6245
6424
  **
6246
6425
  ** See also: [sqlite3_db_status()]
6247
6426
  */
6248
- SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag);
6427
+ SQLITE_API int SQLITE_STDCALL sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag);
6428
+ SQLITE_API int SQLITE_STDCALL sqlite3_status64(
6429
+ int op,
6430
+ sqlite3_int64 *pCurrent,
6431
+ sqlite3_int64 *pHighwater,
6432
+ int resetFlag
6433
+ );
6249
6434
 
6250
6435
 
6251
6436
  /*
@@ -6343,6 +6528,7 @@ SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetF
6343
6528
 
6344
6529
  /*
6345
6530
  ** CAPI3REF: Database Connection Status
6531
+ ** METHOD: sqlite3
6346
6532
  **
6347
6533
  ** ^This interface is used to retrieve runtime status information
6348
6534
  ** about a single [database connection]. ^The first argument is the
@@ -6363,7 +6549,7 @@ SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetF
6363
6549
  **
6364
6550
  ** See also: [sqlite3_status()] and [sqlite3_stmt_status()].
6365
6551
  */
6366
- SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
6552
+ SQLITE_API int SQLITE_STDCALL sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
6367
6553
 
6368
6554
  /*
6369
6555
  ** CAPI3REF: Status Parameters for database connections
@@ -6471,6 +6657,7 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
6471
6657
 
6472
6658
  /*
6473
6659
  ** CAPI3REF: Prepared Statement Status
6660
+ ** METHOD: sqlite3_stmt
6474
6661
  **
6475
6662
  ** ^(Each prepared statement maintains various
6476
6663
  ** [SQLITE_STMTSTATUS counters] that measure the number
@@ -6492,7 +6679,7 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
6492
6679
  **
6493
6680
  ** See also: [sqlite3_status()] and [sqlite3_db_status()].
6494
6681
  */
6495
- SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
6682
+ SQLITE_API int SQLITE_STDCALL sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
6496
6683
 
6497
6684
  /*
6498
6685
  ** CAPI3REF: Status Parameters for prepared statements
@@ -6819,6 +7006,10 @@ typedef struct sqlite3_backup sqlite3_backup;
6819
7006
  ** must be different or else sqlite3_backup_init(D,N,S,M) will fail with
6820
7007
  ** an error.
6821
7008
  **
7009
+ ** ^A call to sqlite3_backup_init() will fail, returning SQLITE_ERROR, if
7010
+ ** there is already a read or read-write transaction open on the
7011
+ ** destination database.
7012
+ **
6822
7013
  ** ^If an error occurs within sqlite3_backup_init(D,N,S,M), then NULL is
6823
7014
  ** returned and an error code and error message are stored in the
6824
7015
  ** destination [database connection] D.
@@ -6911,20 +7102,20 @@ typedef struct sqlite3_backup sqlite3_backup;
6911
7102
  ** is not a permanent error and does not affect the return value of
6912
7103
  ** sqlite3_backup_finish().
6913
7104
  **
6914
- ** [[sqlite3_backup__remaining()]] [[sqlite3_backup_pagecount()]]
7105
+ ** [[sqlite3_backup_remaining()]] [[sqlite3_backup_pagecount()]]
6915
7106
  ** <b>sqlite3_backup_remaining() and sqlite3_backup_pagecount()</b>
6916
7107
  **
6917
- ** ^Each call to sqlite3_backup_step() sets two values inside
6918
- ** the [sqlite3_backup] object: the number of pages still to be backed
6919
- ** up and the total number of pages in the source database file.
6920
- ** The sqlite3_backup_remaining() and sqlite3_backup_pagecount() interfaces
6921
- ** retrieve these two values, respectively.
6922
- **
6923
- ** ^The values returned by these functions are only updated by
6924
- ** sqlite3_backup_step(). ^If the source database is modified during a backup
6925
- ** operation, then the values are not updated to account for any extra
6926
- ** pages that need to be updated or the size of the source database file
6927
- ** changing.
7108
+ ** ^The sqlite3_backup_remaining() routine returns the number of pages still
7109
+ ** to be backed up at the conclusion of the most recent sqlite3_backup_step().
7110
+ ** ^The sqlite3_backup_pagecount() routine returns the total number of pages
7111
+ ** in the source database at the conclusion of the most recent
7112
+ ** sqlite3_backup_step().
7113
+ ** ^(The values returned by these functions are only updated by
7114
+ ** sqlite3_backup_step(). If the source database is modified in a way that
7115
+ ** changes the size of the source database or the number of pages remaining,
7116
+ ** those changes are not reflected in the output of sqlite3_backup_pagecount()
7117
+ ** and sqlite3_backup_remaining() until after the next
7118
+ ** sqlite3_backup_step().)^
6928
7119
  **
6929
7120
  ** <b>Concurrent Usage of Database Handles</b>
6930
7121
  **
@@ -6957,19 +7148,20 @@ typedef struct sqlite3_backup sqlite3_backup;
6957
7148
  ** same time as another thread is invoking sqlite3_backup_step() it is
6958
7149
  ** possible that they return invalid values.
6959
7150
  */
6960
- SQLITE_API sqlite3_backup *sqlite3_backup_init(
7151
+ SQLITE_API sqlite3_backup *SQLITE_STDCALL sqlite3_backup_init(
6961
7152
  sqlite3 *pDest, /* Destination database handle */
6962
7153
  const char *zDestName, /* Destination database name */
6963
7154
  sqlite3 *pSource, /* Source database handle */
6964
7155
  const char *zSourceName /* Source database name */
6965
7156
  );
6966
- SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage);
6967
- SQLITE_API int sqlite3_backup_finish(sqlite3_backup *p);
6968
- SQLITE_API int sqlite3_backup_remaining(sqlite3_backup *p);
6969
- SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p);
7157
+ SQLITE_API int SQLITE_STDCALL sqlite3_backup_step(sqlite3_backup *p, int nPage);
7158
+ SQLITE_API int SQLITE_STDCALL sqlite3_backup_finish(sqlite3_backup *p);
7159
+ SQLITE_API int SQLITE_STDCALL sqlite3_backup_remaining(sqlite3_backup *p);
7160
+ SQLITE_API int SQLITE_STDCALL sqlite3_backup_pagecount(sqlite3_backup *p);
6970
7161
 
6971
7162
  /*
6972
7163
  ** CAPI3REF: Unlock Notification
7164
+ ** METHOD: sqlite3
6973
7165
  **
6974
7166
  ** ^When running in shared-cache mode, a database operation may fail with
6975
7167
  ** an [SQLITE_LOCKED] error if the required locks on the shared-cache or
@@ -7082,7 +7274,7 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p);
7082
7274
  ** the special "DROP TABLE/INDEX" case, the extended error code is just
7083
7275
  ** SQLITE_LOCKED.)^
7084
7276
  */
7085
- SQLITE_API int sqlite3_unlock_notify(
7277
+ SQLITE_API int SQLITE_STDCALL sqlite3_unlock_notify(
7086
7278
  sqlite3 *pBlocked, /* Waiting connection */
7087
7279
  void (*xNotify)(void **apArg, int nArg), /* Callback function to invoke */
7088
7280
  void *pNotifyArg /* Argument to pass to xNotify */
@@ -7097,8 +7289,8 @@ SQLITE_API int sqlite3_unlock_notify(
7097
7289
  ** strings in a case-independent fashion, using the same definition of "case
7098
7290
  ** independence" that SQLite uses internally when comparing identifiers.
7099
7291
  */
7100
- SQLITE_API int sqlite3_stricmp(const char *, const char *);
7101
- SQLITE_API int sqlite3_strnicmp(const char *, const char *, int);
7292
+ SQLITE_API int SQLITE_STDCALL sqlite3_stricmp(const char *, const char *);
7293
+ SQLITE_API int SQLITE_STDCALL sqlite3_strnicmp(const char *, const char *, int);
7102
7294
 
7103
7295
  /*
7104
7296
  ** CAPI3REF: String Globbing
@@ -7113,7 +7305,7 @@ SQLITE_API int sqlite3_strnicmp(const char *, const char *, int);
7113
7305
  ** Note that this routine returns zero on a match and non-zero if the strings
7114
7306
  ** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()].
7115
7307
  */
7116
- SQLITE_API int sqlite3_strglob(const char *zGlob, const char *zStr);
7308
+ SQLITE_API int SQLITE_STDCALL sqlite3_strglob(const char *zGlob, const char *zStr);
7117
7309
 
7118
7310
  /*
7119
7311
  ** CAPI3REF: Error Logging Interface
@@ -7136,18 +7328,17 @@ SQLITE_API int sqlite3_strglob(const char *zGlob, const char *zStr);
7136
7328
  ** a few hundred characters, it will be truncated to the length of the
7137
7329
  ** buffer.
7138
7330
  */
7139
- SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);
7331
+ SQLITE_API void SQLITE_CDECL sqlite3_log(int iErrCode, const char *zFormat, ...);
7140
7332
 
7141
7333
  /*
7142
7334
  ** CAPI3REF: Write-Ahead Log Commit Hook
7335
+ ** METHOD: sqlite3
7143
7336
  **
7144
7337
  ** ^The [sqlite3_wal_hook()] function is used to register a callback that
7145
- ** will be invoked each time a database connection commits data to a
7146
- ** [write-ahead log] (i.e. whenever a transaction is committed in
7147
- ** [journal_mode | journal_mode=WAL mode]).
7338
+ ** is invoked each time data is committed to a database in wal mode.
7148
7339
  **
7149
- ** ^The callback is invoked by SQLite after the commit has taken place and
7150
- ** the associated write-lock on the database released, so the implementation
7340
+ ** ^(The callback is invoked by SQLite after the commit has taken place and
7341
+ ** the associated write-lock on the database released)^, so the implementation
7151
7342
  ** may read, write or [checkpoint] the database as required.
7152
7343
  **
7153
7344
  ** ^The first parameter passed to the callback function when it is invoked
@@ -7173,7 +7364,7 @@ SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);
7173
7364
  ** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will
7174
7365
  ** those overwrite any prior [sqlite3_wal_hook()] settings.
7175
7366
  */
7176
- SQLITE_API void *sqlite3_wal_hook(
7367
+ SQLITE_API void *SQLITE_STDCALL sqlite3_wal_hook(
7177
7368
  sqlite3*,
7178
7369
  int(*)(void *,sqlite3*,const char*,int),
7179
7370
  void*
@@ -7181,6 +7372,7 @@ SQLITE_API void *sqlite3_wal_hook(
7181
7372
 
7182
7373
  /*
7183
7374
  ** CAPI3REF: Configure an auto-checkpoint
7375
+ ** METHOD: sqlite3
7184
7376
  **
7185
7377
  ** ^The [sqlite3_wal_autocheckpoint(D,N)] is a wrapper around
7186
7378
  ** [sqlite3_wal_hook()] that causes any database on [database connection] D
@@ -7207,104 +7399,123 @@ SQLITE_API void *sqlite3_wal_hook(
7207
7399
  ** is only necessary if the default setting is found to be suboptimal
7208
7400
  ** for a particular application.
7209
7401
  */
7210
- SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
7402
+ SQLITE_API int SQLITE_STDCALL sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
7211
7403
 
7212
7404
  /*
7213
7405
  ** CAPI3REF: Checkpoint a database
7406
+ ** METHOD: sqlite3
7214
7407
  **
7215
- ** ^The [sqlite3_wal_checkpoint(D,X)] interface causes database named X
7216
- ** on [database connection] D to be [checkpointed]. ^If X is NULL or an
7217
- ** empty string, then a checkpoint is run on all databases of
7218
- ** connection D. ^If the database connection D is not in
7219
- ** [WAL | write-ahead log mode] then this interface is a harmless no-op.
7220
- ** ^The [sqlite3_wal_checkpoint(D,X)] interface initiates a
7221
- ** [sqlite3_wal_checkpoint_v2|PASSIVE] checkpoint.
7222
- ** Use the [sqlite3_wal_checkpoint_v2()] interface to get a FULL
7223
- ** or RESET checkpoint.
7408
+ ** ^(The sqlite3_wal_checkpoint(D,X) is equivalent to
7409
+ ** [sqlite3_wal_checkpoint_v2](D,X,[SQLITE_CHECKPOINT_PASSIVE],0,0).)^
7224
7410
  **
7225
- ** ^The [wal_checkpoint pragma] can be used to invoke this interface
7226
- ** from SQL. ^The [sqlite3_wal_autocheckpoint()] interface and the
7227
- ** [wal_autocheckpoint pragma] can be used to cause this interface to be
7228
- ** run whenever the WAL reaches a certain size threshold.
7411
+ ** In brief, sqlite3_wal_checkpoint(D,X) causes the content in the
7412
+ ** [write-ahead log] for database X on [database connection] D to be
7413
+ ** transferred into the database file and for the write-ahead log to
7414
+ ** be reset. See the [checkpointing] documentation for addition
7415
+ ** information.
7229
7416
  **
7230
- ** See also: [sqlite3_wal_checkpoint_v2()]
7417
+ ** This interface used to be the only way to cause a checkpoint to
7418
+ ** occur. But then the newer and more powerful [sqlite3_wal_checkpoint_v2()]
7419
+ ** interface was added. This interface is retained for backwards
7420
+ ** compatibility and as a convenience for applications that need to manually
7421
+ ** start a callback but which do not need the full power (and corresponding
7422
+ ** complication) of [sqlite3_wal_checkpoint_v2()].
7231
7423
  */
7232
- SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
7424
+ SQLITE_API int SQLITE_STDCALL sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
7233
7425
 
7234
7426
  /*
7235
7427
  ** CAPI3REF: Checkpoint a database
7428
+ ** METHOD: sqlite3
7236
7429
  **
7237
- ** Run a checkpoint operation on WAL database zDb attached to database
7238
- ** handle db. The specific operation is determined by the value of the
7239
- ** eMode parameter:
7430
+ ** ^(The sqlite3_wal_checkpoint_v2(D,X,M,L,C) interface runs a checkpoint
7431
+ ** operation on database X of [database connection] D in mode M. Status
7432
+ ** information is written back into integers pointed to by L and C.)^
7433
+ ** ^(The M parameter must be a valid [checkpoint mode]:)^
7240
7434
  **
7241
7435
  ** <dl>
7242
7436
  ** <dt>SQLITE_CHECKPOINT_PASSIVE<dd>
7243
- ** Checkpoint as many frames as possible without waiting for any database
7244
- ** readers or writers to finish. Sync the db file if all frames in the log
7245
- ** are checkpointed. This mode is the same as calling
7246
- ** sqlite3_wal_checkpoint(). The [sqlite3_busy_handler|busy-handler callback]
7247
- ** is never invoked.
7437
+ ** ^Checkpoint as many frames as possible without waiting for any database
7438
+ ** readers or writers to finish, then sync the database file if all frames
7439
+ ** in the log were checkpointed. ^The [busy-handler callback]
7440
+ ** is never invoked in the SQLITE_CHECKPOINT_PASSIVE mode.
7441
+ ** ^On the other hand, passive mode might leave the checkpoint unfinished
7442
+ ** if there are concurrent readers or writers.
7248
7443
  **
7249
7444
  ** <dt>SQLITE_CHECKPOINT_FULL<dd>
7250
- ** This mode blocks (it invokes the
7445
+ ** ^This mode blocks (it invokes the
7251
7446
  ** [sqlite3_busy_handler|busy-handler callback]) until there is no
7252
7447
  ** database writer and all readers are reading from the most recent database
7253
- ** snapshot. It then checkpoints all frames in the log file and syncs the
7254
- ** database file. This call blocks database writers while it is running,
7255
- ** but not database readers.
7448
+ ** snapshot. ^It then checkpoints all frames in the log file and syncs the
7449
+ ** database file. ^This mode blocks new database writers while it is pending,
7450
+ ** but new database readers are allowed to continue unimpeded.
7256
7451
  **
7257
7452
  ** <dt>SQLITE_CHECKPOINT_RESTART<dd>
7258
- ** This mode works the same way as SQLITE_CHECKPOINT_FULL, except after
7259
- ** checkpointing the log file it blocks (calls the
7260
- ** [sqlite3_busy_handler|busy-handler callback])
7261
- ** until all readers are reading from the database file only. This ensures
7262
- ** that the next client to write to the database file restarts the log file
7263
- ** from the beginning. This call blocks database writers while it is running,
7264
- ** but not database readers.
7453
+ ** ^This mode works the same way as SQLITE_CHECKPOINT_FULL with the addition
7454
+ ** that after checkpointing the log file it blocks (calls the
7455
+ ** [busy-handler callback])
7456
+ ** until all readers are reading from the database file only. ^This ensures
7457
+ ** that the next writer will restart the log file from the beginning.
7458
+ ** ^Like SQLITE_CHECKPOINT_FULL, this mode blocks new
7459
+ ** database writer attempts while it is pending, but does not impede readers.
7460
+ **
7461
+ ** <dt>SQLITE_CHECKPOINT_TRUNCATE<dd>
7462
+ ** ^This mode works the same way as SQLITE_CHECKPOINT_RESTART with the
7463
+ ** addition that it also truncates the log file to zero bytes just prior
7464
+ ** to a successful return.
7265
7465
  ** </dl>
7266
7466
  **
7267
- ** If pnLog is not NULL, then *pnLog is set to the total number of frames in
7268
- ** the log file before returning. If pnCkpt is not NULL, then *pnCkpt is set to
7269
- ** the total number of checkpointed frames (including any that were already
7270
- ** checkpointed when this function is called). *pnLog and *pnCkpt may be
7271
- ** populated even if sqlite3_wal_checkpoint_v2() returns other than SQLITE_OK.
7272
- ** If no values are available because of an error, they are both set to -1
7273
- ** before returning to communicate this to the caller.
7274
- **
7275
- ** All calls obtain an exclusive "checkpoint" lock on the database file. If
7467
+ ** ^If pnLog is not NULL, then *pnLog is set to the total number of frames in
7468
+ ** the log file or to -1 if the checkpoint could not run because
7469
+ ** of an error or because the database is not in [WAL mode]. ^If pnCkpt is not
7470
+ ** NULL,then *pnCkpt is set to the total number of checkpointed frames in the
7471
+ ** log file (including any that were already checkpointed before the function
7472
+ ** was called) or to -1 if the checkpoint could not run due to an error or
7473
+ ** because the database is not in WAL mode. ^Note that upon successful
7474
+ ** completion of an SQLITE_CHECKPOINT_TRUNCATE, the log file will have been
7475
+ ** truncated to zero bytes and so both *pnLog and *pnCkpt will be set to zero.
7476
+ **
7477
+ ** ^All calls obtain an exclusive "checkpoint" lock on the database file. ^If
7276
7478
  ** any other process is running a checkpoint operation at the same time, the
7277
- ** lock cannot be obtained and SQLITE_BUSY is returned. Even if there is a
7479
+ ** lock cannot be obtained and SQLITE_BUSY is returned. ^Even if there is a
7278
7480
  ** busy-handler configured, it will not be invoked in this case.
7279
7481
  **
7280
- ** The SQLITE_CHECKPOINT_FULL and RESTART modes also obtain the exclusive
7281
- ** "writer" lock on the database file. If the writer lock cannot be obtained
7282
- ** immediately, and a busy-handler is configured, it is invoked and the writer
7283
- ** lock retried until either the busy-handler returns 0 or the lock is
7284
- ** successfully obtained. The busy-handler is also invoked while waiting for
7285
- ** database readers as described above. If the busy-handler returns 0 before
7482
+ ** ^The SQLITE_CHECKPOINT_FULL, RESTART and TRUNCATE modes also obtain the
7483
+ ** exclusive "writer" lock on the database file. ^If the writer lock cannot be
7484
+ ** obtained immediately, and a busy-handler is configured, it is invoked and
7485
+ ** the writer lock retried until either the busy-handler returns 0 or the lock
7486
+ ** is successfully obtained. ^The busy-handler is also invoked while waiting for
7487
+ ** database readers as described above. ^If the busy-handler returns 0 before
7286
7488
  ** the writer lock is obtained or while waiting for database readers, the
7287
7489
  ** checkpoint operation proceeds from that point in the same way as
7288
7490
  ** SQLITE_CHECKPOINT_PASSIVE - checkpointing as many frames as possible
7289
- ** without blocking any further. SQLITE_BUSY is returned in this case.
7491
+ ** without blocking any further. ^SQLITE_BUSY is returned in this case.
7290
7492
  **
7291
- ** If parameter zDb is NULL or points to a zero length string, then the
7292
- ** specified operation is attempted on all WAL databases. In this case the
7293
- ** values written to output parameters *pnLog and *pnCkpt are undefined. If
7493
+ ** ^If parameter zDb is NULL or points to a zero length string, then the
7494
+ ** specified operation is attempted on all WAL databases [attached] to
7495
+ ** [database connection] db. In this case the
7496
+ ** values written to output parameters *pnLog and *pnCkpt are undefined. ^If
7294
7497
  ** an SQLITE_BUSY error is encountered when processing one or more of the
7295
7498
  ** attached WAL databases, the operation is still attempted on any remaining
7296
- ** attached databases and SQLITE_BUSY is returned to the caller. If any other
7499
+ ** attached databases and SQLITE_BUSY is returned at the end. ^If any other
7297
7500
  ** error occurs while processing an attached database, processing is abandoned
7298
- ** and the error code returned to the caller immediately. If no error
7501
+ ** and the error code is returned to the caller immediately. ^If no error
7299
7502
  ** (SQLITE_BUSY or otherwise) is encountered while processing the attached
7300
7503
  ** databases, SQLITE_OK is returned.
7301
7504
  **
7302
- ** If database zDb is the name of an attached database that is not in WAL
7303
- ** mode, SQLITE_OK is returned and both *pnLog and *pnCkpt set to -1. If
7505
+ ** ^If database zDb is the name of an attached database that is not in WAL
7506
+ ** mode, SQLITE_OK is returned and both *pnLog and *pnCkpt set to -1. ^If
7304
7507
  ** zDb is not NULL (or a zero length string) and is not the name of any
7305
7508
  ** attached database, SQLITE_ERROR is returned to the caller.
7509
+ **
7510
+ ** ^Unless it returns SQLITE_MISUSE,
7511
+ ** the sqlite3_wal_checkpoint_v2() interface
7512
+ ** sets the error information that is queried by
7513
+ ** [sqlite3_errcode()] and [sqlite3_errmsg()].
7514
+ **
7515
+ ** ^The [PRAGMA wal_checkpoint] command can be used to invoke this interface
7516
+ ** from SQL.
7306
7517
  */
7307
- SQLITE_API int sqlite3_wal_checkpoint_v2(
7518
+ SQLITE_API int SQLITE_STDCALL sqlite3_wal_checkpoint_v2(
7308
7519
  sqlite3 *db, /* Database handle */
7309
7520
  const char *zDb, /* Name of attached database (or NULL) */
7310
7521
  int eMode, /* SQLITE_CHECKPOINT_* value */
@@ -7313,16 +7524,18 @@ SQLITE_API int sqlite3_wal_checkpoint_v2(
7313
7524
  );
7314
7525
 
7315
7526
  /*
7316
- ** CAPI3REF: Checkpoint operation parameters
7527
+ ** CAPI3REF: Checkpoint Mode Values
7528
+ ** KEYWORDS: {checkpoint mode}
7317
7529
  **
7318
- ** These constants can be used as the 3rd parameter to
7319
- ** [sqlite3_wal_checkpoint_v2()]. See the [sqlite3_wal_checkpoint_v2()]
7320
- ** documentation for additional information about the meaning and use of
7321
- ** each of these values.
7530
+ ** These constants define all valid values for the "checkpoint mode" passed
7531
+ ** as the third parameter to the [sqlite3_wal_checkpoint_v2()] interface.
7532
+ ** See the [sqlite3_wal_checkpoint_v2()] documentation for details on the
7533
+ ** meaning of each of these checkpoint modes.
7322
7534
  */
7323
- #define SQLITE_CHECKPOINT_PASSIVE 0
7324
- #define SQLITE_CHECKPOINT_FULL 1
7325
- #define SQLITE_CHECKPOINT_RESTART 2
7535
+ #define SQLITE_CHECKPOINT_PASSIVE 0 /* Do as much as possible w/o blocking */
7536
+ #define SQLITE_CHECKPOINT_FULL 1 /* Wait for writers, then checkpoint */
7537
+ #define SQLITE_CHECKPOINT_RESTART 2 /* Like FULL but wait for for readers */
7538
+ #define SQLITE_CHECKPOINT_TRUNCATE 3 /* Like RESTART but also truncate WAL */
7326
7539
 
7327
7540
  /*
7328
7541
  ** CAPI3REF: Virtual Table Interface Configuration
@@ -7338,7 +7551,7 @@ SQLITE_API int sqlite3_wal_checkpoint_v2(
7338
7551
  ** this function. (See [SQLITE_VTAB_CONSTRAINT_SUPPORT].) Further options
7339
7552
  ** may be added in the future.
7340
7553
  */
7341
- SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);
7554
+ SQLITE_API int SQLITE_CDECL sqlite3_vtab_config(sqlite3*, int op, ...);
7342
7555
 
7343
7556
  /*
7344
7557
  ** CAPI3REF: Virtual Table Configuration Options
@@ -7391,7 +7604,7 @@ SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);
7391
7604
  ** of the SQL statement that triggered the call to the [xUpdate] method of the
7392
7605
  ** [virtual table].
7393
7606
  */
7394
- SQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *);
7607
+ SQLITE_API int SQLITE_STDCALL sqlite3_vtab_on_conflict(sqlite3 *);
7395
7608
 
7396
7609
  /*
7397
7610
  ** CAPI3REF: Conflict resolution modes
@@ -7411,6 +7624,108 @@ SQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *);
7411
7624
  /* #define SQLITE_ABORT 4 // Also an error code */
7412
7625
  #define SQLITE_REPLACE 5
7413
7626
 
7627
+ /*
7628
+ ** CAPI3REF: Prepared Statement Scan Status Opcodes
7629
+ ** KEYWORDS: {scanstatus options}
7630
+ **
7631
+ ** The following constants can be used for the T parameter to the
7632
+ ** [sqlite3_stmt_scanstatus(S,X,T,V)] interface. Each constant designates a
7633
+ ** different metric for sqlite3_stmt_scanstatus() to return.
7634
+ **
7635
+ ** When the value returned to V is a string, space to hold that string is
7636
+ ** managed by the prepared statement S and will be automatically freed when
7637
+ ** S is finalized.
7638
+ **
7639
+ ** <dl>
7640
+ ** [[SQLITE_SCANSTAT_NLOOP]] <dt>SQLITE_SCANSTAT_NLOOP</dt>
7641
+ ** <dd>^The [sqlite3_int64] variable pointed to by the T parameter will be
7642
+ ** set to the total number of times that the X-th loop has run.</dd>
7643
+ **
7644
+ ** [[SQLITE_SCANSTAT_NVISIT]] <dt>SQLITE_SCANSTAT_NVISIT</dt>
7645
+ ** <dd>^The [sqlite3_int64] variable pointed to by the T parameter will be set
7646
+ ** to the total number of rows examined by all iterations of the X-th loop.</dd>
7647
+ **
7648
+ ** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt>
7649
+ ** <dd>^The "double" variable pointed to by the T parameter will be set to the
7650
+ ** query planner's estimate for the average number of rows output from each
7651
+ ** iteration of the X-th loop. If the query planner's estimates was accurate,
7652
+ ** then this value will approximate the quotient NVISIT/NLOOP and the
7653
+ ** product of this value for all prior loops with the same SELECTID will
7654
+ ** be the NLOOP value for the current loop.
7655
+ **
7656
+ ** [[SQLITE_SCANSTAT_NAME]] <dt>SQLITE_SCANSTAT_NAME</dt>
7657
+ ** <dd>^The "const char *" variable pointed to by the T parameter will be set
7658
+ ** to a zero-terminated UTF-8 string containing the name of the index or table
7659
+ ** used for the X-th loop.
7660
+ **
7661
+ ** [[SQLITE_SCANSTAT_EXPLAIN]] <dt>SQLITE_SCANSTAT_EXPLAIN</dt>
7662
+ ** <dd>^The "const char *" variable pointed to by the T parameter will be set
7663
+ ** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN]
7664
+ ** description for the X-th loop.
7665
+ **
7666
+ ** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECT</dt>
7667
+ ** <dd>^The "int" variable pointed to by the T parameter will be set to the
7668
+ ** "select-id" for the X-th loop. The select-id identifies which query or
7669
+ ** subquery the loop is part of. The main query has a select-id of zero.
7670
+ ** The select-id is the same value as is output in the first column
7671
+ ** of an [EXPLAIN QUERY PLAN] query.
7672
+ ** </dl>
7673
+ */
7674
+ #define SQLITE_SCANSTAT_NLOOP 0
7675
+ #define SQLITE_SCANSTAT_NVISIT 1
7676
+ #define SQLITE_SCANSTAT_EST 2
7677
+ #define SQLITE_SCANSTAT_NAME 3
7678
+ #define SQLITE_SCANSTAT_EXPLAIN 4
7679
+ #define SQLITE_SCANSTAT_SELECTID 5
7680
+
7681
+ /*
7682
+ ** CAPI3REF: Prepared Statement Scan Status
7683
+ ** METHOD: sqlite3_stmt
7684
+ **
7685
+ ** This interface returns information about the predicted and measured
7686
+ ** performance for pStmt. Advanced applications can use this
7687
+ ** interface to compare the predicted and the measured performance and
7688
+ ** issue warnings and/or rerun [ANALYZE] if discrepancies are found.
7689
+ **
7690
+ ** Since this interface is expected to be rarely used, it is only
7691
+ ** available if SQLite is compiled using the [SQLITE_ENABLE_STMT_SCANSTATUS]
7692
+ ** compile-time option.
7693
+ **
7694
+ ** The "iScanStatusOp" parameter determines which status information to return.
7695
+ ** The "iScanStatusOp" must be one of the [scanstatus options] or the behavior
7696
+ ** of this interface is undefined.
7697
+ ** ^The requested measurement is written into a variable pointed to by
7698
+ ** the "pOut" parameter.
7699
+ ** Parameter "idx" identifies the specific loop to retrieve statistics for.
7700
+ ** Loops are numbered starting from zero. ^If idx is out of range - less than
7701
+ ** zero or greater than or equal to the total number of loops used to implement
7702
+ ** the statement - a non-zero value is returned and the variable that pOut
7703
+ ** points to is unchanged.
7704
+ **
7705
+ ** ^Statistics might not be available for all loops in all statements. ^In cases
7706
+ ** where there exist loops with no available statistics, this function behaves
7707
+ ** as if the loop did not exist - it returns non-zero and leave the variable
7708
+ ** that pOut points to unchanged.
7709
+ **
7710
+ ** See also: [sqlite3_stmt_scanstatus_reset()]
7711
+ */
7712
+ SQLITE_API int SQLITE_STDCALL sqlite3_stmt_scanstatus(
7713
+ sqlite3_stmt *pStmt, /* Prepared statement for which info desired */
7714
+ int idx, /* Index of loop to report on */
7715
+ int iScanStatusOp, /* Information desired. SQLITE_SCANSTAT_* */
7716
+ void *pOut /* Result written here */
7717
+ );
7718
+
7719
+ /*
7720
+ ** CAPI3REF: Zero Scan-Status Counters
7721
+ ** METHOD: sqlite3_stmt
7722
+ **
7723
+ ** ^Zero all [sqlite3_stmt_scanstatus()] related event counters.
7724
+ **
7725
+ ** This API is only available if the library is built with pre-processor
7726
+ ** symbol [SQLITE_ENABLE_STMT_SCANSTATUS] defined.
7727
+ */
7728
+ SQLITE_API void SQLITE_STDCALL sqlite3_stmt_scanstatus_reset(sqlite3_stmt*);
7414
7729
 
7415
7730
 
7416
7731
  /*
@@ -7465,7 +7780,7 @@ typedef struct sqlite3_rtree_query_info sqlite3_rtree_query_info;
7465
7780
  **
7466
7781
  ** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zGeom(... params ...)
7467
7782
  */
7468
- SQLITE_API int sqlite3_rtree_geometry_callback(
7783
+ SQLITE_API int SQLITE_STDCALL sqlite3_rtree_geometry_callback(
7469
7784
  sqlite3 *db,
7470
7785
  const char *zGeom,
7471
7786
  int (*xGeom)(sqlite3_rtree_geometry*, int, sqlite3_rtree_dbl*,int*),
@@ -7491,7 +7806,7 @@ struct sqlite3_rtree_geometry {
7491
7806
  **
7492
7807
  ** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zQueryFunc(... params ...)
7493
7808
  */
7494
- SQLITE_API int sqlite3_rtree_query_callback(
7809
+ SQLITE_API int SQLITE_STDCALL sqlite3_rtree_query_callback(
7495
7810
  sqlite3 *db,
7496
7811
  const char *zQueryFunc,
7497
7812
  int (*xQueryFunc)(sqlite3_rtree_query_info*),
@@ -7525,6 +7840,8 @@ struct sqlite3_rtree_query_info {
7525
7840
  int eParentWithin; /* Visibility of parent node */
7526
7841
  int eWithin; /* OUT: Visiblity */
7527
7842
  sqlite3_rtree_dbl rScore; /* OUT: Write the score here */
7843
+ /* The following fields are only available in 3.8.11 and later */
7844
+ sqlite3_value **apSqlParam; /* Original SQL values of parameters */
7528
7845
  };
7529
7846
 
7530
7847
  /*