poppler 2.2.5-x64-mingw32 → 3.0.0-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +18 -4
  3. data/lib/2.0/poppler.so +0 -0
  4. data/lib/2.1/poppler.so +0 -0
  5. data/lib/2.2/poppler.so +0 -0
  6. data/vendor/local/bin/cjpeg.exe +0 -0
  7. data/vendor/local/bin/djpeg.exe +0 -0
  8. data/vendor/local/bin/jpegtran.exe +0 -0
  9. data/vendor/local/bin/libjpeg-9.dll +0 -0
  10. data/vendor/local/bin/libopenjp2.dll +0 -0
  11. data/vendor/local/bin/{libpoppler-48.dll → libpoppler-55.dll} +0 -0
  12. data/vendor/local/bin/libpoppler-cpp-0.dll +0 -0
  13. data/vendor/local/bin/libpoppler-glib-8.dll +0 -0
  14. data/vendor/local/bin/libsqlite3-0.dll +0 -0
  15. data/vendor/local/bin/opj_compress.exe +0 -0
  16. data/vendor/local/bin/opj_decompress.exe +0 -0
  17. data/vendor/local/bin/opj_dump.exe +0 -0
  18. data/vendor/local/bin/pdfdetach.exe +0 -0
  19. data/vendor/local/bin/pdffonts.exe +0 -0
  20. data/vendor/local/bin/pdfimages.exe +0 -0
  21. data/vendor/local/bin/pdfinfo.exe +0 -0
  22. data/vendor/local/bin/pdfseparate.exe +0 -0
  23. data/vendor/local/bin/pdftocairo.exe +0 -0
  24. data/vendor/local/bin/pdftohtml.exe +0 -0
  25. data/vendor/local/bin/pdftoppm.exe +0 -0
  26. data/vendor/local/bin/pdftops.exe +0 -0
  27. data/vendor/local/bin/pdftotext.exe +0 -0
  28. data/vendor/local/bin/pdfunite.exe +0 -0
  29. data/vendor/local/bin/rdjpgcom.exe +0 -0
  30. data/vendor/local/bin/sqlite3.exe +0 -0
  31. data/vendor/local/bin/wrjpgcom.exe +0 -0
  32. data/vendor/local/include/openjpeg-2.1/openjpeg.h +1559 -0
  33. data/vendor/local/include/openjpeg-2.1/opj_config.h +10 -0
  34. data/vendor/local/include/openjpeg-2.1/opj_stdint.h +52 -0
  35. data/vendor/local/include/poppler/cpp/poppler-global.h +5 -0
  36. data/vendor/local/include/poppler/cpp/poppler-version.h +2 -2
  37. data/vendor/local/include/poppler/glib/poppler-annot.h +2 -0
  38. data/vendor/local/include/poppler/glib/poppler-features.h +1 -1
  39. data/vendor/local/include/sqlite3.h +1023 -657
  40. data/vendor/local/include/sqlite3ext.h +42 -2
  41. data/vendor/local/lib/girepository-1.0/Poppler-0.18.typelib +0 -0
  42. data/vendor/local/lib/libjpeg.a +0 -0
  43. data/vendor/local/lib/libjpeg.dll.a +0 -0
  44. data/vendor/local/lib/libopenjp2.dll.a +0 -0
  45. data/vendor/local/lib/libpoppler-cpp.a +0 -0
  46. data/vendor/local/lib/libpoppler-cpp.dll.a +0 -0
  47. data/vendor/local/lib/libpoppler-cpp.la +2 -2
  48. data/vendor/local/lib/libpoppler-glib.a +0 -0
  49. data/vendor/local/lib/libpoppler-glib.dll.a +0 -0
  50. data/vendor/local/lib/libpoppler-glib.la +3 -3
  51. data/vendor/local/lib/libpoppler.a +0 -0
  52. data/vendor/local/lib/libpoppler.dll.a +0 -0
  53. data/vendor/local/lib/libpoppler.la +3 -3
  54. data/vendor/local/lib/libsqlite3.a +0 -0
  55. data/vendor/local/lib/libsqlite3.dll.a +0 -0
  56. data/vendor/local/lib/openjpeg-2.1/OpenJPEGConfig.cmake +48 -0
  57. data/vendor/local/lib/openjpeg-2.1/OpenJPEGTargets-noconfig.cmake +46 -0
  58. data/vendor/local/lib/openjpeg-2.1/OpenJPEGTargets.cmake +92 -0
  59. data/vendor/local/lib/pkgconfig/libopenjp2.pc +14 -0
  60. data/vendor/local/lib/pkgconfig/poppler-cairo.pc +2 -2
  61. data/vendor/local/lib/pkgconfig/poppler-cpp.pc +2 -2
  62. data/vendor/local/lib/pkgconfig/poppler-glib.pc +2 -2
  63. data/vendor/local/lib/pkgconfig/poppler-splash.pc +2 -2
  64. data/vendor/local/lib/pkgconfig/poppler.pc +1 -1
  65. data/vendor/local/lib/pkgconfig/sqlite3.pc +1 -1
  66. data/vendor/local/share/gir-1.0/Poppler-0.18.gir +23 -2
  67. data/vendor/local/share/gtk-doc/html/poppler/PopplerAnnot.html +111 -66
  68. data/vendor/local/share/gtk-doc/html/poppler/annotation-glossary.html +2 -2
  69. data/vendor/local/share/gtk-doc/html/poppler/api-index-0-22.html +2 -2
  70. data/vendor/local/share/gtk-doc/html/poppler/api-index-0-26.html +419 -0
  71. data/vendor/local/share/gtk-doc/html/poppler/api-index-0-33.html +35 -0
  72. data/vendor/local/share/gtk-doc/html/poppler/api-index-full.html +4 -0
  73. data/vendor/local/share/gtk-doc/html/poppler/index.html +3 -1
  74. data/vendor/local/share/gtk-doc/html/poppler/index.sgml +1 -0
  75. data/vendor/local/share/gtk-doc/html/poppler/poppler-Version-and-Features-Information.html +1 -1
  76. data/vendor/local/share/gtk-doc/html/poppler/poppler.devhelp2 +3 -0
  77. data/vendor/local/share/license/openjpeg/AUTHORS +15 -0
  78. data/vendor/local/share/man/man1/pdftops.1 +18 -1
  79. data/vendor/local/share/man/man1/pdftotext.1 +4 -0
  80. data/vendor/local/share/man/man1/sqlite3.1 +45 -38
  81. metadata +20 -5
@@ -0,0 +1,10 @@
1
+ /* create opj_config.h for CMake */
2
+ #define OPJ_HAVE_STDINT_H 1
3
+
4
+ /*--------------------------------------------------------------------------*/
5
+ /* OpenJPEG Versioning */
6
+
7
+ /* Version number. */
8
+ #define OPJ_VERSION_MAJOR 2
9
+ #define OPJ_VERSION_MINOR 1
10
+ #define OPJ_VERSION_BUILD 0
@@ -0,0 +1,52 @@
1
+ /*
2
+ * The copyright in this software is being made available under the 2-clauses
3
+ * BSD License, included below. This software may be subject to other third
4
+ * party and contributor rights, including patent rights, and no such rights
5
+ * are granted under this license.
6
+ *
7
+ * Copyright (c) 2012, Mathieu Malaterre <mathieu.malaterre@gmail.com>
8
+ * All rights reserved.
9
+ *
10
+ * Redistribution and use in source and binary forms, with or without
11
+ * modification, are permitted provided that the following conditions
12
+ * are met:
13
+ * 1. Redistributions of source code must retain the above copyright
14
+ * notice, this list of conditions and the following disclaimer.
15
+ * 2. Redistributions in binary form must reproduce the above copyright
16
+ * notice, this list of conditions and the following disclaimer in the
17
+ * documentation and/or other materials provided with the distribution.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
+ * POSSIBILITY OF SUCH DAMAGE.
30
+ */
31
+ #ifndef OPJ_STDINT_H
32
+ #define OPJ_STDINT_H
33
+
34
+ #include "opj_config.h"
35
+ #ifdef OPJ_HAVE_STDINT_H
36
+ #include <stdint.h>
37
+ #else
38
+ #if defined(_WIN32)
39
+ typedef signed __int8 int8_t;
40
+ typedef unsigned __int8 uint8_t;
41
+ typedef signed __int16 int16_t;
42
+ typedef unsigned __int16 uint16_t;
43
+ typedef signed __int32 int32_t;
44
+ typedef unsigned __int32 uint32_t;
45
+ typedef signed __int64 int64_t;
46
+ typedef unsigned __int64 uint64_t;
47
+ #else
48
+ #error unsupported platform
49
+ #endif
50
+ #endif
51
+
52
+ #endif /* OPJ_STDINT_H */
@@ -1,6 +1,7 @@
1
1
  /*
2
2
  * Copyright (C) 2009-2010, Pino Toscano <pino@kde.org>
3
3
  * Copyright (C) 2010, Patrick Spendrin <ps_ml@gmx.de>
4
+ * Copyright (C) 2014, Hans-Peter Deifel <hpdeifel@gmx.de>
4
5
  *
5
6
  * This program is free software; you can redistribute it and/or modify
6
7
  * it under the terms of the GNU General Public License as published by
@@ -106,6 +107,10 @@ POPPLER_CPP_EXPORT time_type convert_date(const std::string &date);
106
107
 
107
108
  POPPLER_CPP_EXPORT std::ostream& operator<<(std::ostream& stream, const byte_array &array);
108
109
 
110
+ typedef void(*debug_func)(const std::string &, void *);
111
+
112
+ POPPLER_CPP_EXPORT void set_debug_error_function(debug_func debug_function, void *closure);
113
+
109
114
  }
110
115
 
111
116
  #endif
@@ -21,9 +21,9 @@
21
21
 
22
22
  #include "poppler-global.h"
23
23
 
24
- #define POPPLER_VERSION "0.29.0"
24
+ #define POPPLER_VERSION "0.36.0"
25
25
  #define POPPLER_VERSION_MAJOR 0
26
- #define POPPLER_VERSION_MINOR 29
26
+ #define POPPLER_VERSION_MINOR 36
27
27
  #define POPPLER_VERSION_MICRO 0
28
28
 
29
29
  namespace poppler
@@ -202,6 +202,8 @@ void poppler_annot_markup_set_popup_is_open (
202
202
  gboolean is_open);
203
203
  gboolean poppler_annot_markup_get_popup_rectangle (PopplerAnnotMarkup *poppler_annot,
204
204
  PopplerRectangle *poppler_rect);
205
+ void poppler_annot_markup_set_popup_rectangle (PopplerAnnotMarkup *poppler_annot,
206
+ PopplerRectangle *poppler_rect);
205
207
  gdouble poppler_annot_markup_get_opacity (PopplerAnnotMarkup *poppler_annot);
206
208
  void poppler_annot_markup_set_opacity (PopplerAnnotMarkup *poppler_annot,
207
209
  gdouble opacity);
@@ -55,7 +55,7 @@
55
55
  *
56
56
  * Since: 0.12
57
57
  */
58
- #define POPPLER_MINOR_VERSION (29)
58
+ #define POPPLER_MINOR_VERSION (36)
59
59
 
60
60
  /**
61
61
  * POPPLER_MICRO_VERSION:
@@ -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.6"
111
- #define SQLITE_VERSION_NUMBER 3008006
112
- #define SQLITE_SOURCE_ID "2014-08-15 11:46:33 9491ba7d738528f168657adb43a198238abde19e"
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 */
@@ -497,6 +503,7 @@ SQLITE_API int sqlite3_exec(
497
503
  #define SQLITE_NOTICE_RECOVER_WAL (SQLITE_NOTICE | (1<<8))
498
504
  #define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8))
499
505
  #define SQLITE_WARNING_AUTOINDEX (SQLITE_WARNING | (1<<8))
506
+ #define SQLITE_AUTH_USER (SQLITE_AUTH | (1<<8))
500
507
 
501
508
  /*
502
509
  ** CAPI3REF: Flags For File Open Operations
@@ -755,14 +762,16 @@ struct sqlite3_io_methods {
755
762
  ** of the [sqlite3_io_methods] object and for the [sqlite3_file_control()]
756
763
  ** interface.
757
764
  **
765
+ ** <ul>
766
+ ** <li>[[SQLITE_FCNTL_LOCKSTATE]]
758
767
  ** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging. This
759
768
  ** opcode causes the xFileControl method to write the current state of
760
769
  ** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED],
761
770
  ** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE])
762
771
  ** into an integer that the pArg argument points to. This capability
763
- ** is used during testing and only needs to be supported when SQLITE_TEST
764
- ** is defined.
765
- ** <ul>
772
+ ** is used during testing and is only available when the SQLITE_TEST
773
+ ** compile-time option is used.
774
+ **
766
775
  ** <li>[[SQLITE_FCNTL_SIZE_HINT]]
767
776
  ** The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS
768
777
  ** layer a hint of how large the database file will grow to be during the
@@ -887,7 +896,9 @@ struct sqlite3_io_methods {
887
896
  ** [PRAGMA] processing continues. ^If the [SQLITE_FCNTL_PRAGMA]
888
897
  ** file control returns [SQLITE_OK], then the parser assumes that the
889
898
  ** VFS has handled the PRAGMA itself and the parser generates a no-op
890
- ** 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
891
902
  ** any result code other than [SQLITE_OK] or [SQLITE_NOTFOUND], that means
892
903
  ** that the VFS encountered an error while handling the [PRAGMA] and the
893
904
  ** compilation of the PRAGMA fails with an error. ^The [SQLITE_FCNTL_PRAGMA]
@@ -945,12 +956,27 @@ struct sqlite3_io_methods {
945
956
  ** pointed to by the pArg argument. This capability is used during testing
946
957
  ** and only needs to be supported when SQLITE_TEST is defined.
947
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.
948
974
  ** </ul>
949
975
  */
950
976
  #define SQLITE_FCNTL_LOCKSTATE 1
951
- #define SQLITE_GET_LOCKPROXYFILE 2
952
- #define SQLITE_SET_LOCKPROXYFILE 3
953
- #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
954
980
  #define SQLITE_FCNTL_SIZE_HINT 5
955
981
  #define SQLITE_FCNTL_CHUNK_SIZE 6
956
982
  #define SQLITE_FCNTL_FILE_POINTER 7
@@ -969,6 +995,15 @@ struct sqlite3_io_methods {
969
995
  #define SQLITE_FCNTL_SYNC 21
970
996
  #define SQLITE_FCNTL_COMMIT_PHASETWO 22
971
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
+
972
1007
 
973
1008
  /*
974
1009
  ** CAPI3REF: Mutex Handle
@@ -1220,7 +1255,7 @@ struct sqlite3_vfs {
1220
1255
  ** </ul>
1221
1256
  **
1222
1257
  ** When unlocking, the same SHARED or EXCLUSIVE flag must be supplied as
1223
- ** was given no the corresponding lock.
1258
+ ** was given on the corresponding lock.
1224
1259
  **
1225
1260
  ** The xShmLock method can transition between unlocked and SHARED or
1226
1261
  ** between unlocked and EXCLUSIVE. It cannot transition between SHARED
@@ -1317,10 +1352,10 @@ struct sqlite3_vfs {
1317
1352
  ** must return [SQLITE_OK] on success and some other [error code] upon
1318
1353
  ** failure.
1319
1354
  */
1320
- SQLITE_API int sqlite3_initialize(void);
1321
- SQLITE_API int sqlite3_shutdown(void);
1322
- SQLITE_API int sqlite3_os_init(void);
1323
- 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);
1324
1359
 
1325
1360
  /*
1326
1361
  ** CAPI3REF: Configuring The SQLite Library
@@ -1351,10 +1386,11 @@ SQLITE_API int sqlite3_os_end(void);
1351
1386
  ** ^If the option is unknown or SQLite is unable to set the option
1352
1387
  ** then this routine returns a non-zero [error code].
1353
1388
  */
1354
- SQLITE_API int sqlite3_config(int, ...);
1389
+ SQLITE_API int SQLITE_CDECL sqlite3_config(int, ...);
1355
1390
 
1356
1391
  /*
1357
1392
  ** CAPI3REF: Configure database connections
1393
+ ** METHOD: sqlite3
1358
1394
  **
1359
1395
  ** The sqlite3_db_config() interface is used to make configuration
1360
1396
  ** changes to a [database connection]. The interface is similar to
@@ -1369,7 +1405,7 @@ SQLITE_API int sqlite3_config(int, ...);
1369
1405
  ** ^Calls to sqlite3_db_config() return SQLITE_OK if and only if
1370
1406
  ** the call is considered successful.
1371
1407
  */
1372
- SQLITE_API int sqlite3_db_config(sqlite3*, int op, ...);
1408
+ SQLITE_API int SQLITE_CDECL sqlite3_db_config(sqlite3*, int op, ...);
1373
1409
 
1374
1410
  /*
1375
1411
  ** CAPI3REF: Memory Allocation Routines
@@ -1503,31 +1539,33 @@ struct sqlite3_mem_methods {
1503
1539
  ** SQLITE_CONFIG_SERIALIZED configuration option.</dd>
1504
1540
  **
1505
1541
  ** [[SQLITE_CONFIG_MALLOC]] <dt>SQLITE_CONFIG_MALLOC</dt>
1506
- ** <dd> ^(This option takes a single argument which is a pointer to an
1507
- ** 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
1508
1545
  ** alternative low-level memory allocation routines to be used in place of
1509
1546
  ** the memory allocation routines built into SQLite.)^ ^SQLite makes
1510
1547
  ** its own private copy of the content of the [sqlite3_mem_methods] structure
1511
1548
  ** before the [sqlite3_config()] call returns.</dd>
1512
1549
  **
1513
1550
  ** [[SQLITE_CONFIG_GETMALLOC]] <dt>SQLITE_CONFIG_GETMALLOC</dt>
1514
- ** <dd> ^(This option takes a single argument which is a pointer to an
1515
- ** 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]
1516
1554
  ** structure is filled with the currently defined memory allocation routines.)^
1517
1555
  ** This option can be used to overload the default memory allocation
1518
1556
  ** routines with a wrapper that simulations memory allocation failure or
1519
1557
  ** tracks memory usage, for example. </dd>
1520
1558
  **
1521
1559
  ** [[SQLITE_CONFIG_MEMSTATUS]] <dt>SQLITE_CONFIG_MEMSTATUS</dt>
1522
- ** <dd> ^This option takes single argument of type int, interpreted as a
1523
- ** boolean, which enables or disables the collection of memory allocation
1524
- ** statistics. ^(When memory allocation statistics are disabled, the
1525
- ** 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:
1526
1564
  ** <ul>
1527
1565
  ** <li> [sqlite3_memory_used()]
1528
1566
  ** <li> [sqlite3_memory_highwater()]
1529
1567
  ** <li> [sqlite3_soft_heap_limit64()]
1530
- ** <li> [sqlite3_status()]
1568
+ ** <li> [sqlite3_status64()]
1531
1569
  ** </ul>)^
1532
1570
  ** ^Memory allocation statistics are enabled by default unless SQLite is
1533
1571
  ** compiled with [SQLITE_DEFAULT_MEMSTATUS]=0 in which case memory
@@ -1535,53 +1573,67 @@ struct sqlite3_mem_methods {
1535
1573
  ** </dd>
1536
1574
  **
1537
1575
  ** [[SQLITE_CONFIG_SCRATCH]] <dt>SQLITE_CONFIG_SCRATCH</dt>
1538
- ** <dd> ^This option specifies a static memory buffer that SQLite can use for
1539
- ** 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
1540
1579
  ** aligned memory buffer from which the scratch allocations will be
1541
1580
  ** drawn, the size of each scratch allocation (sz),
1542
- ** and the maximum number of scratch allocations (N). The sz
1543
- ** argument must be a multiple of 16.
1581
+ ** and the maximum number of scratch allocations (N).)^
1544
1582
  ** The first argument must be a pointer to an 8-byte aligned buffer
1545
1583
  ** of at least sz*N bytes of memory.
1546
- ** ^SQLite will use no more than two scratch buffers per thread. So
1547
- ** N should be set to twice the expected maximum number of threads.
1548
- ** ^SQLite will never require a scratch buffer that is more than 6
1549
- ** 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
1550
1588
  ** scratch memory beyond what is provided by this configuration option, then
1551
- ** [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>
1552
1596
  **
1553
1597
  ** [[SQLITE_CONFIG_PAGECACHE]] <dt>SQLITE_CONFIG_PAGECACHE</dt>
1554
- ** <dd> ^This option specifies a static memory buffer that SQLite can use for
1555
- ** 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.
1556
1601
  ** This configuration should not be used if an application-define page
1557
- ** cache implementation is loaded using the SQLITE_CONFIG_PCACHE2 option.
1558
- ** 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
1559
1606
  ** memory, the size of each page buffer (sz), and the number of pages (N).
1560
1607
  ** The sz argument should be the size of the largest database page
1561
- ** (a power of two between 512 and 32768) plus a little extra for each
1562
- ** page header. ^The page header size is 20 to 40 bytes depending on
1563
- ** the host architecture. ^It is harmless, apart from the wasted memory,
1564
- ** to make sz a little too large. The first
1565
- ** 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.
1566
1617
  ** ^SQLite will use the memory provided by the first argument to satisfy its
1567
1618
  ** memory needs for the first N pages that it adds to cache. ^If additional
1568
1619
  ** page cache memory is needed beyond what is provided by this option, then
1569
- ** SQLite goes to [sqlite3_malloc()] for the additional storage space.
1570
- ** The pointer in the first argument must
1571
- ** be aligned to an 8-byte boundary or subsequent behavior of SQLite
1572
- ** will be undefined.</dd>
1620
+ ** SQLite goes to [sqlite3_malloc()] for the additional storage space.</dd>
1573
1621
  **
1574
1622
  ** [[SQLITE_CONFIG_HEAP]] <dt>SQLITE_CONFIG_HEAP</dt>
1575
- ** <dd> ^This option specifies a static memory buffer that SQLite will use
1576
- ** for all of its dynamic memory allocation needs beyond those provided
1577
- ** for by [SQLITE_CONFIG_SCRATCH] and [SQLITE_CONFIG_PAGECACHE].
1578
- ** 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,
1579
1632
  ** the number of bytes in the memory buffer, and the minimum allocation size.
1580
1633
  ** ^If the first pointer (the memory pointer) is NULL, then SQLite reverts
1581
1634
  ** to using its default memory allocator (the system malloc() implementation),
1582
1635
  ** undoing any prior invocation of [SQLITE_CONFIG_MALLOC]. ^If the
1583
- ** memory pointer is not NULL and either [SQLITE_ENABLE_MEMSYS3] or
1584
- ** [SQLITE_ENABLE_MEMSYS5] are defined, then the alternative memory
1636
+ ** memory pointer is not NULL then the alternative memory
1585
1637
  ** allocator is engaged to handle all of SQLites memory allocation needs.
1586
1638
  ** The first pointer (the memory pointer) must be aligned to an 8-byte
1587
1639
  ** boundary or subsequent behavior of SQLite will be undefined.
@@ -1589,11 +1641,11 @@ struct sqlite3_mem_methods {
1589
1641
  ** for the minimum allocation size are 2**5 through 2**8.</dd>
1590
1642
  **
1591
1643
  ** [[SQLITE_CONFIG_MUTEX]] <dt>SQLITE_CONFIG_MUTEX</dt>
1592
- ** <dd> ^(This option takes a single argument which is a pointer to an
1593
- ** instance of the [sqlite3_mutex_methods] structure. The argument specifies
1594
- ** alternative low-level mutex routines to be used in place
1595
- ** the mutex routines built into SQLite.)^ ^SQLite makes a copy of the
1596
- ** 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
1597
1649
  ** [sqlite3_config()] returns. ^If SQLite is compiled with
1598
1650
  ** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
1599
1651
  ** the entire mutexing subsystem is omitted from the build and hence calls to
@@ -1601,8 +1653,8 @@ struct sqlite3_mem_methods {
1601
1653
  ** return [SQLITE_ERROR].</dd>
1602
1654
  **
1603
1655
  ** [[SQLITE_CONFIG_GETMUTEX]] <dt>SQLITE_CONFIG_GETMUTEX</dt>
1604
- ** <dd> ^(This option takes a single argument which is a pointer to an
1605
- ** 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
1606
1658
  ** [sqlite3_mutex_methods]
1607
1659
  ** structure is filled with the currently defined mutex routines.)^
1608
1660
  ** This option can be used to overload the default mutex allocation
@@ -1614,25 +1666,25 @@ struct sqlite3_mem_methods {
1614
1666
  ** return [SQLITE_ERROR].</dd>
1615
1667
  **
1616
1668
  ** [[SQLITE_CONFIG_LOOKASIDE]] <dt>SQLITE_CONFIG_LOOKASIDE</dt>
1617
- ** <dd> ^(This option takes two arguments that determine the default
1618
- ** memory allocation for the lookaside memory allocator on each
1619
- ** [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
1620
1672
  ** size of each lookaside buffer slot and the second is the number of
1621
- ** slots allocated to each database connection.)^ ^(This option sets the
1622
- ** <i>default</i> lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE]
1623
- ** 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
1624
1676
  ** configuration on individual connections.)^ </dd>
1625
1677
  **
1626
1678
  ** [[SQLITE_CONFIG_PCACHE2]] <dt>SQLITE_CONFIG_PCACHE2</dt>
1627
- ** <dd> ^(This option takes a single argument which is a pointer to
1628
- ** an [sqlite3_pcache_methods2] object. This object specifies the interface
1629
- ** to a custom page cache implementation.)^ ^SQLite makes a copy of the
1630
- ** 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>
1631
1683
  **
1632
1684
  ** [[SQLITE_CONFIG_GETPCACHE2]] <dt>SQLITE_CONFIG_GETPCACHE2</dt>
1633
- ** <dd> ^(This option takes a single argument which is a pointer to an
1634
- ** [sqlite3_pcache_methods2] object. SQLite copies of the current
1635
- ** 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>
1636
1688
  **
1637
1689
  ** [[SQLITE_CONFIG_LOG]] <dt>SQLITE_CONFIG_LOG</dt>
1638
1690
  ** <dd> The SQLITE_CONFIG_LOG option is used to configure the SQLite
@@ -1655,10 +1707,11 @@ struct sqlite3_mem_methods {
1655
1707
  ** function must be threadsafe. </dd>
1656
1708
  **
1657
1709
  ** [[SQLITE_CONFIG_URI]] <dt>SQLITE_CONFIG_URI
1658
- ** <dd>^(This option takes a single argument of type int. If non-zero, then
1659
- ** URI handling is globally enabled. If the parameter is zero, then URI handling
1660
- ** is globally disabled.)^ ^If URI handling is globally enabled, all filenames
1661
- ** 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
1662
1715
  ** specified as part of [ATTACH] commands are interpreted as URIs, regardless
1663
1716
  ** of whether or not the [SQLITE_OPEN_URI] flag is set when the database
1664
1717
  ** connection is opened. ^If it is globally disabled, filenames are
@@ -1668,9 +1721,10 @@ struct sqlite3_mem_methods {
1668
1721
  ** [SQLITE_USE_URI] symbol defined.)^
1669
1722
  **
1670
1723
  ** [[SQLITE_CONFIG_COVERING_INDEX_SCAN]] <dt>SQLITE_CONFIG_COVERING_INDEX_SCAN
1671
- ** <dd>^This option takes a single integer argument which is interpreted as
1672
- ** a boolean in order to enable or disable the use of covering indices for
1673
- ** 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
1674
1728
  ** by the [SQLITE_ALLOW_COVERING_INDEX_SCAN] compile-time option, or is "on"
1675
1729
  ** if that compile-time option is omitted.
1676
1730
  ** The ability to disable the use of covering indices for full table scans
@@ -1710,18 +1764,37 @@ struct sqlite3_mem_methods {
1710
1764
  ** ^The default setting can be overridden by each database connection using
1711
1765
  ** either the [PRAGMA mmap_size] command, or by using the
1712
1766
  ** [SQLITE_FCNTL_MMAP_SIZE] file control. ^(The maximum allowed mmap size
1713
- ** cannot be changed at run-time. Nor may the maximum allowed mmap size
1714
- ** 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
1715
1769
  ** [SQLITE_MAX_MMAP_SIZE] compile-time option.)^
1716
1770
  ** ^If either argument to this option is negative, then that argument is
1717
1771
  ** changed to its compile-time default.
1718
1772
  **
1719
1773
  ** [[SQLITE_CONFIG_WIN32_HEAPSIZE]]
1720
1774
  ** <dt>SQLITE_CONFIG_WIN32_HEAPSIZE
1721
- ** <dd>^This option is only available if SQLite is compiled for Windows
1722
- ** with the [SQLITE_WIN32_MALLOC] pre-processor macro defined.
1723
- ** 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
1724
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.
1725
1798
  ** </dl>
1726
1799
  */
1727
1800
  #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
@@ -1747,6 +1820,8 @@ struct sqlite3_mem_methods {
1747
1820
  #define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */
1748
1821
  #define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */
1749
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 */
1750
1825
 
1751
1826
  /*
1752
1827
  ** CAPI3REF: Database Connection Configuration Options
@@ -1813,15 +1888,17 @@ struct sqlite3_mem_methods {
1813
1888
 
1814
1889
  /*
1815
1890
  ** CAPI3REF: Enable Or Disable Extended Result Codes
1891
+ ** METHOD: sqlite3
1816
1892
  **
1817
1893
  ** ^The sqlite3_extended_result_codes() routine enables or disables the
1818
1894
  ** [extended result codes] feature of SQLite. ^The extended result
1819
1895
  ** codes are disabled by default for historical compatibility.
1820
1896
  */
1821
- SQLITE_API int sqlite3_extended_result_codes(sqlite3*, int onoff);
1897
+ SQLITE_API int SQLITE_STDCALL sqlite3_extended_result_codes(sqlite3*, int onoff);
1822
1898
 
1823
1899
  /*
1824
1900
  ** CAPI3REF: Last Insert Rowid
1901
+ ** METHOD: sqlite3
1825
1902
  **
1826
1903
  ** ^Each entry in most SQLite tables (except for [WITHOUT ROWID] tables)
1827
1904
  ** has a unique 64-bit signed
@@ -1869,52 +1946,51 @@ SQLITE_API int sqlite3_extended_result_codes(sqlite3*, int onoff);
1869
1946
  ** unpredictable and might not equal either the old or the new
1870
1947
  ** last insert [rowid].
1871
1948
  */
1872
- SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);
1949
+ SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_last_insert_rowid(sqlite3*);
1873
1950
 
1874
1951
  /*
1875
1952
  ** CAPI3REF: Count The Number Of Rows Modified
1953
+ ** METHOD: sqlite3
1876
1954
  **
1877
- ** ^This function returns the number of database rows that were changed
1878
- ** or inserted or deleted by the most recently completed SQL statement
1879
- ** on the [database connection] specified by the first parameter.
1880
- ** ^(Only changes that are directly specified by the [INSERT], [UPDATE],
1881
- ** or [DELETE] statement are counted. Auxiliary changes caused by
1882
- ** triggers or [foreign key actions] are not counted.)^ Use the
1883
- ** [sqlite3_total_changes()] function to find the total number of changes
1884
- ** including changes caused by triggers and foreign key actions.
1885
- **
1886
- ** ^Changes to a view that are simulated by an [INSTEAD OF trigger]
1887
- ** are not counted. Only real table changes are counted.
1888
- **
1889
- ** ^(A "row change" is a change to a single row of a single table
1890
- ** caused by an INSERT, DELETE, or UPDATE statement. Rows that
1891
- ** are changed as side effects of [REPLACE] constraint resolution,
1892
- ** rollback, ABORT processing, [DROP TABLE], or by any other
1893
- ** mechanisms do not count as direct row changes.)^
1894
- **
1895
- ** A "trigger context" is a scope of execution that begins and
1896
- ** ends with the script of a [CREATE TRIGGER | trigger].
1897
- ** Most SQL statements are
1898
- ** evaluated outside of any trigger. This is the "top level"
1899
- ** trigger context. If a trigger fires from the top level, a
1900
- ** new trigger context is entered for the duration of that one
1901
- ** trigger. Subtriggers create subcontexts for their duration.
1902
- **
1903
- ** ^Calling [sqlite3_exec()] or [sqlite3_step()] recursively does
1904
- ** not create a new trigger context.
1905
- **
1906
- ** ^This function returns the number of direct row changes in the
1907
- ** most recent INSERT, UPDATE, or DELETE statement within the same
1908
- ** trigger context.
1909
- **
1910
- ** ^Thus, when called from the top level, this function returns the
1911
- ** number of changes in the most recent INSERT, UPDATE, or DELETE
1912
- ** that also occurred at the top level. ^(Within the body of a trigger,
1913
- ** the sqlite3_changes() interface can be called to find the number of
1914
- ** changes in the most recently completed INSERT, UPDATE, or DELETE
1915
- ** statement within the body of the same trigger.
1916
- ** However, the number returned does not include changes
1917
- ** 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.
1918
1994
  **
1919
1995
  ** See also the [sqlite3_total_changes()] interface, the
1920
1996
  ** [count_changes pragma], and the [changes() SQL function].
@@ -1923,25 +1999,23 @@ SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);
1923
1999
  ** while [sqlite3_changes()] is running then the value returned
1924
2000
  ** is unpredictable and not meaningful.
1925
2001
  */
1926
- SQLITE_API int sqlite3_changes(sqlite3*);
2002
+ SQLITE_API int SQLITE_STDCALL sqlite3_changes(sqlite3*);
1927
2003
 
1928
2004
  /*
1929
2005
  ** CAPI3REF: Total Number Of Rows Modified
2006
+ ** METHOD: sqlite3
1930
2007
  **
1931
- ** ^This function returns the number of row changes caused by [INSERT],
1932
- ** [UPDATE] or [DELETE] statements since the [database connection] was opened.
1933
- ** ^(The count returned by sqlite3_total_changes() includes all changes
1934
- ** from all [CREATE TRIGGER | trigger] contexts and changes made by
1935
- ** [foreign key actions]. However,
1936
- ** the count does not include changes used to implement [REPLACE] constraints,
1937
- ** do rollbacks or ABORT processing, or [DROP TABLE] processing. The
1938
- ** count does not include rows of views that fire an [INSTEAD OF trigger],
1939
- ** though if the INSTEAD OF trigger makes changes of its own, those changes
1940
- ** are counted.)^
1941
- ** ^The sqlite3_total_changes() function counts the changes as soon as
1942
- ** the statement that makes them is completed (when the statement handle
1943
- ** is passed to [sqlite3_reset()] or [sqlite3_finalize()]).
1944
- **
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
+ **
1945
2019
  ** See also the [sqlite3_changes()] interface, the
1946
2020
  ** [count_changes pragma], and the [total_changes() SQL function].
1947
2021
  **
@@ -1949,10 +2023,11 @@ SQLITE_API int sqlite3_changes(sqlite3*);
1949
2023
  ** while [sqlite3_total_changes()] is running then the value
1950
2024
  ** returned is unpredictable and not meaningful.
1951
2025
  */
1952
- SQLITE_API int sqlite3_total_changes(sqlite3*);
2026
+ SQLITE_API int SQLITE_STDCALL sqlite3_total_changes(sqlite3*);
1953
2027
 
1954
2028
  /*
1955
2029
  ** CAPI3REF: Interrupt A Long-Running Query
2030
+ ** METHOD: sqlite3
1956
2031
  **
1957
2032
  ** ^This function causes any pending database operation to abort and
1958
2033
  ** return at its earliest opportunity. This routine is typically
@@ -1988,7 +2063,7 @@ SQLITE_API int sqlite3_total_changes(sqlite3*);
1988
2063
  ** If the database connection closes while [sqlite3_interrupt()]
1989
2064
  ** is running then bad things will likely happen.
1990
2065
  */
1991
- SQLITE_API void sqlite3_interrupt(sqlite3*);
2066
+ SQLITE_API void SQLITE_STDCALL sqlite3_interrupt(sqlite3*);
1992
2067
 
1993
2068
  /*
1994
2069
  ** CAPI3REF: Determine If An SQL Statement Is Complete
@@ -2023,11 +2098,13 @@ SQLITE_API void sqlite3_interrupt(sqlite3*);
2023
2098
  ** The input to [sqlite3_complete16()] must be a zero-terminated
2024
2099
  ** UTF-16 string in native byte order.
2025
2100
  */
2026
- SQLITE_API int sqlite3_complete(const char *sql);
2027
- 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);
2028
2103
 
2029
2104
  /*
2030
2105
  ** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors
2106
+ ** KEYWORDS: {busy-handler callback} {busy handler}
2107
+ ** METHOD: sqlite3
2031
2108
  **
2032
2109
  ** ^The sqlite3_busy_handler(D,X,P) routine sets a callback function X
2033
2110
  ** that might be invoked with argument P whenever
@@ -2044,7 +2121,7 @@ SQLITE_API int sqlite3_complete16(const void *sql);
2044
2121
  ** ^The first argument to the busy handler is a copy of the void* pointer which
2045
2122
  ** is the third argument to sqlite3_busy_handler(). ^The second argument to
2046
2123
  ** the busy handler callback is the number of times that the busy handler has
2047
- ** been invoked for the same locking event. ^If the
2124
+ ** been invoked previously for the same locking event. ^If the
2048
2125
  ** busy callback returns 0, then no additional attempts are made to
2049
2126
  ** access the database and [SQLITE_BUSY] is returned
2050
2127
  ** to the application.
@@ -2083,10 +2160,11 @@ SQLITE_API int sqlite3_complete16(const void *sql);
2083
2160
  ** A busy handler must not close the database connection
2084
2161
  ** or [prepared statement] that invoked the busy handler.
2085
2162
  */
2086
- 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*);
2087
2164
 
2088
2165
  /*
2089
2166
  ** CAPI3REF: Set A Busy Timeout
2167
+ ** METHOD: sqlite3
2090
2168
  **
2091
2169
  ** ^This routine sets a [sqlite3_busy_handler | busy handler] that sleeps
2092
2170
  ** for a specified amount of time when a table is locked. ^The handler
@@ -2099,16 +2177,17 @@ SQLITE_API int sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*);
2099
2177
  ** turns off all busy handlers.
2100
2178
  **
2101
2179
  ** ^(There can only be a single busy handler for a particular
2102
- ** [database connection] any any given moment. If another busy handler
2180
+ ** [database connection] at any given moment. If another busy handler
2103
2181
  ** was defined (using [sqlite3_busy_handler()]) prior to calling
2104
2182
  ** this routine, that other busy handler is cleared.)^
2105
2183
  **
2106
2184
  ** See also: [PRAGMA busy_timeout]
2107
2185
  */
2108
- SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms);
2186
+ SQLITE_API int SQLITE_STDCALL sqlite3_busy_timeout(sqlite3*, int ms);
2109
2187
 
2110
2188
  /*
2111
2189
  ** CAPI3REF: Convenience Routines For Running Queries
2190
+ ** METHOD: sqlite3
2112
2191
  **
2113
2192
  ** This is a legacy interface that is preserved for backwards compatibility.
2114
2193
  ** Use of this interface is not recommended.
@@ -2179,7 +2258,7 @@ SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms);
2179
2258
  ** reflected in subsequent calls to [sqlite3_errcode()] or
2180
2259
  ** [sqlite3_errmsg()].
2181
2260
  */
2182
- SQLITE_API int sqlite3_get_table(
2261
+ SQLITE_API int SQLITE_STDCALL sqlite3_get_table(
2183
2262
  sqlite3 *db, /* An open database */
2184
2263
  const char *zSql, /* SQL to be evaluated */
2185
2264
  char ***pazResult, /* Results of the query */
@@ -2187,13 +2266,17 @@ SQLITE_API int sqlite3_get_table(
2187
2266
  int *pnColumn, /* Number of result columns written here */
2188
2267
  char **pzErrmsg /* Error msg written here */
2189
2268
  );
2190
- SQLITE_API void sqlite3_free_table(char **result);
2269
+ SQLITE_API void SQLITE_STDCALL sqlite3_free_table(char **result);
2191
2270
 
2192
2271
  /*
2193
2272
  ** CAPI3REF: Formatted String Printing Functions
2194
2273
  **
2195
2274
  ** These routines are work-alikes of the "printf()" family of functions
2196
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.
2197
2280
  **
2198
2281
  ** ^The sqlite3_mprintf() and sqlite3_vmprintf() routines write their
2199
2282
  ** results into memory obtained from [sqlite3_malloc()].
@@ -2226,7 +2309,7 @@ SQLITE_API void sqlite3_free_table(char **result);
2226
2309
  ** These routines all implement some additional formatting
2227
2310
  ** options that are useful for constructing SQL statements.
2228
2311
  ** All of the usual printf() formatting options apply. In addition, there
2229
- ** is are "%q", "%Q", and "%z" options.
2312
+ ** is are "%q", "%Q", "%w" and "%z" options.
2230
2313
  **
2231
2314
  ** ^(The %q option works like %s in that it substitutes a nul-terminated
2232
2315
  ** string from the argument list. But %q also doubles every '\'' character.
@@ -2279,14 +2362,20 @@ SQLITE_API void sqlite3_free_table(char **result);
2279
2362
  ** The code above will render a correct SQL statement in the zSQL
2280
2363
  ** variable even if the zText variable is a NULL pointer.
2281
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
+ **
2282
2371
  ** ^(The "%z" formatting option works like "%s" but with the
2283
2372
  ** addition that after the string has been read and copied into
2284
2373
  ** the result, [sqlite3_free()] is called on the input string.)^
2285
2374
  */
2286
- SQLITE_API char *sqlite3_mprintf(const char*,...);
2287
- SQLITE_API char *sqlite3_vmprintf(const char*, va_list);
2288
- SQLITE_API char *sqlite3_snprintf(int,char*,const char*, ...);
2289
- 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);
2290
2379
 
2291
2380
  /*
2292
2381
  ** CAPI3REF: Memory Allocation Subsystem
@@ -2303,6 +2392,10 @@ SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list);
2303
2392
  ** sqlite3_malloc() is zero or negative then sqlite3_malloc() returns
2304
2393
  ** a NULL pointer.
2305
2394
  **
2395
+ ** ^The sqlite3_malloc64(N) routine works just like
2396
+ ** sqlite3_malloc(N) except that N is an unsigned 64-bit integer instead
2397
+ ** of a signed 32-bit integer.
2398
+ **
2306
2399
  ** ^Calling sqlite3_free() with a pointer previously returned
2307
2400
  ** by sqlite3_malloc() or sqlite3_realloc() releases that memory so
2308
2401
  ** that it might be reused. ^The sqlite3_free() routine is
@@ -2314,24 +2407,38 @@ SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list);
2314
2407
  ** might result if sqlite3_free() is called with a non-NULL pointer that
2315
2408
  ** was not obtained from sqlite3_malloc() or sqlite3_realloc().
2316
2409
  **
2317
- ** ^(The sqlite3_realloc() interface attempts to resize a
2318
- ** prior memory allocation to be at least N bytes, where N is the
2319
- ** second parameter. The memory allocation to be resized is the first
2320
- ** parameter.)^ ^ If the first parameter to sqlite3_realloc()
2410
+ ** ^The sqlite3_realloc(X,N) interface attempts to resize a
2411
+ ** prior memory allocation X to be at least N bytes.
2412
+ ** ^If the X parameter to sqlite3_realloc(X,N)
2321
2413
  ** is a NULL pointer then its behavior is identical to calling
2322
- ** sqlite3_malloc(N) where N is the second parameter to sqlite3_realloc().
2323
- ** ^If the second parameter to sqlite3_realloc() is zero or
2414
+ ** sqlite3_malloc(N).
2415
+ ** ^If the N parameter to sqlite3_realloc(X,N) is zero or
2324
2416
  ** negative then the behavior is exactly the same as calling
2325
- ** sqlite3_free(P) where P is the first parameter to sqlite3_realloc().
2326
- ** ^sqlite3_realloc() returns a pointer to a memory allocation
2327
- ** of at least N bytes in size or NULL if sufficient memory is unavailable.
2417
+ ** sqlite3_free(X).
2418
+ ** ^sqlite3_realloc(X,N) returns a pointer to a memory allocation
2419
+ ** of at least N bytes in size or NULL if insufficient memory is available.
2328
2420
  ** ^If M is the size of the prior allocation, then min(N,M) bytes
2329
2421
  ** of the prior allocation are copied into the beginning of buffer returned
2330
- ** by sqlite3_realloc() and the prior allocation is freed.
2331
- ** ^If sqlite3_realloc() returns NULL, then the prior allocation
2332
- ** is not freed.
2333
- **
2334
- ** ^The memory returned by sqlite3_malloc() and sqlite3_realloc()
2422
+ ** by sqlite3_realloc(X,N) and the prior allocation is freed.
2423
+ ** ^If sqlite3_realloc(X,N) returns NULL and N is positive, then the
2424
+ ** prior allocation is not freed.
2425
+ **
2426
+ ** ^The sqlite3_realloc64(X,N) interfaces works the same as
2427
+ ** sqlite3_realloc(X,N) except that N is a 64-bit unsigned integer instead
2428
+ ** of a 32-bit signed integer.
2429
+ **
2430
+ ** ^If X is a memory allocation previously obtained from sqlite3_malloc(),
2431
+ ** sqlite3_malloc64(), sqlite3_realloc(), or sqlite3_realloc64(), then
2432
+ ** sqlite3_msize(X) returns the size of that memory allocation in bytes.
2433
+ ** ^The value returned by sqlite3_msize(X) might be larger than the number
2434
+ ** of bytes requested when X was allocated. ^If X is a NULL pointer then
2435
+ ** sqlite3_msize(X) returns zero. If X points to something that is not
2436
+ ** the beginning of memory allocation, or if it points to a formerly
2437
+ ** valid memory allocation that has now been freed, then the behavior
2438
+ ** of sqlite3_msize(X) is undefined and possibly harmful.
2439
+ **
2440
+ ** ^The memory returned by sqlite3_malloc(), sqlite3_realloc(),
2441
+ ** sqlite3_malloc64(), and sqlite3_realloc64()
2335
2442
  ** is always aligned to at least an 8 byte boundary, or to a
2336
2443
  ** 4 byte boundary if the [SQLITE_4_BYTE_ALIGNED_MALLOC] compile-time
2337
2444
  ** option is used.
@@ -2358,9 +2465,12 @@ SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list);
2358
2465
  ** a block of memory after it has been released using
2359
2466
  ** [sqlite3_free()] or [sqlite3_realloc()].
2360
2467
  */
2361
- SQLITE_API void *sqlite3_malloc(int);
2362
- SQLITE_API void *sqlite3_realloc(void*, int);
2363
- SQLITE_API void sqlite3_free(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*);
2364
2474
 
2365
2475
  /*
2366
2476
  ** CAPI3REF: Memory Allocator Statistics
@@ -2385,8 +2495,8 @@ SQLITE_API void sqlite3_free(void*);
2385
2495
  ** by [sqlite3_memory_highwater(1)] is the high-water mark
2386
2496
  ** prior to the reset.
2387
2497
  */
2388
- SQLITE_API sqlite3_int64 sqlite3_memory_used(void);
2389
- 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);
2390
2500
 
2391
2501
  /*
2392
2502
  ** CAPI3REF: Pseudo-Random Number Generator
@@ -2398,20 +2508,22 @@ SQLITE_API sqlite3_int64 sqlite3_memory_highwater(int resetFlag);
2398
2508
  ** applications to access the same PRNG for other purposes.
2399
2509
  **
2400
2510
  ** ^A call to this routine stores N bytes of randomness into buffer P.
2401
- ** ^If N is less than one, then P can be a NULL pointer.
2511
+ ** ^The P parameter can be a NULL pointer.
2402
2512
  **
2403
2513
  ** ^If this routine has not been previously called or if the previous
2404
- ** call had N less than one, then the PRNG is seeded using randomness
2405
- ** obtained from the xRandomness method of the default [sqlite3_vfs] object.
2406
- ** ^If the previous call to this routine had an N of 1 or more then
2407
- ** 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
2408
2519
  ** internally and without recourse to the [sqlite3_vfs] xRandomness
2409
2520
  ** method.
2410
2521
  */
2411
- SQLITE_API void sqlite3_randomness(int N, void *P);
2522
+ SQLITE_API void SQLITE_STDCALL sqlite3_randomness(int N, void *P);
2412
2523
 
2413
2524
  /*
2414
2525
  ** CAPI3REF: Compile-Time Authorization Callbacks
2526
+ ** METHOD: sqlite3
2415
2527
  **
2416
2528
  ** ^This routine registers an authorizer callback with a particular
2417
2529
  ** [database connection], supplied in the first argument.
@@ -2490,7 +2602,7 @@ SQLITE_API void sqlite3_randomness(int N, void *P);
2490
2602
  ** as stated in the previous paragraph, sqlite3_step() invokes
2491
2603
  ** sqlite3_prepare_v2() to reprepare a statement after a schema change.
2492
2604
  */
2493
- SQLITE_API int sqlite3_set_authorizer(
2605
+ SQLITE_API int SQLITE_STDCALL sqlite3_set_authorizer(
2494
2606
  sqlite3*,
2495
2607
  int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),
2496
2608
  void *pUserData
@@ -2568,6 +2680,7 @@ SQLITE_API int sqlite3_set_authorizer(
2568
2680
 
2569
2681
  /*
2570
2682
  ** CAPI3REF: Tracing And Profiling Functions
2683
+ ** METHOD: sqlite3
2571
2684
  **
2572
2685
  ** These routines register callback functions that can be used for
2573
2686
  ** tracing and profiling the execution of SQL statements.
@@ -2594,12 +2707,13 @@ SQLITE_API int sqlite3_set_authorizer(
2594
2707
  ** sqlite3_profile() function is considered experimental and is
2595
2708
  ** subject to change in future versions of SQLite.
2596
2709
  */
2597
- SQLITE_API void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*);
2598
- 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*,
2599
2712
  void(*xProfile)(void*,const char*,sqlite3_uint64), void*);
2600
2713
 
2601
2714
  /*
2602
2715
  ** CAPI3REF: Query Progress Callbacks
2716
+ ** METHOD: sqlite3
2603
2717
  **
2604
2718
  ** ^The sqlite3_progress_handler(D,N,X,P) interface causes the callback
2605
2719
  ** function X to be invoked periodically during long running calls to
@@ -2629,10 +2743,11 @@ SQLITE_API SQLITE_EXPERIMENTAL void *sqlite3_profile(sqlite3*,
2629
2743
  ** database connections for the meaning of "modify" in this paragraph.
2630
2744
  **
2631
2745
  */
2632
- 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*);
2633
2747
 
2634
2748
  /*
2635
2749
  ** CAPI3REF: Opening A New Database Connection
2750
+ ** CONSTRUCTOR: sqlite3
2636
2751
  **
2637
2752
  ** ^These routines open an SQLite database file as specified by the
2638
2753
  ** filename argument. ^The filename argument is interpreted as UTF-8 for
@@ -2647,9 +2762,9 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
2647
2762
  ** an English language description of the error following a failure of any
2648
2763
  ** of the sqlite3_open() routines.
2649
2764
  **
2650
- ** ^The default encoding for the database will be UTF-8 if
2651
- ** sqlite3_open() or sqlite3_open_v2() is called and
2652
- ** UTF-16 in the native byte order if sqlite3_open16() is used.
2765
+ ** ^The default encoding will be UTF-8 for databases created using
2766
+ ** sqlite3_open() or sqlite3_open_v2(). ^The default encoding for databases
2767
+ ** created using sqlite3_open16() will be UTF-16 in the native byte order.
2653
2768
  **
2654
2769
  ** Whether or not an error occurs when it is opened, resources
2655
2770
  ** associated with the [database connection] handle should be released by
@@ -2737,13 +2852,14 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
2737
2852
  ** then it is interpreted as an absolute path. ^If the path does not begin
2738
2853
  ** with a '/' (meaning that the authority section is omitted from the URI)
2739
2854
  ** then the path is interpreted as a relative path.
2740
- ** ^On windows, the first component of an absolute path
2741
- ** is a drive specification (e.g. "C:").
2855
+ ** ^(On windows, the first component of an absolute path
2856
+ ** is a drive specification (e.g. "C:").)^
2742
2857
  **
2743
2858
  ** [[core URI query parameters]]
2744
2859
  ** The query component of a URI may contain parameters that are interpreted
2745
2860
  ** either by SQLite itself, or by a [VFS | custom VFS implementation].
2746
- ** SQLite interprets the following three query parameters:
2861
+ ** SQLite and its built-in [VFSes] interpret the
2862
+ ** following query parameters:
2747
2863
  **
2748
2864
  ** <ul>
2749
2865
  ** <li> <b>vfs</b>: ^The "vfs" parameter may be used to specify the name of
@@ -2778,11 +2894,9 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
2778
2894
  ** a URI filename, its value overrides any behavior requested by setting
2779
2895
  ** SQLITE_OPEN_PRIVATECACHE or SQLITE_OPEN_SHAREDCACHE flag.
2780
2896
  **
2781
- ** <li> <b>psow</b>: ^The psow parameter may be "true" (or "on" or "yes" or
2782
- ** "1") or "false" (or "off" or "no" or "0") to indicate that the
2897
+ ** <li> <b>psow</b>: ^The psow parameter indicates whether or not the
2783
2898
  ** [powersafe overwrite] property does or does not apply to the
2784
- ** storage media on which the database file resides. ^The psow query
2785
- ** parameter only works for the built-in unix and Windows VFSes.
2899
+ ** storage media on which the database file resides.
2786
2900
  **
2787
2901
  ** <li> <b>nolock</b>: ^The nolock parameter is a boolean query parameter
2788
2902
  ** which if set disables file locking in rollback journal modes. This
@@ -2858,15 +2972,15 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
2858
2972
  **
2859
2973
  ** See also: [sqlite3_temp_directory]
2860
2974
  */
2861
- SQLITE_API int sqlite3_open(
2975
+ SQLITE_API int SQLITE_STDCALL sqlite3_open(
2862
2976
  const char *filename, /* Database filename (UTF-8) */
2863
2977
  sqlite3 **ppDb /* OUT: SQLite db handle */
2864
2978
  );
2865
- SQLITE_API int sqlite3_open16(
2979
+ SQLITE_API int SQLITE_STDCALL sqlite3_open16(
2866
2980
  const void *filename, /* Database filename (UTF-16) */
2867
2981
  sqlite3 **ppDb /* OUT: SQLite db handle */
2868
2982
  );
2869
- SQLITE_API int sqlite3_open_v2(
2983
+ SQLITE_API int SQLITE_STDCALL sqlite3_open_v2(
2870
2984
  const char *filename, /* Database filename (UTF-8) */
2871
2985
  sqlite3 **ppDb, /* OUT: SQLite db handle */
2872
2986
  int flags, /* Flags */
@@ -2912,19 +3026,22 @@ SQLITE_API int sqlite3_open_v2(
2912
3026
  ** VFS method, then the behavior of this routine is undefined and probably
2913
3027
  ** undesirable.
2914
3028
  */
2915
- SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam);
2916
- SQLITE_API int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault);
2917
- 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);
2918
3032
 
2919
3033
 
2920
3034
  /*
2921
3035
  ** CAPI3REF: Error Codes And Messages
2922
- **
2923
- ** ^The sqlite3_errcode() interface returns the numeric [result code] or
2924
- ** [extended result code] for the most recent failed sqlite3_* API call
2925
- ** associated with a [database connection]. If a prior API call failed
2926
- ** but the most recent API call succeeded, the return value from
2927
- ** 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()
2928
3045
  ** interface is the same except that it always returns the
2929
3046
  ** [extended result code] even when extended result codes are
2930
3047
  ** disabled.
@@ -2955,40 +3072,41 @@ SQLITE_API sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int
2955
3072
  ** was invoked incorrectly by the application. In that case, the
2956
3073
  ** error code and message may or may not be set.
2957
3074
  */
2958
- SQLITE_API int sqlite3_errcode(sqlite3 *db);
2959
- SQLITE_API int sqlite3_extended_errcode(sqlite3 *db);
2960
- SQLITE_API const char *sqlite3_errmsg(sqlite3*);
2961
- SQLITE_API const void *sqlite3_errmsg16(sqlite3*);
2962
- 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);
2963
3080
 
2964
3081
  /*
2965
- ** CAPI3REF: SQL Statement Object
3082
+ ** CAPI3REF: Prepared Statement Object
2966
3083
  ** KEYWORDS: {prepared statement} {prepared statements}
2967
3084
  **
2968
- ** An instance of this object represents a single SQL statement.
2969
- ** This object is variously known as a "prepared statement" or a
2970
- ** "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.
2971
3092
  **
2972
- ** The life of a statement object goes something like this:
3093
+ ** The life-cycle of a prepared statement object usually goes like this:
2973
3094
  **
2974
3095
  ** <ol>
2975
- ** <li> Create the object using [sqlite3_prepare_v2()] or a related
2976
- ** function.
2977
- ** <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_*()
2978
3098
  ** interfaces.
2979
3099
  ** <li> Run the SQL by calling [sqlite3_step()] one or more times.
2980
- ** <li> Reset the statement using [sqlite3_reset()] then go back
3100
+ ** <li> Reset the prepared statement using [sqlite3_reset()] then go back
2981
3101
  ** to step 2. Do this zero or more times.
2982
3102
  ** <li> Destroy the object using [sqlite3_finalize()].
2983
3103
  ** </ol>
2984
- **
2985
- ** Refer to documentation on individual methods above for additional
2986
- ** information.
2987
3104
  */
2988
3105
  typedef struct sqlite3_stmt sqlite3_stmt;
2989
3106
 
2990
3107
  /*
2991
3108
  ** CAPI3REF: Run-time Limits
3109
+ ** METHOD: sqlite3
2992
3110
  **
2993
3111
  ** ^(This interface allows the size of various constructs to be limited
2994
3112
  ** on a connection by connection basis. The first parameter is the
@@ -3026,7 +3144,7 @@ typedef struct sqlite3_stmt sqlite3_stmt;
3026
3144
  **
3027
3145
  ** New run-time limit categories may be added in future releases.
3028
3146
  */
3029
- SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
3147
+ SQLITE_API int SQLITE_STDCALL sqlite3_limit(sqlite3*, int id, int newVal);
3030
3148
 
3031
3149
  /*
3032
3150
  ** CAPI3REF: Run-Time Limit Categories
@@ -3078,6 +3196,10 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
3078
3196
  **
3079
3197
  ** [[SQLITE_LIMIT_TRIGGER_DEPTH]] ^(<dt>SQLITE_LIMIT_TRIGGER_DEPTH</dt>
3080
3198
  ** <dd>The maximum depth of recursion for triggers.</dd>)^
3199
+ **
3200
+ ** [[SQLITE_LIMIT_WORKER_THREADS]] ^(<dt>SQLITE_LIMIT_WORKER_THREADS</dt>
3201
+ ** <dd>The maximum number of auxiliary worker threads that a single
3202
+ ** [prepared statement] may start.</dd>)^
3081
3203
  ** </dl>
3082
3204
  */
3083
3205
  #define SQLITE_LIMIT_LENGTH 0
@@ -3091,10 +3213,13 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
3091
3213
  #define SQLITE_LIMIT_LIKE_PATTERN_LENGTH 8
3092
3214
  #define SQLITE_LIMIT_VARIABLE_NUMBER 9
3093
3215
  #define SQLITE_LIMIT_TRIGGER_DEPTH 10
3216
+ #define SQLITE_LIMIT_WORKER_THREADS 11
3094
3217
 
3095
3218
  /*
3096
3219
  ** CAPI3REF: Compiling An SQL Statement
3097
3220
  ** KEYWORDS: {SQL statement compiler}
3221
+ ** METHOD: sqlite3
3222
+ ** CONSTRUCTOR: sqlite3_stmt
3098
3223
  **
3099
3224
  ** To execute an SQL query, it must first be compiled into a byte-code
3100
3225
  ** program using one of these routines.
@@ -3108,16 +3233,14 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
3108
3233
  ** interfaces use UTF-8, and sqlite3_prepare16() and sqlite3_prepare16_v2()
3109
3234
  ** use UTF-16.
3110
3235
  **
3111
- ** ^If the nByte argument is less than zero, then zSql is read up to the
3112
- ** first zero terminator. ^If nByte is non-negative, then it is the maximum
3113
- ** number of bytes read from zSql. ^When nByte is non-negative, the
3114
- ** zSql string ends at either the first '\000' or '\u0000' character or
3115
- ** the nByte-th byte, whichever comes first. If the caller knows
3116
- ** that the supplied string is nul-terminated, then there is a small
3117
- ** performance advantage to be gained by passing an nByte parameter that
3118
- ** is equal to the number of bytes in the input string <i>including</i>
3119
- ** the nul-terminator bytes as this saves SQLite from having to
3120
- ** 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.
3121
3244
  **
3122
3245
  ** ^If pzTail is not NULL then *pzTail is made to point to the first byte
3123
3246
  ** past the end of the first SQL statement in zSql. These routines only
@@ -3173,28 +3296,28 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
3173
3296
  ** </li>
3174
3297
  ** </ol>
3175
3298
  */
3176
- SQLITE_API int sqlite3_prepare(
3299
+ SQLITE_API int SQLITE_STDCALL sqlite3_prepare(
3177
3300
  sqlite3 *db, /* Database handle */
3178
3301
  const char *zSql, /* SQL statement, UTF-8 encoded */
3179
3302
  int nByte, /* Maximum length of zSql in bytes. */
3180
3303
  sqlite3_stmt **ppStmt, /* OUT: Statement handle */
3181
3304
  const char **pzTail /* OUT: Pointer to unused portion of zSql */
3182
3305
  );
3183
- SQLITE_API int sqlite3_prepare_v2(
3306
+ SQLITE_API int SQLITE_STDCALL sqlite3_prepare_v2(
3184
3307
  sqlite3 *db, /* Database handle */
3185
3308
  const char *zSql, /* SQL statement, UTF-8 encoded */
3186
3309
  int nByte, /* Maximum length of zSql in bytes. */
3187
3310
  sqlite3_stmt **ppStmt, /* OUT: Statement handle */
3188
3311
  const char **pzTail /* OUT: Pointer to unused portion of zSql */
3189
3312
  );
3190
- SQLITE_API int sqlite3_prepare16(
3313
+ SQLITE_API int SQLITE_STDCALL sqlite3_prepare16(
3191
3314
  sqlite3 *db, /* Database handle */
3192
3315
  const void *zSql, /* SQL statement, UTF-16 encoded */
3193
3316
  int nByte, /* Maximum length of zSql in bytes. */
3194
3317
  sqlite3_stmt **ppStmt, /* OUT: Statement handle */
3195
3318
  const void **pzTail /* OUT: Pointer to unused portion of zSql */
3196
3319
  );
3197
- SQLITE_API int sqlite3_prepare16_v2(
3320
+ SQLITE_API int SQLITE_STDCALL sqlite3_prepare16_v2(
3198
3321
  sqlite3 *db, /* Database handle */
3199
3322
  const void *zSql, /* SQL statement, UTF-16 encoded */
3200
3323
  int nByte, /* Maximum length of zSql in bytes. */
@@ -3204,15 +3327,17 @@ SQLITE_API int sqlite3_prepare16_v2(
3204
3327
 
3205
3328
  /*
3206
3329
  ** CAPI3REF: Retrieving Statement SQL
3330
+ ** METHOD: sqlite3_stmt
3207
3331
  **
3208
3332
  ** ^This interface can be used to retrieve a saved copy of the original
3209
3333
  ** SQL text used to create a [prepared statement] if that statement was
3210
3334
  ** compiled using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()].
3211
3335
  */
3212
- SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt);
3336
+ SQLITE_API const char *SQLITE_STDCALL sqlite3_sql(sqlite3_stmt *pStmt);
3213
3337
 
3214
3338
  /*
3215
3339
  ** CAPI3REF: Determine If An SQL Statement Writes The Database
3340
+ ** METHOD: sqlite3_stmt
3216
3341
  **
3217
3342
  ** ^The sqlite3_stmt_readonly(X) interface returns true (non-zero) if
3218
3343
  ** and only if the [prepared statement] X makes no direct changes to
@@ -3240,10 +3365,11 @@ SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt);
3240
3365
  ** change the configuration of a database connection, they do not make
3241
3366
  ** changes to the content of the database files on disk.
3242
3367
  */
3243
- SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
3368
+ SQLITE_API int SQLITE_STDCALL sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
3244
3369
 
3245
3370
  /*
3246
3371
  ** CAPI3REF: Determine If A Prepared Statement Has Been Reset
3372
+ ** METHOD: sqlite3_stmt
3247
3373
  **
3248
3374
  ** ^The sqlite3_stmt_busy(S) interface returns true (non-zero) if the
3249
3375
  ** [prepared statement] S has been stepped at least once using
@@ -3259,7 +3385,7 @@ SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
3259
3385
  ** for example, in diagnostic routines to search for prepared
3260
3386
  ** statements that are holding a transaction open.
3261
3387
  */
3262
- SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*);
3388
+ SQLITE_API int SQLITE_STDCALL sqlite3_stmt_busy(sqlite3_stmt*);
3263
3389
 
3264
3390
  /*
3265
3391
  ** CAPI3REF: Dynamically Typed Value Object
@@ -3274,7 +3400,9 @@ SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*);
3274
3400
  ** Some interfaces require a protected sqlite3_value. Other interfaces
3275
3401
  ** will accept either a protected or an unprotected sqlite3_value.
3276
3402
  ** Every interface that accepts sqlite3_value arguments specifies
3277
- ** 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.
3278
3406
  **
3279
3407
  ** The terms "protected" and "unprotected" refer to whether or not
3280
3408
  ** a mutex is held. An internal mutex is held for a protected
@@ -3318,6 +3446,7 @@ typedef struct sqlite3_context sqlite3_context;
3318
3446
  ** CAPI3REF: Binding Values To Prepared Statements
3319
3447
  ** KEYWORDS: {host parameter} {host parameters} {host parameter name}
3320
3448
  ** KEYWORDS: {SQL parameter} {SQL parameters} {parameter binding}
3449
+ ** METHOD: sqlite3_stmt
3321
3450
  **
3322
3451
  ** ^(In the SQL statement text input to [sqlite3_prepare_v2()] and its variants,
3323
3452
  ** literals may be replaced by a [parameter] that matches one of following
@@ -3364,18 +3493,18 @@ typedef struct sqlite3_context sqlite3_context;
3364
3493
  ** If the fourth parameter to sqlite3_bind_blob() is negative, then
3365
3494
  ** the behavior is undefined.
3366
3495
  ** If a non-negative fourth parameter is provided to sqlite3_bind_text()
3367
- ** or sqlite3_bind_text16() then that parameter must be the byte offset
3496
+ ** or sqlite3_bind_text16() or sqlite3_bind_text64() then
3497
+ ** that parameter must be the byte offset
3368
3498
  ** where the NUL terminator would occur assuming the string were NUL
3369
3499
  ** terminated. If any NUL characters occur at byte offsets less than
3370
3500
  ** the value of the fourth parameter then the resulting string value will
3371
3501
  ** contain embedded NULs. The result of expressions involving strings
3372
3502
  ** with embedded NULs is undefined.
3373
3503
  **
3374
- ** ^The fifth argument to sqlite3_bind_blob(), sqlite3_bind_text(), and
3375
- ** sqlite3_bind_text16() is a destructor used to dispose of the BLOB or
3504
+ ** ^The fifth argument to the BLOB and string binding interfaces
3505
+ ** is a destructor used to dispose of the BLOB or
3376
3506
  ** string after SQLite has finished with it. ^The destructor is called
3377
- ** to dispose of the BLOB or string even if the call to sqlite3_bind_blob(),
3378
- ** sqlite3_bind_text(), or sqlite3_bind_text16() fails.
3507
+ ** to dispose of the BLOB or string even if the call to bind API fails.
3379
3508
  ** ^If the fifth argument is
3380
3509
  ** the special value [SQLITE_STATIC], then SQLite assumes that the
3381
3510
  ** information is in static, unmanaged space and does not need to be freed.
@@ -3383,6 +3512,14 @@ typedef struct sqlite3_context sqlite3_context;
3383
3512
  ** SQLite makes its own private copy of the data immediately, before
3384
3513
  ** the sqlite3_bind_*() routine returns.
3385
3514
  **
3515
+ ** ^The sixth argument to sqlite3_bind_text64() must be one of
3516
+ ** [SQLITE_UTF8], [SQLITE_UTF16], [SQLITE_UTF16BE], or [SQLITE_UTF16LE]
3517
+ ** to specify the encoding of the text in the third parameter. If
3518
+ ** the sixth argument to sqlite3_bind_text64() is not one of the
3519
+ ** allowed values shown above, or if the text encoding is different
3520
+ ** from the encoding specified by the sixth parameter, then the behavior
3521
+ ** is undefined.
3522
+ **
3386
3523
  ** ^The sqlite3_bind_zeroblob() routine binds a BLOB of length N that
3387
3524
  ** is filled with zeroes. ^A zeroblob uses a fixed amount of memory
3388
3525
  ** (just an integer to hold its size) while it is being processed.
@@ -3403,24 +3540,33 @@ typedef struct sqlite3_context sqlite3_context;
3403
3540
  **
3404
3541
  ** ^The sqlite3_bind_* routines return [SQLITE_OK] on success or an
3405
3542
  ** [error code] if anything goes wrong.
3543
+ ** ^[SQLITE_TOOBIG] might be returned if the size of a string or BLOB
3544
+ ** exceeds limits imposed by [sqlite3_limit]([SQLITE_LIMIT_LENGTH]) or
3545
+ ** [SQLITE_MAX_LENGTH].
3406
3546
  ** ^[SQLITE_RANGE] is returned if the parameter
3407
3547
  ** index is out of range. ^[SQLITE_NOMEM] is returned if malloc() fails.
3408
3548
  **
3409
3549
  ** See also: [sqlite3_bind_parameter_count()],
3410
3550
  ** [sqlite3_bind_parameter_name()], and [sqlite3_bind_parameter_index()].
3411
3551
  */
3412
- SQLITE_API int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));
3413
- SQLITE_API int sqlite3_bind_double(sqlite3_stmt*, int, double);
3414
- SQLITE_API int sqlite3_bind_int(sqlite3_stmt*, int, int);
3415
- SQLITE_API int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64);
3416
- SQLITE_API int sqlite3_bind_null(sqlite3_stmt*, int);
3417
- SQLITE_API int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int n, void(*)(void*));
3418
- SQLITE_API int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*));
3419
- SQLITE_API int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
3420
- SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
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,
3554
+ void(*)(void*));
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,
3562
+ void(*)(void*), unsigned char encoding);
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);
3421
3566
 
3422
3567
  /*
3423
3568
  ** CAPI3REF: Number Of SQL Parameters
3569
+ ** METHOD: sqlite3_stmt
3424
3570
  **
3425
3571
  ** ^This routine can be used to find the number of [SQL parameters]
3426
3572
  ** in a [prepared statement]. SQL parameters are tokens of the
@@ -3437,10 +3583,11 @@ SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
3437
3583
  ** [sqlite3_bind_parameter_name()], and
3438
3584
  ** [sqlite3_bind_parameter_index()].
3439
3585
  */
3440
- SQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt*);
3586
+ SQLITE_API int SQLITE_STDCALL sqlite3_bind_parameter_count(sqlite3_stmt*);
3441
3587
 
3442
3588
  /*
3443
3589
  ** CAPI3REF: Name Of A Host Parameter
3590
+ ** METHOD: sqlite3_stmt
3444
3591
  **
3445
3592
  ** ^The sqlite3_bind_parameter_name(P,N) interface returns
3446
3593
  ** the name of the N-th [SQL parameter] in the [prepared statement] P.
@@ -3464,10 +3611,11 @@ SQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt*);
3464
3611
  ** [sqlite3_bind_parameter_count()], and
3465
3612
  ** [sqlite3_bind_parameter_index()].
3466
3613
  */
3467
- 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);
3468
3615
 
3469
3616
  /*
3470
3617
  ** CAPI3REF: Index Of A Parameter With A Given Name
3618
+ ** METHOD: sqlite3_stmt
3471
3619
  **
3472
3620
  ** ^Return the index of an SQL parameter given its name. ^The
3473
3621
  ** index value returned is suitable for use as the second
@@ -3480,19 +3628,21 @@ SQLITE_API const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int);
3480
3628
  ** [sqlite3_bind_parameter_count()], and
3481
3629
  ** [sqlite3_bind_parameter_index()].
3482
3630
  */
3483
- 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);
3484
3632
 
3485
3633
  /*
3486
3634
  ** CAPI3REF: Reset All Bindings On A Prepared Statement
3635
+ ** METHOD: sqlite3_stmt
3487
3636
  **
3488
3637
  ** ^Contrary to the intuition of many, [sqlite3_reset()] does not reset
3489
3638
  ** the [sqlite3_bind_blob | bindings] on a [prepared statement].
3490
3639
  ** ^Use this routine to reset all host parameters to NULL.
3491
3640
  */
3492
- SQLITE_API int sqlite3_clear_bindings(sqlite3_stmt*);
3641
+ SQLITE_API int SQLITE_STDCALL sqlite3_clear_bindings(sqlite3_stmt*);
3493
3642
 
3494
3643
  /*
3495
3644
  ** CAPI3REF: Number Of Columns In A Result Set
3645
+ ** METHOD: sqlite3_stmt
3496
3646
  **
3497
3647
  ** ^Return the number of columns in the result set returned by the
3498
3648
  ** [prepared statement]. ^This routine returns 0 if pStmt is an SQL
@@ -3500,10 +3650,11 @@ SQLITE_API int sqlite3_clear_bindings(sqlite3_stmt*);
3500
3650
  **
3501
3651
  ** See also: [sqlite3_data_count()]
3502
3652
  */
3503
- SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt);
3653
+ SQLITE_API int SQLITE_STDCALL sqlite3_column_count(sqlite3_stmt *pStmt);
3504
3654
 
3505
3655
  /*
3506
3656
  ** CAPI3REF: Column Names In A Result Set
3657
+ ** METHOD: sqlite3_stmt
3507
3658
  **
3508
3659
  ** ^These routines return the name assigned to a particular column
3509
3660
  ** in the result set of a [SELECT] statement. ^The sqlite3_column_name()
@@ -3528,11 +3679,12 @@ SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt);
3528
3679
  ** then the name of the column is unspecified and may change from
3529
3680
  ** one release of SQLite to the next.
3530
3681
  */
3531
- SQLITE_API const char *sqlite3_column_name(sqlite3_stmt*, int N);
3532
- 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);
3533
3684
 
3534
3685
  /*
3535
3686
  ** CAPI3REF: Source Of Data In A Query Result
3687
+ ** METHOD: sqlite3_stmt
3536
3688
  **
3537
3689
  ** ^These routines provide a means to determine the database, table, and
3538
3690
  ** table column that is the origin of a particular result column in
@@ -3576,15 +3728,16 @@ SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt*, int N);
3576
3728
  ** for the same [prepared statement] and result column
3577
3729
  ** at the same time then the results are undefined.
3578
3730
  */
3579
- SQLITE_API const char *sqlite3_column_database_name(sqlite3_stmt*,int);
3580
- SQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt*,int);
3581
- SQLITE_API const char *sqlite3_column_table_name(sqlite3_stmt*,int);
3582
- SQLITE_API const void *sqlite3_column_table_name16(sqlite3_stmt*,int);
3583
- SQLITE_API const char *sqlite3_column_origin_name(sqlite3_stmt*,int);
3584
- 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);
3585
3737
 
3586
3738
  /*
3587
3739
  ** CAPI3REF: Declared Datatype Of A Query Result
3740
+ ** METHOD: sqlite3_stmt
3588
3741
  **
3589
3742
  ** ^(The first parameter is a [prepared statement].
3590
3743
  ** If this statement is a [SELECT] statement and the Nth column of the
@@ -3612,11 +3765,12 @@ SQLITE_API const void *sqlite3_column_origin_name16(sqlite3_stmt*,int);
3612
3765
  ** is associated with individual values, not with the containers
3613
3766
  ** used to hold those values.
3614
3767
  */
3615
- SQLITE_API const char *sqlite3_column_decltype(sqlite3_stmt*,int);
3616
- 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);
3617
3770
 
3618
3771
  /*
3619
3772
  ** CAPI3REF: Evaluate An SQL Statement
3773
+ ** METHOD: sqlite3_stmt
3620
3774
  **
3621
3775
  ** After a [prepared statement] has been prepared using either
3622
3776
  ** [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] or one of the legacy
@@ -3692,10 +3846,11 @@ SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
3692
3846
  ** then the more specific [error codes] are returned directly
3693
3847
  ** by sqlite3_step(). The use of the "v2" interface is recommended.
3694
3848
  */
3695
- SQLITE_API int sqlite3_step(sqlite3_stmt*);
3849
+ SQLITE_API int SQLITE_STDCALL sqlite3_step(sqlite3_stmt*);
3696
3850
 
3697
3851
  /*
3698
3852
  ** CAPI3REF: Number of columns in a result set
3853
+ ** METHOD: sqlite3_stmt
3699
3854
  **
3700
3855
  ** ^The sqlite3_data_count(P) interface returns the number of columns in the
3701
3856
  ** current row of the result set of [prepared statement] P.
@@ -3712,7 +3867,7 @@ SQLITE_API int sqlite3_step(sqlite3_stmt*);
3712
3867
  **
3713
3868
  ** See also: [sqlite3_column_count()]
3714
3869
  */
3715
- SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
3870
+ SQLITE_API int SQLITE_STDCALL sqlite3_data_count(sqlite3_stmt *pStmt);
3716
3871
 
3717
3872
  /*
3718
3873
  ** CAPI3REF: Fundamental Datatypes
@@ -3749,8 +3904,7 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
3749
3904
  /*
3750
3905
  ** CAPI3REF: Result Values From A Query
3751
3906
  ** KEYWORDS: {column access functions}
3752
- **
3753
- ** These routines form the "result set" interface.
3907
+ ** METHOD: sqlite3_stmt
3754
3908
  **
3755
3909
  ** ^These routines return information about a single column of the current
3756
3910
  ** result row of a query. ^In every case the first argument is a pointer
@@ -3811,13 +3965,14 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
3811
3965
  ** even empty strings, are always zero-terminated. ^The return
3812
3966
  ** value from sqlite3_column_blob() for a zero-length BLOB is a NULL pointer.
3813
3967
  **
3814
- ** ^The object returned by [sqlite3_column_value()] is an
3815
- ** [unprotected sqlite3_value] object. An unprotected sqlite3_value object
3816
- ** 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()].
3817
3972
  ** If the [unprotected sqlite3_value] object returned by
3818
3973
  ** [sqlite3_column_value()] is used in any other way, including calls
3819
3974
  ** to routines like [sqlite3_value_int()], [sqlite3_value_text()],
3820
- ** or [sqlite3_value_bytes()], then the behavior is undefined.
3975
+ ** or [sqlite3_value_bytes()], the behavior is not threadsafe.
3821
3976
  **
3822
3977
  ** These routines attempt to convert the value where appropriate. ^For
3823
3978
  ** example, if the internal representation is FLOAT and a text result
@@ -3848,12 +4003,6 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
3848
4003
  ** </table>
3849
4004
  ** </blockquote>)^
3850
4005
  **
3851
- ** The table above makes reference to standard C library functions atoi()
3852
- ** and atof(). SQLite does not really use these functions. It has its
3853
- ** own equivalent internal routines. The atoi() and atof() names are
3854
- ** used in the table for brevity and because they are familiar to most
3855
- ** C programmers.
3856
- **
3857
4006
  ** Note that when type conversions occur, pointers returned by prior
3858
4007
  ** calls to sqlite3_column_blob(), sqlite3_column_text(), and/or
3859
4008
  ** sqlite3_column_text16() may be invalidated.
@@ -3878,7 +4027,7 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
3878
4027
  ** of conversion are done in place when it is possible, but sometimes they
3879
4028
  ** are not possible and in those cases prior pointers are invalidated.
3880
4029
  **
3881
- ** The safest and easiest to remember policy is to invoke these routines
4030
+ ** The safest policy is to invoke these routines
3882
4031
  ** in one of the following ways:
3883
4032
  **
3884
4033
  ** <ul>
@@ -3898,7 +4047,7 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
3898
4047
  ** ^The pointers returned are valid until a type conversion occurs as
3899
4048
  ** described above, or until [sqlite3_step()] or [sqlite3_reset()] or
3900
4049
  ** [sqlite3_finalize()] is called. ^The memory space used to hold strings
3901
- ** 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
3902
4051
  ** from [sqlite3_column_blob()], [sqlite3_column_text()], etc. into
3903
4052
  ** [sqlite3_free()].
3904
4053
  **
@@ -3908,19 +4057,20 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
3908
4057
  ** pointer. Subsequent calls to [sqlite3_errcode()] will return
3909
4058
  ** [SQLITE_NOMEM].)^
3910
4059
  */
3911
- SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol);
3912
- SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
3913
- SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
3914
- SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol);
3915
- SQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol);
3916
- SQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol);
3917
- SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol);
3918
- SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt*, int iCol);
3919
- SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol);
3920
- 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);
3921
4070
 
3922
4071
  /*
3923
4072
  ** CAPI3REF: Destroy A Prepared Statement Object
4073
+ ** DESTRUCTOR: sqlite3_stmt
3924
4074
  **
3925
4075
  ** ^The sqlite3_finalize() function is called to delete a [prepared statement].
3926
4076
  ** ^If the most recent evaluation of the statement encountered no errors
@@ -3944,10 +4094,11 @@ SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol);
3944
4094
  ** statement after it has been finalized can result in undefined and
3945
4095
  ** undesirable behavior such as segfaults and heap corruption.
3946
4096
  */
3947
- SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt);
4097
+ SQLITE_API int SQLITE_STDCALL sqlite3_finalize(sqlite3_stmt *pStmt);
3948
4098
 
3949
4099
  /*
3950
4100
  ** CAPI3REF: Reset A Prepared Statement Object
4101
+ ** METHOD: sqlite3_stmt
3951
4102
  **
3952
4103
  ** The sqlite3_reset() function is called to reset a [prepared statement]
3953
4104
  ** object back to its initial state, ready to be re-executed.
@@ -3970,13 +4121,14 @@ SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt);
3970
4121
  ** ^The [sqlite3_reset(S)] interface does not change the values
3971
4122
  ** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S.
3972
4123
  */
3973
- SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
4124
+ SQLITE_API int SQLITE_STDCALL sqlite3_reset(sqlite3_stmt *pStmt);
3974
4125
 
3975
4126
  /*
3976
4127
  ** CAPI3REF: Create Or Redefine SQL Functions
3977
4128
  ** KEYWORDS: {function creation routines}
3978
4129
  ** KEYWORDS: {application-defined SQL function}
3979
4130
  ** KEYWORDS: {application-defined SQL functions}
4131
+ ** METHOD: sqlite3
3980
4132
  **
3981
4133
  ** ^These functions (collectively known as "function creation routines")
3982
4134
  ** are used to add SQL functions or aggregates or to redefine the behavior
@@ -4069,7 +4221,7 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
4069
4221
  ** close the database connection nor finalize or reset the prepared
4070
4222
  ** statement in which the function is running.
4071
4223
  */
4072
- SQLITE_API int sqlite3_create_function(
4224
+ SQLITE_API int SQLITE_STDCALL sqlite3_create_function(
4073
4225
  sqlite3 *db,
4074
4226
  const char *zFunctionName,
4075
4227
  int nArg,
@@ -4079,7 +4231,7 @@ SQLITE_API int sqlite3_create_function(
4079
4231
  void (*xStep)(sqlite3_context*,int,sqlite3_value**),
4080
4232
  void (*xFinal)(sqlite3_context*)
4081
4233
  );
4082
- SQLITE_API int sqlite3_create_function16(
4234
+ SQLITE_API int SQLITE_STDCALL sqlite3_create_function16(
4083
4235
  sqlite3 *db,
4084
4236
  const void *zFunctionName,
4085
4237
  int nArg,
@@ -4089,7 +4241,7 @@ SQLITE_API int sqlite3_create_function16(
4089
4241
  void (*xStep)(sqlite3_context*,int,sqlite3_value**),
4090
4242
  void (*xFinal)(sqlite3_context*)
4091
4243
  );
4092
- SQLITE_API int sqlite3_create_function_v2(
4244
+ SQLITE_API int SQLITE_STDCALL sqlite3_create_function_v2(
4093
4245
  sqlite3 *db,
4094
4246
  const char *zFunctionName,
4095
4247
  int nArg,
@@ -4107,9 +4259,9 @@ SQLITE_API int sqlite3_create_function_v2(
4107
4259
  ** These constant define integer codes that represent the various
4108
4260
  ** text encodings supported by SQLite.
4109
4261
  */
4110
- #define SQLITE_UTF8 1
4111
- #define SQLITE_UTF16LE 2
4112
- #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 */
4113
4265
  #define SQLITE_UTF16 4 /* Use native byte order */
4114
4266
  #define SQLITE_ANY 5 /* Deprecated */
4115
4267
  #define SQLITE_UTF16_ALIGNED 8 /* sqlite3_create_collation only */
@@ -4131,25 +4283,26 @@ SQLITE_API int sqlite3_create_function_v2(
4131
4283
  ** These functions are [deprecated]. In order to maintain
4132
4284
  ** backwards compatibility with older code, these functions continue
4133
4285
  ** to be supported. However, new applications should avoid
4134
- ** the use of these functions. To help encourage people to avoid
4135
- ** 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.
4136
4288
  */
4137
4289
  #ifndef SQLITE_OMIT_DEPRECATED
4138
- SQLITE_API SQLITE_DEPRECATED int sqlite3_aggregate_count(sqlite3_context*);
4139
- SQLITE_API SQLITE_DEPRECATED int sqlite3_expired(sqlite3_stmt*);
4140
- SQLITE_API SQLITE_DEPRECATED int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*);
4141
- SQLITE_API SQLITE_DEPRECATED int sqlite3_global_recover(void);
4142
- SQLITE_API SQLITE_DEPRECATED void sqlite3_thread_cleanup(void);
4143
- 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),
4144
4296
  void*,sqlite3_int64);
4145
4297
  #endif
4146
4298
 
4147
4299
  /*
4148
- ** CAPI3REF: Obtaining SQL Function Parameter Values
4300
+ ** CAPI3REF: Obtaining SQL Values
4301
+ ** METHOD: sqlite3_value
4149
4302
  **
4150
4303
  ** The C-language implementation of SQL functions and aggregates uses
4151
4304
  ** this set of interface routines to access the parameter values on
4152
- ** the function or aggregate.
4305
+ ** the function or aggregate.
4153
4306
  **
4154
4307
  ** The xFunc (for scalar functions) or xStep (for aggregates) parameters
4155
4308
  ** to [sqlite3_create_function()] and [sqlite3_create_function16()]
@@ -4164,7 +4317,7 @@ SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int6
4164
4317
  ** object results in undefined behavior.
4165
4318
  **
4166
4319
  ** ^These routines work just like the corresponding [column access functions]
4167
- ** except that these routines take a single [protected sqlite3_value] object
4320
+ ** except that these routines take a single [protected sqlite3_value] object
4168
4321
  ** pointer instead of a [sqlite3_stmt*] pointer and an integer column number.
4169
4322
  **
4170
4323
  ** ^The sqlite3_value_text16() interface extracts a UTF-16 string
@@ -4189,21 +4342,39 @@ SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int6
4189
4342
  ** These routines must be called from the same thread as
4190
4343
  ** the SQL function that supplied the [sqlite3_value*] parameters.
4191
4344
  */
4192
- SQLITE_API const void *sqlite3_value_blob(sqlite3_value*);
4193
- SQLITE_API int sqlite3_value_bytes(sqlite3_value*);
4194
- SQLITE_API int sqlite3_value_bytes16(sqlite3_value*);
4195
- SQLITE_API double sqlite3_value_double(sqlite3_value*);
4196
- SQLITE_API int sqlite3_value_int(sqlite3_value*);
4197
- SQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*);
4198
- SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value*);
4199
- SQLITE_API const void *sqlite3_value_text16(sqlite3_value*);
4200
- SQLITE_API const void *sqlite3_value_text16le(sqlite3_value*);
4201
- SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*);
4202
- SQLITE_API int sqlite3_value_type(sqlite3_value*);
4203
- 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*);
4204
4374
 
4205
4375
  /*
4206
4376
  ** CAPI3REF: Obtain Aggregate Function Context
4377
+ ** METHOD: sqlite3_context
4207
4378
  **
4208
4379
  ** Implementations of aggregate SQL functions use this
4209
4380
  ** routine to allocate memory for storing their state.
@@ -4244,10 +4415,11 @@ SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);
4244
4415
  ** This routine must be called from the same thread in which
4245
4416
  ** the aggregate SQL function is running.
4246
4417
  */
4247
- SQLITE_API void *sqlite3_aggregate_context(sqlite3_context*, int nBytes);
4418
+ SQLITE_API void *SQLITE_STDCALL sqlite3_aggregate_context(sqlite3_context*, int nBytes);
4248
4419
 
4249
4420
  /*
4250
4421
  ** CAPI3REF: User Data For Functions
4422
+ ** METHOD: sqlite3_context
4251
4423
  **
4252
4424
  ** ^The sqlite3_user_data() interface returns a copy of
4253
4425
  ** the pointer that was the pUserData parameter (the 5th parameter)
@@ -4258,10 +4430,11 @@ SQLITE_API void *sqlite3_aggregate_context(sqlite3_context*, int nBytes);
4258
4430
  ** This routine must be called from the same thread in which
4259
4431
  ** the application-defined function is running.
4260
4432
  */
4261
- SQLITE_API void *sqlite3_user_data(sqlite3_context*);
4433
+ SQLITE_API void *SQLITE_STDCALL sqlite3_user_data(sqlite3_context*);
4262
4434
 
4263
4435
  /*
4264
4436
  ** CAPI3REF: Database Connection For Functions
4437
+ ** METHOD: sqlite3_context
4265
4438
  **
4266
4439
  ** ^The sqlite3_context_db_handle() interface returns a copy of
4267
4440
  ** the pointer to the [database connection] (the 1st parameter)
@@ -4269,10 +4442,11 @@ SQLITE_API void *sqlite3_user_data(sqlite3_context*);
4269
4442
  ** and [sqlite3_create_function16()] routines that originally
4270
4443
  ** registered the application defined function.
4271
4444
  */
4272
- SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*);
4445
+ SQLITE_API sqlite3 *SQLITE_STDCALL sqlite3_context_db_handle(sqlite3_context*);
4273
4446
 
4274
4447
  /*
4275
4448
  ** CAPI3REF: Function Auxiliary Data
4449
+ ** METHOD: sqlite3_context
4276
4450
  **
4277
4451
  ** These functions may be used by (non-aggregate) SQL functions to
4278
4452
  ** associate metadata with argument values. If the same value is passed to
@@ -4321,8 +4495,8 @@ SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*);
4321
4495
  ** These routines must be called from the same thread in which
4322
4496
  ** the SQL function is running.
4323
4497
  */
4324
- SQLITE_API void *sqlite3_get_auxdata(sqlite3_context*, int N);
4325
- 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*));
4326
4500
 
4327
4501
 
4328
4502
  /*
@@ -4345,6 +4519,7 @@ typedef void (*sqlite3_destructor_type)(void*);
4345
4519
 
4346
4520
  /*
4347
4521
  ** CAPI3REF: Setting The Result Of An SQL Function
4522
+ ** METHOD: sqlite3_context
4348
4523
  **
4349
4524
  ** These routines are used by the xFunc or xFinal callbacks that
4350
4525
  ** implement SQL functions and aggregates. See
@@ -4360,9 +4535,9 @@ typedef void (*sqlite3_destructor_type)(void*);
4360
4535
  ** to by the second parameter and which is N bytes long where N is the
4361
4536
  ** third parameter.
4362
4537
  **
4363
- ** ^The sqlite3_result_zeroblob() interfaces set the result of
4364
- ** the application-defined function to be a BLOB containing all zero
4365
- ** 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.
4366
4541
  **
4367
4542
  ** ^The sqlite3_result_double() interface sets the result from
4368
4543
  ** an application-defined function to be a floating point value specified
@@ -4411,6 +4586,10 @@ typedef void (*sqlite3_destructor_type)(void*);
4411
4586
  ** set the return value of the application-defined function to be
4412
4587
  ** a text string which is represented as UTF-8, UTF-16 native byte order,
4413
4588
  ** UTF-16 little endian, or UTF-16 big endian, respectively.
4589
+ ** ^The sqlite3_result_text64() interface sets the return value of an
4590
+ ** application-defined function to be a text string in an encoding
4591
+ ** specified by the fifth (and last) parameter, which must be one
4592
+ ** of [SQLITE_UTF8], [SQLITE_UTF16], [SQLITE_UTF16BE], or [SQLITE_UTF16LE].
4414
4593
  ** ^SQLite takes the text result from the application from
4415
4594
  ** the 2nd parameter of the sqlite3_result_text* interfaces.
4416
4595
  ** ^If the 3rd parameter to the sqlite3_result_text* interfaces
@@ -4440,7 +4619,7 @@ typedef void (*sqlite3_destructor_type)(void*);
4440
4619
  ** from [sqlite3_malloc()] before it returns.
4441
4620
  **
4442
4621
  ** ^The sqlite3_result_value() interface sets the result of
4443
- ** the application-defined function to be a copy the
4622
+ ** the application-defined function to be a copy of the
4444
4623
  ** [unprotected sqlite3_value] object specified by the 2nd parameter. ^The
4445
4624
  ** sqlite3_result_value() interface makes a copy of the [sqlite3_value]
4446
4625
  ** so that the [sqlite3_value] specified in the parameter may change or
@@ -4453,25 +4632,31 @@ typedef void (*sqlite3_destructor_type)(void*);
4453
4632
  ** than the one containing the application-defined function that received
4454
4633
  ** the [sqlite3_context] pointer, the results are undefined.
4455
4634
  */
4456
- SQLITE_API void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));
4457
- SQLITE_API void sqlite3_result_double(sqlite3_context*, double);
4458
- SQLITE_API void sqlite3_result_error(sqlite3_context*, const char*, int);
4459
- SQLITE_API void sqlite3_result_error16(sqlite3_context*, const void*, int);
4460
- SQLITE_API void sqlite3_result_error_toobig(sqlite3_context*);
4461
- SQLITE_API void sqlite3_result_error_nomem(sqlite3_context*);
4462
- SQLITE_API void sqlite3_result_error_code(sqlite3_context*, int);
4463
- SQLITE_API void sqlite3_result_int(sqlite3_context*, int);
4464
- SQLITE_API void sqlite3_result_int64(sqlite3_context*, sqlite3_int64);
4465
- SQLITE_API void sqlite3_result_null(sqlite3_context*);
4466
- SQLITE_API void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*));
4467
- SQLITE_API void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*));
4468
- SQLITE_API void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));
4469
- SQLITE_API void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*));
4470
- SQLITE_API void sqlite3_result_value(sqlite3_context*, sqlite3_value*);
4471
- SQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n);
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,
4649
+ void(*)(void*), unsigned char encoding);
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);
4472
4656
 
4473
4657
  /*
4474
4658
  ** CAPI3REF: Define New Collating Sequences
4659
+ ** METHOD: sqlite3
4475
4660
  **
4476
4661
  ** ^These functions add, remove, or modify a [collation] associated
4477
4662
  ** with the [database connection] specified as the first argument.
@@ -4549,14 +4734,14 @@ SQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n);
4549
4734
  **
4550
4735
  ** See also: [sqlite3_collation_needed()] and [sqlite3_collation_needed16()].
4551
4736
  */
4552
- SQLITE_API int sqlite3_create_collation(
4737
+ SQLITE_API int SQLITE_STDCALL sqlite3_create_collation(
4553
4738
  sqlite3*,
4554
4739
  const char *zName,
4555
4740
  int eTextRep,
4556
4741
  void *pArg,
4557
4742
  int(*xCompare)(void*,int,const void*,int,const void*)
4558
4743
  );
4559
- SQLITE_API int sqlite3_create_collation_v2(
4744
+ SQLITE_API int SQLITE_STDCALL sqlite3_create_collation_v2(
4560
4745
  sqlite3*,
4561
4746
  const char *zName,
4562
4747
  int eTextRep,
@@ -4564,7 +4749,7 @@ SQLITE_API int sqlite3_create_collation_v2(
4564
4749
  int(*xCompare)(void*,int,const void*,int,const void*),
4565
4750
  void(*xDestroy)(void*)
4566
4751
  );
4567
- SQLITE_API int sqlite3_create_collation16(
4752
+ SQLITE_API int SQLITE_STDCALL sqlite3_create_collation16(
4568
4753
  sqlite3*,
4569
4754
  const void *zName,
4570
4755
  int eTextRep,
@@ -4574,6 +4759,7 @@ SQLITE_API int sqlite3_create_collation16(
4574
4759
 
4575
4760
  /*
4576
4761
  ** CAPI3REF: Collation Needed Callbacks
4762
+ ** METHOD: sqlite3
4577
4763
  **
4578
4764
  ** ^To avoid having to register all collation sequences before a database
4579
4765
  ** can be used, a single callback function may be registered with the
@@ -4598,12 +4784,12 @@ SQLITE_API int sqlite3_create_collation16(
4598
4784
  ** [sqlite3_create_collation()], [sqlite3_create_collation16()], or
4599
4785
  ** [sqlite3_create_collation_v2()].
4600
4786
  */
4601
- SQLITE_API int sqlite3_collation_needed(
4787
+ SQLITE_API int SQLITE_STDCALL sqlite3_collation_needed(
4602
4788
  sqlite3*,
4603
4789
  void*,
4604
4790
  void(*)(void*,sqlite3*,int eTextRep,const char*)
4605
4791
  );
4606
- SQLITE_API int sqlite3_collation_needed16(
4792
+ SQLITE_API int SQLITE_STDCALL sqlite3_collation_needed16(
4607
4793
  sqlite3*,
4608
4794
  void*,
4609
4795
  void(*)(void*,sqlite3*,int eTextRep,const void*)
@@ -4617,11 +4803,11 @@ SQLITE_API int sqlite3_collation_needed16(
4617
4803
  ** The code to implement this API is not available in the public release
4618
4804
  ** of SQLite.
4619
4805
  */
4620
- SQLITE_API int sqlite3_key(
4806
+ SQLITE_API int SQLITE_STDCALL sqlite3_key(
4621
4807
  sqlite3 *db, /* Database to be rekeyed */
4622
4808
  const void *pKey, int nKey /* The key */
4623
4809
  );
4624
- SQLITE_API int sqlite3_key_v2(
4810
+ SQLITE_API int SQLITE_STDCALL sqlite3_key_v2(
4625
4811
  sqlite3 *db, /* Database to be rekeyed */
4626
4812
  const char *zDbName, /* Name of the database */
4627
4813
  const void *pKey, int nKey /* The key */
@@ -4635,11 +4821,11 @@ SQLITE_API int sqlite3_key_v2(
4635
4821
  ** The code to implement this API is not available in the public release
4636
4822
  ** of SQLite.
4637
4823
  */
4638
- SQLITE_API int sqlite3_rekey(
4824
+ SQLITE_API int SQLITE_STDCALL sqlite3_rekey(
4639
4825
  sqlite3 *db, /* Database to be rekeyed */
4640
4826
  const void *pKey, int nKey /* The new key */
4641
4827
  );
4642
- SQLITE_API int sqlite3_rekey_v2(
4828
+ SQLITE_API int SQLITE_STDCALL sqlite3_rekey_v2(
4643
4829
  sqlite3 *db, /* Database to be rekeyed */
4644
4830
  const char *zDbName, /* Name of the database */
4645
4831
  const void *pKey, int nKey /* The new key */
@@ -4649,7 +4835,7 @@ SQLITE_API int sqlite3_rekey_v2(
4649
4835
  ** Specify the activation key for a SEE database. Unless
4650
4836
  ** activated, none of the SEE routines will work.
4651
4837
  */
4652
- SQLITE_API void sqlite3_activate_see(
4838
+ SQLITE_API void SQLITE_STDCALL sqlite3_activate_see(
4653
4839
  const char *zPassPhrase /* Activation phrase */
4654
4840
  );
4655
4841
  #endif
@@ -4659,7 +4845,7 @@ SQLITE_API void sqlite3_activate_see(
4659
4845
  ** Specify the activation key for a CEROD database. Unless
4660
4846
  ** activated, none of the CEROD routines will work.
4661
4847
  */
4662
- SQLITE_API void sqlite3_activate_cerod(
4848
+ SQLITE_API void SQLITE_STDCALL sqlite3_activate_cerod(
4663
4849
  const char *zPassPhrase /* Activation phrase */
4664
4850
  );
4665
4851
  #endif
@@ -4681,7 +4867,7 @@ SQLITE_API void sqlite3_activate_cerod(
4681
4867
  ** all, then the behavior of sqlite3_sleep() may deviate from the description
4682
4868
  ** in the previous paragraphs.
4683
4869
  */
4684
- SQLITE_API int sqlite3_sleep(int);
4870
+ SQLITE_API int SQLITE_STDCALL sqlite3_sleep(int);
4685
4871
 
4686
4872
  /*
4687
4873
  ** CAPI3REF: Name Of The Folder Holding Temporary Files
@@ -4781,6 +4967,7 @@ SQLITE_API SQLITE_EXTERN char *sqlite3_data_directory;
4781
4967
  /*
4782
4968
  ** CAPI3REF: Test For Auto-Commit Mode
4783
4969
  ** KEYWORDS: {autocommit mode}
4970
+ ** METHOD: sqlite3
4784
4971
  **
4785
4972
  ** ^The sqlite3_get_autocommit() interface returns non-zero or
4786
4973
  ** zero if the given database connection is or is not in autocommit mode,
@@ -4799,10 +4986,11 @@ SQLITE_API SQLITE_EXTERN char *sqlite3_data_directory;
4799
4986
  ** connection while this routine is running, then the return value
4800
4987
  ** is undefined.
4801
4988
  */
4802
- SQLITE_API int sqlite3_get_autocommit(sqlite3*);
4989
+ SQLITE_API int SQLITE_STDCALL sqlite3_get_autocommit(sqlite3*);
4803
4990
 
4804
4991
  /*
4805
4992
  ** CAPI3REF: Find The Database Handle Of A Prepared Statement
4993
+ ** METHOD: sqlite3_stmt
4806
4994
  **
4807
4995
  ** ^The sqlite3_db_handle interface returns the [database connection] handle
4808
4996
  ** to which a [prepared statement] belongs. ^The [database connection]
@@ -4811,10 +4999,11 @@ SQLITE_API int sqlite3_get_autocommit(sqlite3*);
4811
4999
  ** to the [sqlite3_prepare_v2()] call (or its variants) that was used to
4812
5000
  ** create the statement in the first place.
4813
5001
  */
4814
- SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*);
5002
+ SQLITE_API sqlite3 *SQLITE_STDCALL sqlite3_db_handle(sqlite3_stmt*);
4815
5003
 
4816
5004
  /*
4817
5005
  ** CAPI3REF: Return The Filename For A Database Connection
5006
+ ** METHOD: sqlite3
4818
5007
  **
4819
5008
  ** ^The sqlite3_db_filename(D,N) interface returns a pointer to a filename
4820
5009
  ** associated with database N of connection D. ^The main database file
@@ -4827,19 +5016,21 @@ SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*);
4827
5016
  ** will be an absolute pathname, even if the filename used
4828
5017
  ** to open the database originally was a URI or relative pathname.
4829
5018
  */
4830
- 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);
4831
5020
 
4832
5021
  /*
4833
5022
  ** CAPI3REF: Determine if a database is read-only
5023
+ ** METHOD: sqlite3
4834
5024
  **
4835
5025
  ** ^The sqlite3_db_readonly(D,N) interface returns 1 if the database N
4836
5026
  ** of connection D is read-only, 0 if it is read/write, or -1 if N is not
4837
5027
  ** the name of a database on connection D.
4838
5028
  */
4839
- 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);
4840
5030
 
4841
5031
  /*
4842
5032
  ** CAPI3REF: Find the next prepared statement
5033
+ ** METHOD: sqlite3
4843
5034
  **
4844
5035
  ** ^This interface returns a pointer to the next [prepared statement] after
4845
5036
  ** pStmt associated with the [database connection] pDb. ^If pStmt is NULL
@@ -4851,10 +5042,11 @@ SQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName);
4851
5042
  ** [sqlite3_next_stmt(D,S)] must refer to an open database
4852
5043
  ** connection and in particular must not be a NULL pointer.
4853
5044
  */
4854
- 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);
4855
5046
 
4856
5047
  /*
4857
5048
  ** CAPI3REF: Commit And Rollback Notification Callbacks
5049
+ ** METHOD: sqlite3
4858
5050
  **
4859
5051
  ** ^The sqlite3_commit_hook() interface registers a callback
4860
5052
  ** function to be invoked whenever a transaction is [COMMIT | committed].
@@ -4899,11 +5091,12 @@ SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt);
4899
5091
  **
4900
5092
  ** See also the [sqlite3_update_hook()] interface.
4901
5093
  */
4902
- SQLITE_API void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*);
4903
- 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*);
4904
5096
 
4905
5097
  /*
4906
5098
  ** CAPI3REF: Data Change Notification Callbacks
5099
+ ** METHOD: sqlite3
4907
5100
  **
4908
5101
  ** ^The sqlite3_update_hook() interface registers a callback function
4909
5102
  ** with the [database connection] identified by the first argument
@@ -4950,7 +5143,7 @@ SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
4950
5143
  ** See also the [sqlite3_commit_hook()] and [sqlite3_rollback_hook()]
4951
5144
  ** interfaces.
4952
5145
  */
4953
- SQLITE_API void *sqlite3_update_hook(
5146
+ SQLITE_API void *SQLITE_STDCALL sqlite3_update_hook(
4954
5147
  sqlite3*,
4955
5148
  void(*)(void *,int ,char const *,char const *,sqlite3_int64),
4956
5149
  void*
@@ -4980,12 +5173,17 @@ SQLITE_API void *sqlite3_update_hook(
4980
5173
  ** future releases of SQLite. Applications that care about shared
4981
5174
  ** cache setting should set it explicitly.
4982
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
+ **
4983
5181
  ** This interface is threadsafe on processors where writing a
4984
5182
  ** 32-bit integer is atomic.
4985
5183
  **
4986
5184
  ** See Also: [SQLite Shared-Cache Mode]
4987
5185
  */
4988
- SQLITE_API int sqlite3_enable_shared_cache(int);
5186
+ SQLITE_API int SQLITE_STDCALL sqlite3_enable_shared_cache(int);
4989
5187
 
4990
5188
  /*
4991
5189
  ** CAPI3REF: Attempt To Free Heap Memory
@@ -5001,10 +5199,11 @@ SQLITE_API int sqlite3_enable_shared_cache(int);
5001
5199
  **
5002
5200
  ** See also: [sqlite3_db_release_memory()]
5003
5201
  */
5004
- SQLITE_API int sqlite3_release_memory(int);
5202
+ SQLITE_API int SQLITE_STDCALL sqlite3_release_memory(int);
5005
5203
 
5006
5204
  /*
5007
5205
  ** CAPI3REF: Free Memory Used By A Database Connection
5206
+ ** METHOD: sqlite3
5008
5207
  **
5009
5208
  ** ^The sqlite3_db_release_memory(D) interface attempts to free as much heap
5010
5209
  ** memory as possible from database connection D. Unlike the
@@ -5014,7 +5213,7 @@ SQLITE_API int sqlite3_release_memory(int);
5014
5213
  **
5015
5214
  ** See also: [sqlite3_release_memory()]
5016
5215
  */
5017
- SQLITE_API int sqlite3_db_release_memory(sqlite3*);
5216
+ SQLITE_API int SQLITE_STDCALL sqlite3_db_release_memory(sqlite3*);
5018
5217
 
5019
5218
  /*
5020
5219
  ** CAPI3REF: Impose A Limit On Heap Size
@@ -5066,7 +5265,7 @@ SQLITE_API int sqlite3_db_release_memory(sqlite3*);
5066
5265
  ** The circumstances under which SQLite will enforce the soft heap limit may
5067
5266
  ** changes in future releases of SQLite.
5068
5267
  */
5069
- 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);
5070
5269
 
5071
5270
  /*
5072
5271
  ** CAPI3REF: Deprecated Soft Heap Limit Interface
@@ -5077,26 +5276,34 @@ SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N);
5077
5276
  ** only. All new applications should use the
5078
5277
  ** [sqlite3_soft_heap_limit64()] interface rather than this one.
5079
5278
  */
5080
- 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);
5081
5280
 
5082
5281
 
5083
5282
  /*
5084
5283
  ** CAPI3REF: Extract Metadata About A Column Of A Table
5085
- **
5086
- ** ^This routine returns metadata about a specific column of a specific
5087
- ** database table accessible using the [database connection] handle
5088
- ** 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.
5089
5297
  **
5090
5298
  ** ^The column is identified by the second, third and fourth parameters to
5091
- ** 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
5092
5300
  ** (i.e. "main", "temp", or an attached database) containing the specified
5093
- ** 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
5094
5302
  ** for the table using the same algorithm used by the database engine to
5095
5303
  ** resolve unqualified table references.
5096
5304
  **
5097
5305
  ** ^The third and fourth parameters to this function are the table and column
5098
- ** name of the desired column, respectively. Neither of these parameters
5099
- ** may be NULL.
5306
+ ** name of the desired column, respectively.
5100
5307
  **
5101
5308
  ** ^Metadata is returned by writing to the memory locations passed as the 5th
5102
5309
  ** and subsequent parameters to this function. ^Any of these arguments may be
@@ -5115,16 +5322,17 @@ SQLITE_API SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N);
5115
5322
  ** </blockquote>)^
5116
5323
  **
5117
5324
  ** ^The memory pointed to by the character pointers returned for the
5118
- ** declaration type and collation sequence is valid only until the next
5325
+ ** declaration type and collation sequence is valid until the next
5119
5326
  ** call to any SQLite API function.
5120
5327
  **
5121
5328
  ** ^If the specified table is actually a view, an [error code] is returned.
5122
5329
  **
5123
- ** ^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
5124
5332
  ** [INTEGER PRIMARY KEY] column has been explicitly declared, then the output
5125
5333
  ** parameters are set for the explicitly declared column. ^(If there is no
5126
- ** explicitly declared [INTEGER PRIMARY KEY] column, then the output
5127
- ** parameters are set as follows:
5334
+ ** [INTEGER PRIMARY KEY] column, then the outputs
5335
+ ** for the [rowid] are set as follows:
5128
5336
  **
5129
5337
  ** <pre>
5130
5338
  ** data type: "INTEGER"
@@ -5134,15 +5342,11 @@ SQLITE_API SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N);
5134
5342
  ** auto increment: 0
5135
5343
  ** </pre>)^
5136
5344
  **
5137
- ** ^(This function may load one or more schemas from database files. If an
5138
- ** error occurs during this process, or if the requested table or column
5139
- ** cannot be found, an [error code] is returned and an error message left
5140
- ** in the [database connection] (to be retrieved using sqlite3_errmsg()).)^
5141
- **
5142
- ** ^This API is only available if the library was compiled with the
5143
- ** [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.
5144
5348
  */
5145
- SQLITE_API int sqlite3_table_column_metadata(
5349
+ SQLITE_API int SQLITE_STDCALL sqlite3_table_column_metadata(
5146
5350
  sqlite3 *db, /* Connection handle */
5147
5351
  const char *zDbName, /* Database name or NULL */
5148
5352
  const char *zTableName, /* Table name */
@@ -5156,6 +5360,7 @@ SQLITE_API int sqlite3_table_column_metadata(
5156
5360
 
5157
5361
  /*
5158
5362
  ** CAPI3REF: Load An Extension
5363
+ ** METHOD: sqlite3
5159
5364
  **
5160
5365
  ** ^This interface loads an SQLite extension library from the named file.
5161
5366
  **
@@ -5188,7 +5393,7 @@ SQLITE_API int sqlite3_table_column_metadata(
5188
5393
  **
5189
5394
  ** See also the [load_extension() SQL function].
5190
5395
  */
5191
- SQLITE_API int sqlite3_load_extension(
5396
+ SQLITE_API int SQLITE_STDCALL sqlite3_load_extension(
5192
5397
  sqlite3 *db, /* Load the extension into this database connection */
5193
5398
  const char *zFile, /* Name of the shared library containing extension */
5194
5399
  const char *zProc, /* Entry point. Derived from zFile if 0 */
@@ -5197,6 +5402,7 @@ SQLITE_API int sqlite3_load_extension(
5197
5402
 
5198
5403
  /*
5199
5404
  ** CAPI3REF: Enable Or Disable Extension Loading
5405
+ ** METHOD: sqlite3
5200
5406
  **
5201
5407
  ** ^So as not to open security holes in older applications that are
5202
5408
  ** unprepared to deal with [extension loading], and as a means of disabling
@@ -5208,7 +5414,7 @@ SQLITE_API int sqlite3_load_extension(
5208
5414
  ** to turn extension loading on and call it with onoff==0 to turn
5209
5415
  ** it back off again.
5210
5416
  */
5211
- 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);
5212
5418
 
5213
5419
  /*
5214
5420
  ** CAPI3REF: Automatically Load Statically Linked Extensions
@@ -5246,7 +5452,7 @@ SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff);
5246
5452
  ** See also: [sqlite3_reset_auto_extension()]
5247
5453
  ** and [sqlite3_cancel_auto_extension()]
5248
5454
  */
5249
- SQLITE_API int sqlite3_auto_extension(void (*xEntryPoint)(void));
5455
+ SQLITE_API int SQLITE_STDCALL sqlite3_auto_extension(void (*xEntryPoint)(void));
5250
5456
 
5251
5457
  /*
5252
5458
  ** CAPI3REF: Cancel Automatic Extension Loading
@@ -5258,7 +5464,7 @@ SQLITE_API int sqlite3_auto_extension(void (*xEntryPoint)(void));
5258
5464
  ** unregistered and it returns 0 if X was not on the list of initialization
5259
5465
  ** routines.
5260
5466
  */
5261
- SQLITE_API int sqlite3_cancel_auto_extension(void (*xEntryPoint)(void));
5467
+ SQLITE_API int SQLITE_STDCALL sqlite3_cancel_auto_extension(void (*xEntryPoint)(void));
5262
5468
 
5263
5469
  /*
5264
5470
  ** CAPI3REF: Reset Automatic Extension Loading
@@ -5266,7 +5472,7 @@ SQLITE_API int sqlite3_cancel_auto_extension(void (*xEntryPoint)(void));
5266
5472
  ** ^This interface disables all automatic extensions previously
5267
5473
  ** registered using [sqlite3_auto_extension()].
5268
5474
  */
5269
- SQLITE_API void sqlite3_reset_auto_extension(void);
5475
+ SQLITE_API void SQLITE_STDCALL sqlite3_reset_auto_extension(void);
5270
5476
 
5271
5477
  /*
5272
5478
  ** The interface to the virtual-table mechanism is currently considered
@@ -5446,6 +5652,7 @@ struct sqlite3_index_info {
5446
5652
 
5447
5653
  /*
5448
5654
  ** CAPI3REF: Register A Virtual Table Implementation
5655
+ ** METHOD: sqlite3
5449
5656
  **
5450
5657
  ** ^These routines are used to register a new [virtual table module] name.
5451
5658
  ** ^Module names must be registered before
@@ -5469,13 +5676,13 @@ struct sqlite3_index_info {
5469
5676
  ** interface is equivalent to sqlite3_create_module_v2() with a NULL
5470
5677
  ** destructor.
5471
5678
  */
5472
- SQLITE_API int sqlite3_create_module(
5679
+ SQLITE_API int SQLITE_STDCALL sqlite3_create_module(
5473
5680
  sqlite3 *db, /* SQLite connection to register module with */
5474
5681
  const char *zName, /* Name of the module */
5475
5682
  const sqlite3_module *p, /* Methods for the module */
5476
5683
  void *pClientData /* Client data for xCreate/xConnect */
5477
5684
  );
5478
- SQLITE_API int sqlite3_create_module_v2(
5685
+ SQLITE_API int SQLITE_STDCALL sqlite3_create_module_v2(
5479
5686
  sqlite3 *db, /* SQLite connection to register module with */
5480
5687
  const char *zName, /* Name of the module */
5481
5688
  const sqlite3_module *p, /* Methods for the module */
@@ -5503,7 +5710,7 @@ SQLITE_API int sqlite3_create_module_v2(
5503
5710
  */
5504
5711
  struct sqlite3_vtab {
5505
5712
  const sqlite3_module *pModule; /* The module for this virtual table */
5506
- int nRef; /* NO LONGER USED */
5713
+ int nRef; /* Number of open cursors */
5507
5714
  char *zErrMsg; /* Error message from sqlite3_mprintf() */
5508
5715
  /* Virtual table implementations will typically add additional fields */
5509
5716
  };
@@ -5538,10 +5745,11 @@ struct sqlite3_vtab_cursor {
5538
5745
  ** to declare the format (the names and datatypes of the columns) of
5539
5746
  ** the virtual tables they implement.
5540
5747
  */
5541
- SQLITE_API int sqlite3_declare_vtab(sqlite3*, const char *zSQL);
5748
+ SQLITE_API int SQLITE_STDCALL sqlite3_declare_vtab(sqlite3*, const char *zSQL);
5542
5749
 
5543
5750
  /*
5544
5751
  ** CAPI3REF: Overload A Function For A Virtual Table
5752
+ ** METHOD: sqlite3
5545
5753
  **
5546
5754
  ** ^(Virtual tables can provide alternative implementations of functions
5547
5755
  ** using the [xFindFunction] method of the [virtual table module].
@@ -5556,7 +5764,7 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3*, const char *zSQL);
5556
5764
  ** purpose is to be a placeholder function that can be overloaded
5557
5765
  ** by a [virtual table].
5558
5766
  */
5559
- 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);
5560
5768
 
5561
5769
  /*
5562
5770
  ** The interface to the virtual-table mechanism defined above (back up
@@ -5584,6 +5792,8 @@ typedef struct sqlite3_blob sqlite3_blob;
5584
5792
 
5585
5793
  /*
5586
5794
  ** CAPI3REF: Open A BLOB For Incremental I/O
5795
+ ** METHOD: sqlite3
5796
+ ** CONSTRUCTOR: sqlite3_blob
5587
5797
  **
5588
5798
  ** ^(This interfaces opens a [BLOB handle | handle] to the BLOB located
5589
5799
  ** in row iRow, column zColumn, table zTable in database zDb;
@@ -5593,26 +5803,42 @@ typedef struct sqlite3_blob sqlite3_blob;
5593
5803
  ** SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;
5594
5804
  ** </pre>)^
5595
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
+ **
5596
5812
  ** ^If the flags parameter is non-zero, then the BLOB is opened for read
5597
- ** and write access. ^If it is zero, the BLOB is opened for read access.
5598
- ** ^It is not possible to open a column that is part of an index or primary
5599
- ** key for writing. ^If [foreign key constraints] are enabled, it is
5600
- ** not possible to open a column that is part of a [child key] for writing.
5601
- **
5602
- ** ^Note that the database name is not the filename that contains
5603
- ** the database but rather the symbolic name of the database that
5604
- ** appears after the AS keyword when the database is connected using [ATTACH].
5605
- ** ^For the main database file, the database name is "main".
5606
- ** ^For TEMP tables, the database name is "temp".
5607
- **
5608
- ** ^(On success, [SQLITE_OK] is returned and the new [BLOB handle] is written
5609
- ** to *ppBlob. Otherwise an [error code] is returned and *ppBlob is set
5610
- ** to be a null pointer.)^
5611
- ** ^This function sets the [database connection] error code and message
5612
- ** accessible via [sqlite3_errcode()] and [sqlite3_errmsg()] and related
5613
- ** functions. ^Note that the *ppBlob variable is always initialized in a
5614
- ** way that makes it safe to invoke [sqlite3_blob_close()] on *ppBlob
5615
- ** 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
+ **
5616
5842
  **
5617
5843
  ** ^(If the row that a BLOB handle points to is modified by an
5618
5844
  ** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects
@@ -5630,18 +5856,14 @@ typedef struct sqlite3_blob sqlite3_blob;
5630
5856
  ** interface. Use the [UPDATE] SQL command to change the size of a
5631
5857
  ** blob.
5632
5858
  **
5633
- ** ^The [sqlite3_blob_open()] interface will fail for a [WITHOUT ROWID]
5634
- ** table. Incremental BLOB I/O is not possible on [WITHOUT ROWID] tables.
5635
- **
5636
5859
  ** ^The [sqlite3_bind_zeroblob()] and [sqlite3_result_zeroblob()] interfaces
5637
- ** and the built-in [zeroblob] SQL function can be used, if desired,
5638
- ** to create an empty, zero-filled blob in which to read or write using
5639
- ** 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.
5640
5862
  **
5641
5863
  ** To avoid a resource leak, every open [BLOB handle] should eventually
5642
5864
  ** be released by a call to [sqlite3_blob_close()].
5643
5865
  */
5644
- SQLITE_API int sqlite3_blob_open(
5866
+ SQLITE_API int SQLITE_STDCALL sqlite3_blob_open(
5645
5867
  sqlite3*,
5646
5868
  const char *zDb,
5647
5869
  const char *zTable,
@@ -5653,6 +5875,7 @@ SQLITE_API int sqlite3_blob_open(
5653
5875
 
5654
5876
  /*
5655
5877
  ** CAPI3REF: Move a BLOB Handle to a New Row
5878
+ ** METHOD: sqlite3_blob
5656
5879
  **
5657
5880
  ** ^This function is used to move an existing blob handle so that it points
5658
5881
  ** to a different row of the same database table. ^The new row is identified
@@ -5673,34 +5896,34 @@ SQLITE_API int sqlite3_blob_open(
5673
5896
  **
5674
5897
  ** ^This function sets the database handle error code and message.
5675
5898
  */
5676
- 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);
5677
5900
 
5678
5901
  /*
5679
5902
  ** CAPI3REF: Close A BLOB Handle
5903
+ ** DESTRUCTOR: sqlite3_blob
5680
5904
  **
5681
- ** ^Closes an open [BLOB handle].
5682
- **
5683
- ** ^Closing a BLOB shall cause the current transaction to commit
5684
- ** if there are no other BLOBs, no pending prepared statements, and the
5685
- ** database connection is in [autocommit mode].
5686
- ** ^If any writes were made to the BLOB, they might be held in cache
5687
- ** until the close operation if they will fit.
5688
- **
5689
- ** ^(Closing the BLOB often forces the changes
5690
- ** out to disk and so if any I/O errors occur, they will likely occur
5691
- ** at the time when the BLOB is closed. Any errors that occur during
5692
- ** closing are reported as a non-zero return value.)^
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.)^
5693
5908
  **
5694
- ** ^(The BLOB is closed unconditionally. Even if this routine returns
5695
- ** an error code, the BLOB is still closed.)^
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.
5696
5914
  **
5697
- ** ^Calling this routine with a null pointer (such as would be returned
5698
- ** 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.
5699
5921
  */
5700
- SQLITE_API int sqlite3_blob_close(sqlite3_blob *);
5922
+ SQLITE_API int SQLITE_STDCALL sqlite3_blob_close(sqlite3_blob *);
5701
5923
 
5702
5924
  /*
5703
5925
  ** CAPI3REF: Return The Size Of An Open BLOB
5926
+ ** METHOD: sqlite3_blob
5704
5927
  **
5705
5928
  ** ^Returns the size in bytes of the BLOB accessible via the
5706
5929
  ** successfully opened [BLOB handle] in its only argument. ^The
@@ -5712,10 +5935,11 @@ SQLITE_API int sqlite3_blob_close(sqlite3_blob *);
5712
5935
  ** been closed by [sqlite3_blob_close()]. Passing any other pointer in
5713
5936
  ** to this routine results in undefined and probably undesirable behavior.
5714
5937
  */
5715
- SQLITE_API int sqlite3_blob_bytes(sqlite3_blob *);
5938
+ SQLITE_API int SQLITE_STDCALL sqlite3_blob_bytes(sqlite3_blob *);
5716
5939
 
5717
5940
  /*
5718
5941
  ** CAPI3REF: Read Data From A BLOB Incrementally
5942
+ ** METHOD: sqlite3_blob
5719
5943
  **
5720
5944
  ** ^(This function is used to read data from an open [BLOB handle] into a
5721
5945
  ** caller-supplied buffer. N bytes of data are copied into buffer Z
@@ -5740,26 +5964,33 @@ SQLITE_API int sqlite3_blob_bytes(sqlite3_blob *);
5740
5964
  **
5741
5965
  ** See also: [sqlite3_blob_write()].
5742
5966
  */
5743
- 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);
5744
5968
 
5745
5969
  /*
5746
5970
  ** CAPI3REF: Write Data Into A BLOB Incrementally
5971
+ ** METHOD: sqlite3_blob
5747
5972
  **
5748
- ** ^This function is used to write data into an open [BLOB handle] from a
5749
- ** caller-supplied buffer. ^N bytes of data are copied from the buffer Z
5750
- ** 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.
5751
5982
  **
5752
5983
  ** ^If the [BLOB handle] passed as the first argument was not opened for
5753
5984
  ** writing (the flags parameter to [sqlite3_blob_open()] was zero),
5754
5985
  ** this function returns [SQLITE_READONLY].
5755
5986
  **
5756
- ** ^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
5757
5988
  ** not possible to increase the size of a BLOB using this API.
5758
5989
  ** ^If offset iOffset is less than N bytes from the end of the BLOB,
5759
- ** [SQLITE_ERROR] is returned and no data is written. ^If N is
5760
- ** less than zero [SQLITE_ERROR] is returned and no data is written.
5761
- ** The size of the BLOB (and hence the maximum value of N+iOffset)
5762
- ** 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.
5763
5994
  **
5764
5995
  ** ^An attempt to write to an expired [BLOB handle] fails with an
5765
5996
  ** error code of [SQLITE_ABORT]. ^Writes to the BLOB that occurred
@@ -5768,9 +5999,6 @@ SQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
5768
5999
  ** have been overwritten by the statement that expired the BLOB handle
5769
6000
  ** or by other independent statements.
5770
6001
  **
5771
- ** ^(On success, sqlite3_blob_write() returns SQLITE_OK.
5772
- ** Otherwise, an [error code] or an [extended error code] is returned.)^
5773
- **
5774
6002
  ** This routine only works on a [BLOB handle] which has been created
5775
6003
  ** by a prior successful call to [sqlite3_blob_open()] and which has not
5776
6004
  ** been closed by [sqlite3_blob_close()]. Passing any other pointer in
@@ -5778,7 +6006,7 @@ SQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
5778
6006
  **
5779
6007
  ** See also: [sqlite3_blob_read()].
5780
6008
  */
5781
- 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);
5782
6010
 
5783
6011
  /*
5784
6012
  ** CAPI3REF: Virtual File System Objects
@@ -5809,9 +6037,9 @@ SQLITE_API int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOff
5809
6037
  ** ^(If the default VFS is unregistered, another VFS is chosen as
5810
6038
  ** the default. The choice for the new VFS is arbitrary.)^
5811
6039
  */
5812
- SQLITE_API sqlite3_vfs *sqlite3_vfs_find(const char *zVfsName);
5813
- SQLITE_API int sqlite3_vfs_register(sqlite3_vfs*, int makeDflt);
5814
- 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*);
5815
6043
 
5816
6044
  /*
5817
6045
  ** CAPI3REF: Mutexes
@@ -5823,34 +6051,34 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
5823
6051
  **
5824
6052
  ** The SQLite source code contains multiple implementations
5825
6053
  ** of these mutex routines. An appropriate implementation
5826
- ** is selected automatically at compile-time. ^(The following
6054
+ ** is selected automatically at compile-time. The following
5827
6055
  ** implementations are available in the SQLite core:
5828
6056
  **
5829
6057
  ** <ul>
5830
6058
  ** <li> SQLITE_MUTEX_PTHREADS
5831
6059
  ** <li> SQLITE_MUTEX_W32
5832
6060
  ** <li> SQLITE_MUTEX_NOOP
5833
- ** </ul>)^
6061
+ ** </ul>
5834
6062
  **
5835
- ** ^The SQLITE_MUTEX_NOOP implementation is a set of routines
6063
+ ** The SQLITE_MUTEX_NOOP implementation is a set of routines
5836
6064
  ** that does no real locking and is appropriate for use in
5837
- ** a single-threaded application. ^The SQLITE_MUTEX_PTHREADS and
6065
+ ** a single-threaded application. The SQLITE_MUTEX_PTHREADS and
5838
6066
  ** SQLITE_MUTEX_W32 implementations are appropriate for use on Unix
5839
6067
  ** and Windows.
5840
6068
  **
5841
- ** ^(If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor
6069
+ ** If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor
5842
6070
  ** macro defined (with "-DSQLITE_MUTEX_APPDEF=1"), then no mutex
5843
6071
  ** implementation is included with the library. In this case the
5844
6072
  ** application must supply a custom mutex implementation using the
5845
6073
  ** [SQLITE_CONFIG_MUTEX] option of the sqlite3_config() function
5846
6074
  ** before calling sqlite3_initialize() or any other public sqlite3_
5847
- ** function that calls sqlite3_initialize().)^
6075
+ ** function that calls sqlite3_initialize().
5848
6076
  **
5849
6077
  ** ^The sqlite3_mutex_alloc() routine allocates a new
5850
- ** mutex and returns a pointer to it. ^If it returns NULL
5851
- ** that means that a mutex could not be allocated. ^SQLite
5852
- ** will unwind its stack and return an error. ^(The argument
5853
- ** 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:
5854
6082
  **
5855
6083
  ** <ul>
5856
6084
  ** <li> SQLITE_MUTEX_FAST
@@ -5863,7 +6091,8 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
5863
6091
  ** <li> SQLITE_MUTEX_STATIC_PMEM
5864
6092
  ** <li> SQLITE_MUTEX_STATIC_APP1
5865
6093
  ** <li> SQLITE_MUTEX_STATIC_APP2
5866
- ** </ul>)^
6094
+ ** <li> SQLITE_MUTEX_STATIC_APP3
6095
+ ** </ul>
5867
6096
  **
5868
6097
  ** ^The first two constants (SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE)
5869
6098
  ** cause sqlite3_mutex_alloc() to create
@@ -5871,14 +6100,14 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
5871
6100
  ** is used but not necessarily so when SQLITE_MUTEX_FAST is used.
5872
6101
  ** The mutex implementation does not need to make a distinction
5873
6102
  ** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does
5874
- ** not want to. ^SQLite will only request a recursive mutex in
5875
- ** 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
5876
6105
  ** implementation is available on the host platform, the mutex subsystem
5877
6106
  ** might return such a mutex in response to SQLITE_MUTEX_FAST.
5878
6107
  **
5879
6108
  ** ^The other allowed parameters to sqlite3_mutex_alloc() (anything other
5880
6109
  ** than SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) each return
5881
- ** a pointer to a static preexisting mutex. ^Six static mutexes are
6110
+ ** a pointer to a static preexisting mutex. ^Nine static mutexes are
5882
6111
  ** used by the current version of SQLite. Future versions of SQLite
5883
6112
  ** may add additional static mutexes. Static mutexes are for internal
5884
6113
  ** use by SQLite only. Applications that use SQLite mutexes should
@@ -5887,16 +6116,13 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
5887
6116
  **
5888
6117
  ** ^Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST
5889
6118
  ** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc()
5890
- ** returns a different mutex on every call. ^But for the static
6119
+ ** returns a different mutex on every call. ^For the static
5891
6120
  ** mutex types, the same mutex is returned on every call that has
5892
6121
  ** the same type number.
5893
6122
  **
5894
6123
  ** ^The sqlite3_mutex_free() routine deallocates a previously
5895
- ** allocated dynamic mutex. ^SQLite is careful to deallocate every
5896
- ** dynamic mutex that it allocates. The dynamic mutexes must not be in
5897
- ** use when they are deallocated. Attempting to deallocate a static
5898
- ** mutex results in undefined behavior. ^SQLite never deallocates
5899
- ** a static mutex.
6124
+ ** allocated dynamic mutex. Attempting to deallocate a static
6125
+ ** mutex results in undefined behavior.
5900
6126
  **
5901
6127
  ** ^The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt
5902
6128
  ** to enter a mutex. ^If another thread is already within the mutex,
@@ -5904,23 +6130,21 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
5904
6130
  ** SQLITE_BUSY. ^The sqlite3_mutex_try() interface returns [SQLITE_OK]
5905
6131
  ** upon successful entry. ^(Mutexes created using
5906
6132
  ** SQLITE_MUTEX_RECURSIVE can be entered multiple times by the same thread.
5907
- ** In such cases the,
6133
+ ** In such cases, the
5908
6134
  ** mutex must be exited an equal number of times before another thread
5909
- ** can enter.)^ ^(If the same thread tries to enter any other
5910
- ** kind of mutex more than once, the behavior is undefined.
5911
- ** SQLite will never exhibit
5912
- ** 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.
5913
6137
  **
5914
6138
  ** ^(Some systems (for example, Windows 95) do not support the operation
5915
6139
  ** implemented by sqlite3_mutex_try(). On those systems, sqlite3_mutex_try()
5916
- ** will always return SQLITE_BUSY. The SQLite core only ever uses
5917
- ** 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.)^
5918
6143
  **
5919
6144
  ** ^The sqlite3_mutex_leave() routine exits a mutex that was
5920
- ** previously entered by the same thread. ^(The behavior
6145
+ ** previously entered by the same thread. The behavior
5921
6146
  ** is undefined if the mutex is not currently entered by the
5922
- ** calling thread or is not currently allocated. SQLite will
5923
- ** never do either.)^
6147
+ ** calling thread or is not currently allocated.
5924
6148
  **
5925
6149
  ** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), or
5926
6150
  ** sqlite3_mutex_leave() is a NULL pointer, then all three routines
@@ -5928,11 +6152,11 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
5928
6152
  **
5929
6153
  ** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()].
5930
6154
  */
5931
- SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int);
5932
- SQLITE_API void sqlite3_mutex_free(sqlite3_mutex*);
5933
- SQLITE_API void sqlite3_mutex_enter(sqlite3_mutex*);
5934
- SQLITE_API int sqlite3_mutex_try(sqlite3_mutex*);
5935
- 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*);
5936
6160
 
5937
6161
  /*
5938
6162
  ** CAPI3REF: Mutex Methods Object
@@ -5941,9 +6165,9 @@ SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex*);
5941
6165
  ** used to allocate and use mutexes.
5942
6166
  **
5943
6167
  ** Usually, the default mutex implementations provided by SQLite are
5944
- ** sufficient, however the user has the option of substituting a custom
6168
+ ** sufficient, however the application has the option of substituting a custom
5945
6169
  ** implementation for specialized deployments or systems for which SQLite
5946
- ** does not provide a suitable implementation. In this case, the user
6170
+ ** does not provide a suitable implementation. In this case, the application
5947
6171
  ** creates and populates an instance of this structure to pass
5948
6172
  ** to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option.
5949
6173
  ** Additionally, an instance of this structure can be used as an
@@ -5984,13 +6208,13 @@ SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex*);
5984
6208
  ** (i.e. it is acceptable to provide an implementation that segfaults if
5985
6209
  ** it is passed a NULL pointer).
5986
6210
  **
5987
- ** The xMutexInit() method must be threadsafe. ^It must be harmless to
6211
+ ** The xMutexInit() method must be threadsafe. It must be harmless to
5988
6212
  ** invoke xMutexInit() multiple times within the same process and without
5989
6213
  ** intervening calls to xMutexEnd(). Second and subsequent calls to
5990
6214
  ** xMutexInit() must be no-ops.
5991
6215
  **
5992
- ** ^xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()]
5993
- ** 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
5994
6218
  ** allocation for a static mutex. ^However xMutexAlloc() may use SQLite
5995
6219
  ** memory allocation for a fast or recursive mutex.
5996
6220
  **
@@ -6016,34 +6240,34 @@ struct sqlite3_mutex_methods {
6016
6240
  ** CAPI3REF: Mutex Verification Routines
6017
6241
  **
6018
6242
  ** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routines
6019
- ** are intended for use inside assert() statements. ^The SQLite core
6243
+ ** are intended for use inside assert() statements. The SQLite core
6020
6244
  ** never uses these routines except inside an assert() and applications
6021
- ** 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
6022
6246
  ** provides implementations for these routines when it is compiled
6023
- ** with the SQLITE_DEBUG flag. ^External mutex implementations
6247
+ ** with the SQLITE_DEBUG flag. External mutex implementations
6024
6248
  ** are only required to provide these routines if SQLITE_DEBUG is
6025
6249
  ** defined and if NDEBUG is not defined.
6026
6250
  **
6027
- ** ^These routines should return true if the mutex in their argument
6251
+ ** These routines should return true if the mutex in their argument
6028
6252
  ** is held or not held, respectively, by the calling thread.
6029
6253
  **
6030
- ** ^The implementation is not required to provide versions of these
6254
+ ** The implementation is not required to provide versions of these
6031
6255
  ** routines that actually work. If the implementation does not provide working
6032
6256
  ** versions of these routines, it should at least provide stubs that always
6033
6257
  ** return true so that one does not get spurious assertion failures.
6034
6258
  **
6035
- ** ^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
6036
6260
  ** the routine should return 1. This seems counter-intuitive since
6037
6261
  ** clearly the mutex cannot be held if it does not exist. But
6038
6262
  ** the reason the mutex does not exist is because the build is not
6039
6263
  ** using mutexes. And we do not want the assert() containing the
6040
6264
  ** call to sqlite3_mutex_held() to fail, so a non-zero return is
6041
- ** the appropriate thing to do. ^The sqlite3_mutex_notheld()
6265
+ ** the appropriate thing to do. The sqlite3_mutex_notheld()
6042
6266
  ** interface should also return 1 when given a NULL pointer.
6043
6267
  */
6044
6268
  #ifndef NDEBUG
6045
- SQLITE_API int sqlite3_mutex_held(sqlite3_mutex*);
6046
- 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*);
6047
6271
  #endif
6048
6272
 
6049
6273
  /*
@@ -6069,9 +6293,13 @@ SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*);
6069
6293
  #define SQLITE_MUTEX_STATIC_APP1 8 /* For use by application */
6070
6294
  #define SQLITE_MUTEX_STATIC_APP2 9 /* For use by application */
6071
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 */
6072
6299
 
6073
6300
  /*
6074
6301
  ** CAPI3REF: Retrieve the mutex for a database connection
6302
+ ** METHOD: sqlite3
6075
6303
  **
6076
6304
  ** ^This interface returns a pointer the [sqlite3_mutex] object that
6077
6305
  ** serializes access to the [database connection] given in the argument
@@ -6079,10 +6307,11 @@ SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*);
6079
6307
  ** ^If the [threading mode] is Single-thread or Multi-thread then this
6080
6308
  ** routine returns a NULL pointer.
6081
6309
  */
6082
- SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*);
6310
+ SQLITE_API sqlite3_mutex *SQLITE_STDCALL sqlite3_db_mutex(sqlite3*);
6083
6311
 
6084
6312
  /*
6085
6313
  ** CAPI3REF: Low-Level Control Of Database Files
6314
+ ** METHOD: sqlite3
6086
6315
  **
6087
6316
  ** ^The [sqlite3_file_control()] interface makes a direct call to the
6088
6317
  ** xFileControl method for the [sqlite3_io_methods] object associated
@@ -6113,7 +6342,7 @@ SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*);
6113
6342
  **
6114
6343
  ** See also: [SQLITE_FCNTL_LOCKSTATE]
6115
6344
  */
6116
- 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*);
6117
6346
 
6118
6347
  /*
6119
6348
  ** CAPI3REF: Testing Interface
@@ -6132,7 +6361,7 @@ SQLITE_API int sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*
6132
6361
  ** Unlike most of the SQLite API, this function is not guaranteed to
6133
6362
  ** operate consistently from one release to the next.
6134
6363
  */
6135
- SQLITE_API int sqlite3_test_control(int op, ...);
6364
+ SQLITE_API int SQLITE_CDECL sqlite3_test_control(int op, ...);
6136
6365
 
6137
6366
  /*
6138
6367
  ** CAPI3REF: Testing Interface Operation Codes
@@ -6160,17 +6389,19 @@ SQLITE_API int sqlite3_test_control(int op, ...);
6160
6389
  #define SQLITE_TESTCTRL_ISKEYWORD 16
6161
6390
  #define SQLITE_TESTCTRL_SCRATCHMALLOC 17
6162
6391
  #define SQLITE_TESTCTRL_LOCALTIME_FAULT 18
6163
- #define SQLITE_TESTCTRL_EXPLAIN_STMT 19
6392
+ #define SQLITE_TESTCTRL_EXPLAIN_STMT 19 /* NOT USED */
6164
6393
  #define SQLITE_TESTCTRL_NEVER_CORRUPT 20
6165
6394
  #define SQLITE_TESTCTRL_VDBE_COVERAGE 21
6166
6395
  #define SQLITE_TESTCTRL_BYTEORDER 22
6167
6396
  #define SQLITE_TESTCTRL_ISINIT 23
6168
- #define SQLITE_TESTCTRL_LAST 23
6397
+ #define SQLITE_TESTCTRL_SORTER_MMAP 24
6398
+ #define SQLITE_TESTCTRL_IMPOSTER 25
6399
+ #define SQLITE_TESTCTRL_LAST 25
6169
6400
 
6170
6401
  /*
6171
6402
  ** CAPI3REF: SQLite Runtime Status
6172
6403
  **
6173
- ** ^This interface is used to retrieve runtime status information
6404
+ ** ^These interfaces are used to retrieve runtime status information
6174
6405
  ** about the performance of SQLite, and optionally to reset various
6175
6406
  ** highwater marks. ^The first argument is an integer code for
6176
6407
  ** the specific parameter to measure. ^(Recognized integer codes
@@ -6184,19 +6415,22 @@ SQLITE_API int sqlite3_test_control(int op, ...);
6184
6415
  ** ^(Other parameters record only the highwater mark and not the current
6185
6416
  ** value. For these latter parameters nothing is written into *pCurrent.)^
6186
6417
  **
6187
- ** ^The sqlite3_status() routine returns SQLITE_OK on success and a
6188
- ** 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.
6189
6420
  **
6190
- ** This routine is threadsafe but is not atomic. This routine can be
6191
- ** called while other threads are running the same or different SQLite
6192
- ** interfaces. However the values returned in *pCurrent and
6193
- ** *pHighwater reflect the status of SQLite at different points in time
6194
- ** and it is possible that another thread might change the parameter
6195
- ** 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.
6196
6424
  **
6197
6425
  ** See also: [sqlite3_db_status()]
6198
6426
  */
6199
- 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
+ );
6200
6434
 
6201
6435
 
6202
6436
  /*
@@ -6294,6 +6528,7 @@ SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetF
6294
6528
 
6295
6529
  /*
6296
6530
  ** CAPI3REF: Database Connection Status
6531
+ ** METHOD: sqlite3
6297
6532
  **
6298
6533
  ** ^This interface is used to retrieve runtime status information
6299
6534
  ** about a single [database connection]. ^The first argument is the
@@ -6314,7 +6549,7 @@ SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetF
6314
6549
  **
6315
6550
  ** See also: [sqlite3_status()] and [sqlite3_stmt_status()].
6316
6551
  */
6317
- 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);
6318
6553
 
6319
6554
  /*
6320
6555
  ** CAPI3REF: Status Parameters for database connections
@@ -6356,12 +6591,12 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
6356
6591
  ** the current value is always zero.)^
6357
6592
  **
6358
6593
  ** [[SQLITE_DBSTATUS_CACHE_USED]] ^(<dt>SQLITE_DBSTATUS_CACHE_USED</dt>
6359
- ** <dd>This parameter returns the approximate number of of bytes of heap
6594
+ ** <dd>This parameter returns the approximate number of bytes of heap
6360
6595
  ** memory used by all pager caches associated with the database connection.)^
6361
6596
  ** ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always 0.
6362
6597
  **
6363
6598
  ** [[SQLITE_DBSTATUS_SCHEMA_USED]] ^(<dt>SQLITE_DBSTATUS_SCHEMA_USED</dt>
6364
- ** <dd>This parameter returns the approximate number of of bytes of heap
6599
+ ** <dd>This parameter returns the approximate number of bytes of heap
6365
6600
  ** memory used to store the schema for all databases associated
6366
6601
  ** with the connection - main, temp, and any [ATTACH]-ed databases.)^
6367
6602
  ** ^The full amount of memory used by the schemas is reported, even if the
@@ -6370,7 +6605,7 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
6370
6605
  ** ^The highwater mark associated with SQLITE_DBSTATUS_SCHEMA_USED is always 0.
6371
6606
  **
6372
6607
  ** [[SQLITE_DBSTATUS_STMT_USED]] ^(<dt>SQLITE_DBSTATUS_STMT_USED</dt>
6373
- ** <dd>This parameter returns the approximate number of of bytes of heap
6608
+ ** <dd>This parameter returns the approximate number of bytes of heap
6374
6609
  ** and lookaside memory used by all prepared statements associated with
6375
6610
  ** the database connection.)^
6376
6611
  ** ^The highwater mark associated with SQLITE_DBSTATUS_STMT_USED is always 0.
@@ -6422,6 +6657,7 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
6422
6657
 
6423
6658
  /*
6424
6659
  ** CAPI3REF: Prepared Statement Status
6660
+ ** METHOD: sqlite3_stmt
6425
6661
  **
6426
6662
  ** ^(Each prepared statement maintains various
6427
6663
  ** [SQLITE_STMTSTATUS counters] that measure the number
@@ -6443,7 +6679,7 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
6443
6679
  **
6444
6680
  ** See also: [sqlite3_status()] and [sqlite3_db_status()].
6445
6681
  */
6446
- 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);
6447
6683
 
6448
6684
  /*
6449
6685
  ** CAPI3REF: Status Parameters for prepared statements
@@ -6770,6 +7006,10 @@ typedef struct sqlite3_backup sqlite3_backup;
6770
7006
  ** must be different or else sqlite3_backup_init(D,N,S,M) will fail with
6771
7007
  ** an error.
6772
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
+ **
6773
7013
  ** ^If an error occurs within sqlite3_backup_init(D,N,S,M), then NULL is
6774
7014
  ** returned and an error code and error message are stored in the
6775
7015
  ** destination [database connection] D.
@@ -6862,20 +7102,20 @@ typedef struct sqlite3_backup sqlite3_backup;
6862
7102
  ** is not a permanent error and does not affect the return value of
6863
7103
  ** sqlite3_backup_finish().
6864
7104
  **
6865
- ** [[sqlite3_backup__remaining()]] [[sqlite3_backup_pagecount()]]
7105
+ ** [[sqlite3_backup_remaining()]] [[sqlite3_backup_pagecount()]]
6866
7106
  ** <b>sqlite3_backup_remaining() and sqlite3_backup_pagecount()</b>
6867
7107
  **
6868
- ** ^Each call to sqlite3_backup_step() sets two values inside
6869
- ** the [sqlite3_backup] object: the number of pages still to be backed
6870
- ** up and the total number of pages in the source database file.
6871
- ** The sqlite3_backup_remaining() and sqlite3_backup_pagecount() interfaces
6872
- ** retrieve these two values, respectively.
6873
- **
6874
- ** ^The values returned by these functions are only updated by
6875
- ** sqlite3_backup_step(). ^If the source database is modified during a backup
6876
- ** operation, then the values are not updated to account for any extra
6877
- ** pages that need to be updated or the size of the source database file
6878
- ** 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().)^
6879
7119
  **
6880
7120
  ** <b>Concurrent Usage of Database Handles</b>
6881
7121
  **
@@ -6908,19 +7148,20 @@ typedef struct sqlite3_backup sqlite3_backup;
6908
7148
  ** same time as another thread is invoking sqlite3_backup_step() it is
6909
7149
  ** possible that they return invalid values.
6910
7150
  */
6911
- SQLITE_API sqlite3_backup *sqlite3_backup_init(
7151
+ SQLITE_API sqlite3_backup *SQLITE_STDCALL sqlite3_backup_init(
6912
7152
  sqlite3 *pDest, /* Destination database handle */
6913
7153
  const char *zDestName, /* Destination database name */
6914
7154
  sqlite3 *pSource, /* Source database handle */
6915
7155
  const char *zSourceName /* Source database name */
6916
7156
  );
6917
- SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage);
6918
- SQLITE_API int sqlite3_backup_finish(sqlite3_backup *p);
6919
- SQLITE_API int sqlite3_backup_remaining(sqlite3_backup *p);
6920
- 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);
6921
7161
 
6922
7162
  /*
6923
7163
  ** CAPI3REF: Unlock Notification
7164
+ ** METHOD: sqlite3
6924
7165
  **
6925
7166
  ** ^When running in shared-cache mode, a database operation may fail with
6926
7167
  ** an [SQLITE_LOCKED] error if the required locks on the shared-cache or
@@ -7033,7 +7274,7 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p);
7033
7274
  ** the special "DROP TABLE/INDEX" case, the extended error code is just
7034
7275
  ** SQLITE_LOCKED.)^
7035
7276
  */
7036
- SQLITE_API int sqlite3_unlock_notify(
7277
+ SQLITE_API int SQLITE_STDCALL sqlite3_unlock_notify(
7037
7278
  sqlite3 *pBlocked, /* Waiting connection */
7038
7279
  void (*xNotify)(void **apArg, int nArg), /* Callback function to invoke */
7039
7280
  void *pNotifyArg /* Argument to pass to xNotify */
@@ -7048,8 +7289,8 @@ SQLITE_API int sqlite3_unlock_notify(
7048
7289
  ** strings in a case-independent fashion, using the same definition of "case
7049
7290
  ** independence" that SQLite uses internally when comparing identifiers.
7050
7291
  */
7051
- SQLITE_API int sqlite3_stricmp(const char *, const char *);
7052
- 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);
7053
7294
 
7054
7295
  /*
7055
7296
  ** CAPI3REF: String Globbing
@@ -7064,7 +7305,7 @@ SQLITE_API int sqlite3_strnicmp(const char *, const char *, int);
7064
7305
  ** Note that this routine returns zero on a match and non-zero if the strings
7065
7306
  ** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()].
7066
7307
  */
7067
- 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);
7068
7309
 
7069
7310
  /*
7070
7311
  ** CAPI3REF: Error Logging Interface
@@ -7087,18 +7328,17 @@ SQLITE_API int sqlite3_strglob(const char *zGlob, const char *zStr);
7087
7328
  ** a few hundred characters, it will be truncated to the length of the
7088
7329
  ** buffer.
7089
7330
  */
7090
- SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);
7331
+ SQLITE_API void SQLITE_CDECL sqlite3_log(int iErrCode, const char *zFormat, ...);
7091
7332
 
7092
7333
  /*
7093
7334
  ** CAPI3REF: Write-Ahead Log Commit Hook
7335
+ ** METHOD: sqlite3
7094
7336
  **
7095
7337
  ** ^The [sqlite3_wal_hook()] function is used to register a callback that
7096
- ** will be invoked each time a database connection commits data to a
7097
- ** [write-ahead log] (i.e. whenever a transaction is committed in
7098
- ** [journal_mode | journal_mode=WAL mode]).
7338
+ ** is invoked each time data is committed to a database in wal mode.
7099
7339
  **
7100
- ** ^The callback is invoked by SQLite after the commit has taken place and
7101
- ** 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
7102
7342
  ** may read, write or [checkpoint] the database as required.
7103
7343
  **
7104
7344
  ** ^The first parameter passed to the callback function when it is invoked
@@ -7124,7 +7364,7 @@ SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);
7124
7364
  ** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will
7125
7365
  ** those overwrite any prior [sqlite3_wal_hook()] settings.
7126
7366
  */
7127
- SQLITE_API void *sqlite3_wal_hook(
7367
+ SQLITE_API void *SQLITE_STDCALL sqlite3_wal_hook(
7128
7368
  sqlite3*,
7129
7369
  int(*)(void *,sqlite3*,const char*,int),
7130
7370
  void*
@@ -7132,6 +7372,7 @@ SQLITE_API void *sqlite3_wal_hook(
7132
7372
 
7133
7373
  /*
7134
7374
  ** CAPI3REF: Configure an auto-checkpoint
7375
+ ** METHOD: sqlite3
7135
7376
  **
7136
7377
  ** ^The [sqlite3_wal_autocheckpoint(D,N)] is a wrapper around
7137
7378
  ** [sqlite3_wal_hook()] that causes any database on [database connection] D
@@ -7158,104 +7399,123 @@ SQLITE_API void *sqlite3_wal_hook(
7158
7399
  ** is only necessary if the default setting is found to be suboptimal
7159
7400
  ** for a particular application.
7160
7401
  */
7161
- SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
7402
+ SQLITE_API int SQLITE_STDCALL sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
7162
7403
 
7163
7404
  /*
7164
7405
  ** CAPI3REF: Checkpoint a database
7406
+ ** METHOD: sqlite3
7165
7407
  **
7166
- ** ^The [sqlite3_wal_checkpoint(D,X)] interface causes database named X
7167
- ** on [database connection] D to be [checkpointed]. ^If X is NULL or an
7168
- ** empty string, then a checkpoint is run on all databases of
7169
- ** connection D. ^If the database connection D is not in
7170
- ** [WAL | write-ahead log mode] then this interface is a harmless no-op.
7171
- ** ^The [sqlite3_wal_checkpoint(D,X)] interface initiates a
7172
- ** [sqlite3_wal_checkpoint_v2|PASSIVE] checkpoint.
7173
- ** Use the [sqlite3_wal_checkpoint_v2()] interface to get a FULL
7174
- ** 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).)^
7175
7410
  **
7176
- ** ^The [wal_checkpoint pragma] can be used to invoke this interface
7177
- ** from SQL. ^The [sqlite3_wal_autocheckpoint()] interface and the
7178
- ** [wal_autocheckpoint pragma] can be used to cause this interface to be
7179
- ** 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.
7180
7416
  **
7181
- ** 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()].
7182
7423
  */
7183
- 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);
7184
7425
 
7185
7426
  /*
7186
7427
  ** CAPI3REF: Checkpoint a database
7428
+ ** METHOD: sqlite3
7187
7429
  **
7188
- ** Run a checkpoint operation on WAL database zDb attached to database
7189
- ** handle db. The specific operation is determined by the value of the
7190
- ** 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]:)^
7191
7434
  **
7192
7435
  ** <dl>
7193
7436
  ** <dt>SQLITE_CHECKPOINT_PASSIVE<dd>
7194
- ** Checkpoint as many frames as possible without waiting for any database
7195
- ** readers or writers to finish. Sync the db file if all frames in the log
7196
- ** are checkpointed. This mode is the same as calling
7197
- ** sqlite3_wal_checkpoint(). The [sqlite3_busy_handler|busy-handler callback]
7198
- ** 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.
7199
7443
  **
7200
7444
  ** <dt>SQLITE_CHECKPOINT_FULL<dd>
7201
- ** This mode blocks (it invokes the
7445
+ ** ^This mode blocks (it invokes the
7202
7446
  ** [sqlite3_busy_handler|busy-handler callback]) until there is no
7203
7447
  ** database writer and all readers are reading from the most recent database
7204
- ** snapshot. It then checkpoints all frames in the log file and syncs the
7205
- ** database file. This call blocks database writers while it is running,
7206
- ** 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.
7207
7451
  **
7208
7452
  ** <dt>SQLITE_CHECKPOINT_RESTART<dd>
7209
- ** This mode works the same way as SQLITE_CHECKPOINT_FULL, except after
7210
- ** checkpointing the log file it blocks (calls the
7211
- ** [sqlite3_busy_handler|busy-handler callback])
7212
- ** until all readers are reading from the database file only. This ensures
7213
- ** that the next client to write to the database file restarts the log file
7214
- ** from the beginning. This call blocks database writers while it is running,
7215
- ** 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.
7216
7465
  ** </dl>
7217
7466
  **
7218
- ** If pnLog is not NULL, then *pnLog is set to the total number of frames in
7219
- ** the log file before returning. If pnCkpt is not NULL, then *pnCkpt is set to
7220
- ** the total number of checkpointed frames (including any that were already
7221
- ** checkpointed when this function is called). *pnLog and *pnCkpt may be
7222
- ** populated even if sqlite3_wal_checkpoint_v2() returns other than SQLITE_OK.
7223
- ** If no values are available because of an error, they are both set to -1
7224
- ** before returning to communicate this to the caller.
7225
- **
7226
- ** 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
7227
7478
  ** any other process is running a checkpoint operation at the same time, the
7228
- ** 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
7229
7480
  ** busy-handler configured, it will not be invoked in this case.
7230
7481
  **
7231
- ** The SQLITE_CHECKPOINT_FULL and RESTART modes also obtain the exclusive
7232
- ** "writer" lock on the database file. If the writer lock cannot be obtained
7233
- ** immediately, and a busy-handler is configured, it is invoked and the writer
7234
- ** lock retried until either the busy-handler returns 0 or the lock is
7235
- ** successfully obtained. The busy-handler is also invoked while waiting for
7236
- ** 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
7237
7488
  ** the writer lock is obtained or while waiting for database readers, the
7238
7489
  ** checkpoint operation proceeds from that point in the same way as
7239
7490
  ** SQLITE_CHECKPOINT_PASSIVE - checkpointing as many frames as possible
7240
- ** without blocking any further. SQLITE_BUSY is returned in this case.
7491
+ ** without blocking any further. ^SQLITE_BUSY is returned in this case.
7241
7492
  **
7242
- ** If parameter zDb is NULL or points to a zero length string, then the
7243
- ** specified operation is attempted on all WAL databases. In this case the
7244
- ** 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
7245
7497
  ** an SQLITE_BUSY error is encountered when processing one or more of the
7246
7498
  ** attached WAL databases, the operation is still attempted on any remaining
7247
- ** 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
7248
7500
  ** error occurs while processing an attached database, processing is abandoned
7249
- ** 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
7250
7502
  ** (SQLITE_BUSY or otherwise) is encountered while processing the attached
7251
7503
  ** databases, SQLITE_OK is returned.
7252
7504
  **
7253
- ** If database zDb is the name of an attached database that is not in WAL
7254
- ** 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
7255
7507
  ** zDb is not NULL (or a zero length string) and is not the name of any
7256
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.
7257
7517
  */
7258
- SQLITE_API int sqlite3_wal_checkpoint_v2(
7518
+ SQLITE_API int SQLITE_STDCALL sqlite3_wal_checkpoint_v2(
7259
7519
  sqlite3 *db, /* Database handle */
7260
7520
  const char *zDb, /* Name of attached database (or NULL) */
7261
7521
  int eMode, /* SQLITE_CHECKPOINT_* value */
@@ -7264,16 +7524,18 @@ SQLITE_API int sqlite3_wal_checkpoint_v2(
7264
7524
  );
7265
7525
 
7266
7526
  /*
7267
- ** CAPI3REF: Checkpoint operation parameters
7527
+ ** CAPI3REF: Checkpoint Mode Values
7528
+ ** KEYWORDS: {checkpoint mode}
7268
7529
  **
7269
- ** These constants can be used as the 3rd parameter to
7270
- ** [sqlite3_wal_checkpoint_v2()]. See the [sqlite3_wal_checkpoint_v2()]
7271
- ** documentation for additional information about the meaning and use of
7272
- ** 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.
7273
7534
  */
7274
- #define SQLITE_CHECKPOINT_PASSIVE 0
7275
- #define SQLITE_CHECKPOINT_FULL 1
7276
- #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 */
7277
7539
 
7278
7540
  /*
7279
7541
  ** CAPI3REF: Virtual Table Interface Configuration
@@ -7289,7 +7551,7 @@ SQLITE_API int sqlite3_wal_checkpoint_v2(
7289
7551
  ** this function. (See [SQLITE_VTAB_CONSTRAINT_SUPPORT].) Further options
7290
7552
  ** may be added in the future.
7291
7553
  */
7292
- SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);
7554
+ SQLITE_API int SQLITE_CDECL sqlite3_vtab_config(sqlite3*, int op, ...);
7293
7555
 
7294
7556
  /*
7295
7557
  ** CAPI3REF: Virtual Table Configuration Options
@@ -7342,7 +7604,7 @@ SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);
7342
7604
  ** of the SQL statement that triggered the call to the [xUpdate] method of the
7343
7605
  ** [virtual table].
7344
7606
  */
7345
- SQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *);
7607
+ SQLITE_API int SQLITE_STDCALL sqlite3_vtab_on_conflict(sqlite3 *);
7346
7608
 
7347
7609
  /*
7348
7610
  ** CAPI3REF: Conflict resolution modes
@@ -7362,6 +7624,108 @@ SQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *);
7362
7624
  /* #define SQLITE_ABORT 4 // Also an error code */
7363
7625
  #define SQLITE_REPLACE 5
7364
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*);
7365
7729
 
7366
7730
 
7367
7731
  /*
@@ -7416,7 +7780,7 @@ typedef struct sqlite3_rtree_query_info sqlite3_rtree_query_info;
7416
7780
  **
7417
7781
  ** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zGeom(... params ...)
7418
7782
  */
7419
- SQLITE_API int sqlite3_rtree_geometry_callback(
7783
+ SQLITE_API int SQLITE_STDCALL sqlite3_rtree_geometry_callback(
7420
7784
  sqlite3 *db,
7421
7785
  const char *zGeom,
7422
7786
  int (*xGeom)(sqlite3_rtree_geometry*, int, sqlite3_rtree_dbl*,int*),
@@ -7442,7 +7806,7 @@ struct sqlite3_rtree_geometry {
7442
7806
  **
7443
7807
  ** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zQueryFunc(... params ...)
7444
7808
  */
7445
- SQLITE_API int sqlite3_rtree_query_callback(
7809
+ SQLITE_API int SQLITE_STDCALL sqlite3_rtree_query_callback(
7446
7810
  sqlite3 *db,
7447
7811
  const char *zQueryFunc,
7448
7812
  int (*xQueryFunc)(sqlite3_rtree_query_info*),
@@ -7476,6 +7840,8 @@ struct sqlite3_rtree_query_info {
7476
7840
  int eParentWithin; /* Visibility of parent node */
7477
7841
  int eWithin; /* OUT: Visiblity */
7478
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 */
7479
7845
  };
7480
7846
 
7481
7847
  /*