sqlite3-static 3.14.1 → 3.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 48e59c2d0724a281924ca8f3a5baca2f553aaa16
4
- data.tar.gz: e959e145507d41bfb407f2a05ab0c69acb4a10f5
2
+ SHA256:
3
+ metadata.gz: e6b45bffa550cefbde8516407b883869bbe626ce3aebabfcc83589e3e6913cab
4
+ data.tar.gz: eddeec67011ab59032e0c3929f35afffb214e877b1663b232721d215f684fe53
5
5
  SHA512:
6
- metadata.gz: c6f16a63fabc6b392484454b661a8c29ab3b8b6fc8e999eb75bcb658acb337b30dd3a2243b85bb1f2ce0e691c50d10fa4bff1c6d7e6d75628945866901989e93
7
- data.tar.gz: e9d7076b05126bea2d68ecc45a4b1de85565c4243bb7bc393d3fd7e990af9cfac73eadee3869b573a6e3f9d9145754fe0a6fc60908ae3d8e03f758cea18358de
6
+ metadata.gz: 30efd1729862b47f0b9828fcb5dcf5a397d01ed05768889d901bdf5fdfe3b9cf24b224085af38d7ce70aa35a60d6c90e925cdfaf3aba57d043b161b505b62dc1
7
+ data.tar.gz: a3a621aefb8c69c239b1b85ad951277df1c7572efb8594f0c04a39c924e89e298604fad777804d02f4b689c990cc975b3cba5f803e7fc71e4908fb611f7ed024
@@ -1,3 +1,8 @@
1
+ === 1.3.12
2
+
3
+ * Bugfixes:
4
+ * OS X install will default to homebrew if available. Fixes #195
5
+
1
6
  === 1.3.11 / 2015-10-10
2
7
 
3
8
  * Enhancements:
@@ -10,7 +15,7 @@
10
15
  === 1.3.10 / 2014-10-30
11
16
 
12
17
  * Enhancements:
13
- * Windows: build against SQLite 3.8.6. Closes #135 [Hubro]
18
+ * Windows: build against SQLite 3.8.7.1. Closes #134, #135 [Hubro]
14
19
 
15
20
  === 1.3.9 / 2014-02-25
16
21
 
@@ -14,6 +14,7 @@ ext/sqlite3/exception.c
14
14
  ext/sqlite3/exception.h
15
15
  ext/sqlite3/extconf.rb
16
16
  ext/sqlite3/sqlite3.c
17
+ ext/sqlite3/sqlite3_core.c
17
18
  ext/sqlite3/sqlite3_ruby.h
18
19
  ext/sqlite3/statement.c
19
20
  ext/sqlite3/statement.h
@@ -37,6 +37,11 @@ amalgamation, so it doesn't have any external dependencies
37
37
  db.execute "insert into numbers values ( ?, ? )", pair
38
38
  end
39
39
 
40
+ # Find a few rows
41
+ db.execute( "select * from numbers" ) do |row|
42
+ p row
43
+ end
44
+
40
45
  # Create another table with multiple columns
41
46
 
42
47
  db.execute <<-SQL
@@ -52,8 +57,7 @@ amalgamation, so it doesn't have any external dependencies
52
57
  db.execute("INSERT INTO students (name, email, grade, blog)
53
58
  VALUES (?, ?, ?, ?)", ["Jane", "me@janedoe.com", "A", "http://blog.janedoe.com"])
54
59
 
55
- # Find a few rows
56
- db.execute( "select * from numbers" ) do |row|
60
+ db.execute( "select * from students" ) do |row|
57
61
  p row
58
62
  end
59
63
 
@@ -46,8 +46,8 @@ static VALUE initialize(int argc, VALUE *argv, VALUE self)
46
46
  VALUE file;
47
47
  VALUE opts;
48
48
  VALUE zvfs;
49
- #ifdef HAVE_SQLITE3_OPEN_V2
50
49
  VALUE flags;
50
+ #ifdef HAVE_SQLITE3_OPEN_V2
51
51
  int mode = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE;
52
52
  #endif
53
53
  int status;
@@ -20,14 +20,14 @@ have_func('rb_proc_arity')
20
20
  have_func('rb_integer_pack')
21
21
 
22
22
  # These functions may not be defined
23
- $defs.push(format("-DHAVE_%s", 'sqlite3_initialize'.tr_cpp))
24
- $defs.push(format("-DHAVE_%s", 'sqlite3_backup_init'.tr_cpp))
25
- $defs.push(format("-DHAVE_%s", 'sqlite3_column_database_name'.tr_cpp))
26
- $defs.push(format("-DHAVE_%s", 'sqlite3_enable_load_extension'.tr_cpp))
27
- $defs.push(format("-DHAVE_%s", 'sqlite3_load_extension'.tr_cpp))
28
- $defs.push(format("-DHAVE_%s", 'sqlite3_open_v2'.tr_cpp))
29
- $defs.push(format("-DHAVE_%s", 'sqlite3_prepare_v2'.tr_cpp))
30
- $defs.push(format("-DHAVE_TYPE_%s", 'sqlite3_int64'.tr_cpp))
31
- $defs.push(format("-DHAVE_TYPE_%s", 'sqlite3_uint64'.tr_cpp))
23
+ have_func('sqlite3_initialize')
24
+ have_func('sqlite3_backup_init')
25
+ have_func('sqlite3_column_database_name')
26
+ have_func('sqlite3_enable_load_extension')
27
+ have_func('sqlite3_load_extension')
28
+ have_func('sqlite3_open_v2')
29
+ have_func('sqlite3_prepare_v2')
30
+ have_type('sqlite3_int64', 'sqlite3.h')
31
+ have_type('sqlite3_uint64', 'sqlite3.h')
32
32
 
33
33
  create_makefile('sqlite3/sqlite3_native')
@@ -92,9 +92,6 @@ void init_sqlite3_constants()
92
92
  rb_define_const(mSqlite3Open, "CREATE", INT2FIX(SQLITE_OPEN_CREATE));
93
93
  rb_define_const(mSqlite3Open, "DELETEONCLOSE", INT2FIX(SQLITE_OPEN_DELETEONCLOSE));
94
94
  rb_define_const(mSqlite3Open, "EXCLUSIVE", INT2FIX(SQLITE_OPEN_EXCLUSIVE));
95
- rb_define_const(mSqlite3Open, "AUTOPROXY", INT2FIX(SQLITE_OPEN_AUTOPROXY));
96
- rb_define_const(mSqlite3Open, "URI", INT2FIX(SQLITE_OPEN_URI));
97
- rb_define_const(mSqlite3Open, "MEMORY", INT2FIX(SQLITE_OPEN_MEMORY));
98
95
  rb_define_const(mSqlite3Open, "MAIN_DB", INT2FIX(SQLITE_OPEN_MAIN_DB));
99
96
  rb_define_const(mSqlite3Open, "TEMP_DB", INT2FIX(SQLITE_OPEN_TEMP_DB));
100
97
  rb_define_const(mSqlite3Open, "TRANSIENT_DB", INT2FIX(SQLITE_OPEN_TRANSIENT_DB));
@@ -104,9 +101,21 @@ void init_sqlite3_constants()
104
101
  rb_define_const(mSqlite3Open, "MASTER_JOURNAL", INT2FIX(SQLITE_OPEN_MASTER_JOURNAL));
105
102
  rb_define_const(mSqlite3Open, "NOMUTEX", INT2FIX(SQLITE_OPEN_NOMUTEX));
106
103
  rb_define_const(mSqlite3Open, "FULLMUTEX", INT2FIX(SQLITE_OPEN_FULLMUTEX));
104
+ #ifdef SQLITE_OPEN_AUTOPROXY
105
+ /* SQLITE_VERSION_NUMBER>=3007002 */
106
+ rb_define_const(mSqlite3Open, "AUTOPROXY", INT2FIX(SQLITE_OPEN_AUTOPROXY));
107
107
  rb_define_const(mSqlite3Open, "SHAREDCACHE", INT2FIX(SQLITE_OPEN_SHAREDCACHE));
108
108
  rb_define_const(mSqlite3Open, "PRIVATECACHE", INT2FIX(SQLITE_OPEN_PRIVATECACHE));
109
109
  rb_define_const(mSqlite3Open, "WAL", INT2FIX(SQLITE_OPEN_WAL));
110
+ #endif
111
+ #ifdef SQLITE_OPEN_URI
112
+ /* SQLITE_VERSION_NUMBER>=3007007 */
113
+ rb_define_const(mSqlite3Open, "URI", INT2FIX(SQLITE_OPEN_URI));
114
+ #endif
115
+ #ifdef SQLITE_OPEN_MEMORY
116
+ /* SQLITE_VERSION_NUMBER>=3007013 */
117
+ rb_define_const(mSqlite3Open, "MEMORY", INT2FIX(SQLITE_OPEN_MEMORY));
118
+ #endif
110
119
  }
111
120
 
112
121
  void Init_sqlite3_native()
@@ -1,5 +1,5 @@
1
1
  /*
2
- ** 2001 September 15
2
+ ** 2001-09-15
3
3
  **
4
4
  ** The author disclaims copyright to this source code. In place of
5
5
  ** a legal notice, here is a blessing:
@@ -108,25 +108,28 @@ extern "C" {
108
108
  ** be held constant and Z will be incremented or else Y will be incremented
109
109
  ** and Z will be reset to zero.
110
110
  **
111
- ** Since version 3.6.18, SQLite source code has been stored in the
111
+ ** Since [version 3.6.18] ([dateof:3.6.18]),
112
+ ** SQLite source code has been stored in the
112
113
  ** <a href="http://www.fossil-scm.org/">Fossil configuration management
113
114
  ** system</a>. ^The SQLITE_SOURCE_ID macro evaluates to
114
115
  ** a string which identifies a particular check-in of SQLite
115
116
  ** within its configuration management system. ^The SQLITE_SOURCE_ID
116
- ** string contains the date and time of the check-in (UTC) and an SHA1
117
- ** hash of the entire source tree.
117
+ ** string contains the date and time of the check-in (UTC) and a SHA1
118
+ ** or SHA3-256 hash of the entire source tree. If the source code has
119
+ ** been edited in any way since it was last checked in, then the last
120
+ ** four hexadecimal digits of the hash may be modified.
118
121
  **
119
122
  ** See also: [sqlite3_libversion()],
120
123
  ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
121
124
  ** [sqlite_version()] and [sqlite_source_id()].
122
125
  */
123
- #define SQLITE_VERSION "3.14.1"
124
- #define SQLITE_VERSION_NUMBER 3014001
125
- #define SQLITE_SOURCE_ID "2016-08-11 18:53:32 a12d8059770df4bca59e321c266410344242bf7b"
126
+ #define SQLITE_VERSION "3.22.0"
127
+ #define SQLITE_VERSION_NUMBER 3022000
128
+ #define SQLITE_SOURCE_ID "2018-01-22 18:45:57 0c55d179733b46d8d0ba4d88e01a25e10677046ee3da1d5b1581e86726f2171d"
126
129
 
127
130
  /*
128
131
  ** CAPI3REF: Run-Time Library Version Numbers
129
- ** KEYWORDS: sqlite3_version, sqlite3_sourceid
132
+ ** KEYWORDS: sqlite3_version sqlite3_sourceid
130
133
  **
131
134
  ** These interfaces provide the same information as the [SQLITE_VERSION],
132
135
  ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros
@@ -138,7 +141,7 @@ extern "C" {
138
141
  **
139
142
  ** <blockquote><pre>
140
143
  ** assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER );
141
- ** assert( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)==0 );
144
+ ** assert( strncmp(sqlite3_sourceid(),SQLITE_SOURCE_ID,80)==0 );
142
145
  ** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 );
143
146
  ** </pre></blockquote>)^
144
147
  **
@@ -148,16 +151,18 @@ extern "C" {
148
151
  ** function is provided for use in DLLs since DLL users usually do not have
149
152
  ** direct access to string constants within the DLL. ^The
150
153
  ** sqlite3_libversion_number() function returns an integer equal to
151
- ** [SQLITE_VERSION_NUMBER]. ^The sqlite3_sourceid() function returns
154
+ ** [SQLITE_VERSION_NUMBER]. ^(The sqlite3_sourceid() function returns
152
155
  ** a pointer to a string constant whose value is the same as the
153
- ** [SQLITE_SOURCE_ID] C preprocessor macro.
156
+ ** [SQLITE_SOURCE_ID] C preprocessor macro. Except if SQLite is built
157
+ ** using an edited copy of [the amalgamation], then the last four characters
158
+ ** of the hash might be different from [SQLITE_SOURCE_ID].)^
154
159
  **
155
160
  ** See also: [sqlite_version()] and [sqlite_source_id()].
156
161
  */
157
162
  SQLITE_API SQLITE_EXTERN const char sqlite3_version[];
158
- SQLITE_API const char *SQLITE_STDCALL sqlite3_libversion(void);
159
- SQLITE_API const char *SQLITE_STDCALL sqlite3_sourceid(void);
160
- SQLITE_API int SQLITE_STDCALL sqlite3_libversion_number(void);
163
+ SQLITE_API const char *sqlite3_libversion(void);
164
+ SQLITE_API const char *sqlite3_sourceid(void);
165
+ SQLITE_API int sqlite3_libversion_number(void);
161
166
 
162
167
  /*
163
168
  ** CAPI3REF: Run-Time Library Compilation Options Diagnostics
@@ -182,8 +187,8 @@ SQLITE_API int SQLITE_STDCALL sqlite3_libversion_number(void);
182
187
  ** [sqlite_compileoption_get()] and the [compile_options pragma].
183
188
  */
184
189
  #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
185
- SQLITE_API int SQLITE_STDCALL sqlite3_compileoption_used(const char *zOptName);
186
- SQLITE_API const char *SQLITE_STDCALL sqlite3_compileoption_get(int N);
190
+ SQLITE_API int sqlite3_compileoption_used(const char *zOptName);
191
+ SQLITE_API const char *sqlite3_compileoption_get(int N);
187
192
  #endif
188
193
 
189
194
  /*
@@ -222,7 +227,7 @@ SQLITE_API const char *SQLITE_STDCALL sqlite3_compileoption_get(int N);
222
227
  **
223
228
  ** See the [threading mode] documentation for additional information.
224
229
  */
225
- SQLITE_API int SQLITE_STDCALL sqlite3_threadsafe(void);
230
+ SQLITE_API int sqlite3_threadsafe(void);
226
231
 
227
232
  /*
228
233
  ** CAPI3REF: Database Connection Handle
@@ -258,7 +263,11 @@ typedef struct sqlite3 sqlite3;
258
263
  */
259
264
  #ifdef SQLITE_INT64_TYPE
260
265
  typedef SQLITE_INT64_TYPE sqlite_int64;
261
- typedef unsigned SQLITE_INT64_TYPE sqlite_uint64;
266
+ # ifdef SQLITE_UINT64_TYPE
267
+ typedef SQLITE_UINT64_TYPE sqlite_uint64;
268
+ # else
269
+ typedef unsigned SQLITE_INT64_TYPE sqlite_uint64;
270
+ # endif
262
271
  #elif defined(_MSC_VER) || defined(__BORLANDC__)
263
272
  typedef __int64 sqlite_int64;
264
273
  typedef unsigned __int64 sqlite_uint64;
@@ -319,8 +328,8 @@ typedef sqlite_uint64 sqlite3_uint64;
319
328
  ** ^Calling sqlite3_close() or sqlite3_close_v2() with a NULL pointer
320
329
  ** argument is a harmless no-op.
321
330
  */
322
- SQLITE_API int SQLITE_STDCALL sqlite3_close(sqlite3*);
323
- SQLITE_API int SQLITE_STDCALL sqlite3_close_v2(sqlite3*);
331
+ SQLITE_API int sqlite3_close(sqlite3*);
332
+ SQLITE_API int sqlite3_close_v2(sqlite3*);
324
333
 
325
334
  /*
326
335
  ** The type for a callback function.
@@ -391,7 +400,7 @@ typedef int (*sqlite3_callback)(void*,int,char**, char**);
391
400
  ** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running.
392
401
  ** </ul>
393
402
  */
394
- SQLITE_API int SQLITE_STDCALL sqlite3_exec(
403
+ SQLITE_API int sqlite3_exec(
395
404
  sqlite3*, /* An open database */
396
405
  const char *sql, /* SQL to be evaluated */
397
406
  int (*callback)(void*,int,char**,char**), /* Callback function */
@@ -412,7 +421,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_exec(
412
421
  */
413
422
  #define SQLITE_OK 0 /* Successful result */
414
423
  /* beginning-of-error-codes */
415
- #define SQLITE_ERROR 1 /* SQL error or missing database */
424
+ #define SQLITE_ERROR 1 /* Generic error */
416
425
  #define SQLITE_INTERNAL 2 /* Internal logic error in SQLite */
417
426
  #define SQLITE_PERM 3 /* Access permission denied */
418
427
  #define SQLITE_ABORT 4 /* Callback routine requested an abort */
@@ -427,7 +436,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_exec(
427
436
  #define SQLITE_FULL 13 /* Insertion failed because database is full */
428
437
  #define SQLITE_CANTOPEN 14 /* Unable to open the database file */
429
438
  #define SQLITE_PROTOCOL 15 /* Database lock protocol error */
430
- #define SQLITE_EMPTY 16 /* Database is empty */
439
+ #define SQLITE_EMPTY 16 /* Internal use only */
431
440
  #define SQLITE_SCHEMA 17 /* The database schema changed */
432
441
  #define SQLITE_TOOBIG 18 /* String or BLOB exceeds size limit */
433
442
  #define SQLITE_CONSTRAINT 19 /* Abort due to constraint violation */
@@ -435,7 +444,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_exec(
435
444
  #define SQLITE_MISUSE 21 /* Library used incorrectly */
436
445
  #define SQLITE_NOLFS 22 /* Uses OS features not supported on host */
437
446
  #define SQLITE_AUTH 23 /* Authorization denied */
438
- #define SQLITE_FORMAT 24 /* Auxiliary database format error */
447
+ #define SQLITE_FORMAT 24 /* Not used */
439
448
  #define SQLITE_RANGE 25 /* 2nd parameter to sqlite3_bind out of range */
440
449
  #define SQLITE_NOTADB 26 /* File opened that is not a database file */
441
450
  #define SQLITE_NOTICE 27 /* Notifications from sqlite3_log() */
@@ -452,7 +461,8 @@ SQLITE_API int SQLITE_STDCALL sqlite3_exec(
452
461
  ** [result codes]. However, experience has shown that many of
453
462
  ** these result codes are too coarse-grained. They do not provide as
454
463
  ** much information about problems as programmers might like. In an effort to
455
- ** address this, newer versions of SQLite (version 3.3.8 and later) include
464
+ ** address this, newer versions of SQLite (version 3.3.8 [dateof:3.3.8]
465
+ ** and later) include
456
466
  ** support for additional result codes that provide more detailed information
457
467
  ** about errors. These [extended result codes] are enabled or disabled
458
468
  ** on a per database connection basis using the
@@ -460,6 +470,8 @@ SQLITE_API int SQLITE_STDCALL sqlite3_exec(
460
470
  ** the most recent error can be obtained using
461
471
  ** [sqlite3_extended_errcode()].
462
472
  */
473
+ #define SQLITE_ERROR_MISSING_COLLSEQ (SQLITE_ERROR | (1<<8))
474
+ #define SQLITE_ERROR_RETRY (SQLITE_ERROR | (2<<8))
463
475
  #define SQLITE_IOERR_READ (SQLITE_IOERR | (1<<8))
464
476
  #define SQLITE_IOERR_SHORT_READ (SQLITE_IOERR | (2<<8))
465
477
  #define SQLITE_IOERR_WRITE (SQLITE_IOERR | (3<<8))
@@ -488,6 +500,9 @@ SQLITE_API int SQLITE_STDCALL sqlite3_exec(
488
500
  #define SQLITE_IOERR_CONVPATH (SQLITE_IOERR | (26<<8))
489
501
  #define SQLITE_IOERR_VNODE (SQLITE_IOERR | (27<<8))
490
502
  #define SQLITE_IOERR_AUTH (SQLITE_IOERR | (28<<8))
503
+ #define SQLITE_IOERR_BEGIN_ATOMIC (SQLITE_IOERR | (29<<8))
504
+ #define SQLITE_IOERR_COMMIT_ATOMIC (SQLITE_IOERR | (30<<8))
505
+ #define SQLITE_IOERR_ROLLBACK_ATOMIC (SQLITE_IOERR | (31<<8))
491
506
  #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8))
492
507
  #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8))
493
508
  #define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2<<8))
@@ -500,6 +515,8 @@ SQLITE_API int SQLITE_STDCALL sqlite3_exec(
500
515
  #define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8))
501
516
  #define SQLITE_READONLY_ROLLBACK (SQLITE_READONLY | (3<<8))
502
517
  #define SQLITE_READONLY_DBMOVED (SQLITE_READONLY | (4<<8))
518
+ #define SQLITE_READONLY_CANTINIT (SQLITE_READONLY | (5<<8))
519
+ #define SQLITE_READONLY_DIRECTORY (SQLITE_READONLY | (6<<8))
503
520
  #define SQLITE_ABORT_ROLLBACK (SQLITE_ABORT | (2<<8))
504
521
  #define SQLITE_CONSTRAINT_CHECK (SQLITE_CONSTRAINT | (1<<8))
505
522
  #define SQLITE_CONSTRAINT_COMMITHOOK (SQLITE_CONSTRAINT | (2<<8))
@@ -570,10 +587,15 @@ SQLITE_API int SQLITE_STDCALL sqlite3_exec(
570
587
  ** file that were written at the application level might have changed
571
588
  ** and that adjacent bytes, even bytes within the same sector are
572
589
  ** guaranteed to be unchanged. The SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN
573
- ** flag indicate that a file cannot be deleted when open. The
590
+ ** flag indicates that a file cannot be deleted when open. The
574
591
  ** SQLITE_IOCAP_IMMUTABLE flag indicates that the file is on
575
592
  ** read-only media and cannot be changed even by processes with
576
593
  ** elevated privileges.
594
+ **
595
+ ** The SQLITE_IOCAP_BATCH_ATOMIC property means that the underlying
596
+ ** filesystem supports doing multiple write operations atomically when those
597
+ ** write operations are bracketed by [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] and
598
+ ** [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE].
577
599
  */
578
600
  #define SQLITE_IOCAP_ATOMIC 0x00000001
579
601
  #define SQLITE_IOCAP_ATOMIC512 0x00000002
@@ -589,6 +611,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_exec(
589
611
  #define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 0x00000800
590
612
  #define SQLITE_IOCAP_POWERSAFE_OVERWRITE 0x00001000
591
613
  #define SQLITE_IOCAP_IMMUTABLE 0x00002000
614
+ #define SQLITE_IOCAP_BATCH_ATOMIC 0x00004000
592
615
 
593
616
  /*
594
617
  ** CAPI3REF: File Locking Levels
@@ -720,6 +743,10 @@ struct sqlite3_file {
720
743
  ** <li> [SQLITE_IOCAP_ATOMIC64K]
721
744
  ** <li> [SQLITE_IOCAP_SAFE_APPEND]
722
745
  ** <li> [SQLITE_IOCAP_SEQUENTIAL]
746
+ ** <li> [SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN]
747
+ ** <li> [SQLITE_IOCAP_POWERSAFE_OVERWRITE]
748
+ ** <li> [SQLITE_IOCAP_IMMUTABLE]
749
+ ** <li> [SQLITE_IOCAP_BATCH_ATOMIC]
723
750
  ** </ul>
724
751
  **
725
752
  ** The SQLITE_IOCAP_ATOMIC property means that all writes of
@@ -848,7 +875,7 @@ struct sqlite3_io_methods {
848
875
  ** opcode allows these two values (10 retries and 25 milliseconds of delay)
849
876
  ** to be adjusted. The values are changed for all database connections
850
877
  ** within the same process. The argument is a pointer to an array of two
851
- ** integers where the first integer i the new retry count and the second
878
+ ** integers where the first integer is the new retry count and the second
852
879
  ** integer is the delay. If either integer is negative, then the setting
853
880
  ** is not changed but instead the prior value of that setting is written
854
881
  ** into the array entry, allowing the current retry settings to be
@@ -976,6 +1003,12 @@ struct sqlite3_io_methods {
976
1003
  ** on whether or not the file has been renamed, moved, or deleted since it
977
1004
  ** was first opened.
978
1005
  **
1006
+ ** <li>[[SQLITE_FCNTL_WIN32_GET_HANDLE]]
1007
+ ** The [SQLITE_FCNTL_WIN32_GET_HANDLE] opcode can be used to obtain the
1008
+ ** underlying native file handle associated with a file handle. This file
1009
+ ** control interprets its argument as a pointer to a native file handle and
1010
+ ** writes the resulting value there.
1011
+ **
979
1012
  ** <li>[[SQLITE_FCNTL_WIN32_SET_HANDLE]]
980
1013
  ** The [SQLITE_FCNTL_WIN32_SET_HANDLE] opcode is used for debugging. This
981
1014
  ** opcode causes the xFileControl method to swap the file handle with the one
@@ -997,6 +1030,40 @@ struct sqlite3_io_methods {
997
1030
  ** The [SQLITE_FCNTL_RBU] opcode is implemented by the special VFS used by
998
1031
  ** the RBU extension only. All other VFS should return SQLITE_NOTFOUND for
999
1032
  ** this opcode.
1033
+ **
1034
+ ** <li>[[SQLITE_FCNTL_BEGIN_ATOMIC_WRITE]]
1035
+ ** If the [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] opcode returns SQLITE_OK, then
1036
+ ** the file descriptor is placed in "batch write mode", which
1037
+ ** means all subsequent write operations will be deferred and done
1038
+ ** atomically at the next [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]. Systems
1039
+ ** that do not support batch atomic writes will return SQLITE_NOTFOUND.
1040
+ ** ^Following a successful SQLITE_FCNTL_BEGIN_ATOMIC_WRITE and prior to
1041
+ ** the closing [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] or
1042
+ ** [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE], SQLite will make
1043
+ ** no VFS interface calls on the same [sqlite3_file] file descriptor
1044
+ ** except for calls to the xWrite method and the xFileControl method
1045
+ ** with [SQLITE_FCNTL_SIZE_HINT].
1046
+ **
1047
+ ** <li>[[SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]]
1048
+ ** The [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] opcode causes all write
1049
+ ** operations since the previous successful call to
1050
+ ** [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be performed atomically.
1051
+ ** This file control returns [SQLITE_OK] if and only if the writes were
1052
+ ** all performed successfully and have been committed to persistent storage.
1053
+ ** ^Regardless of whether or not it is successful, this file control takes
1054
+ ** the file descriptor out of batch write mode so that all subsequent
1055
+ ** write operations are independent.
1056
+ ** ^SQLite will never invoke SQLITE_FCNTL_COMMIT_ATOMIC_WRITE without
1057
+ ** a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE].
1058
+ **
1059
+ ** <li>[[SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE]]
1060
+ ** The [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE] opcode causes all write
1061
+ ** operations since the previous successful call to
1062
+ ** [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be rolled back.
1063
+ ** ^This file control takes the file descriptor out of batch write mode
1064
+ ** so that all subsequent write operations are independent.
1065
+ ** ^SQLite will never invoke SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE without
1066
+ ** a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE].
1000
1067
  ** </ul>
1001
1068
  */
1002
1069
  #define SQLITE_FCNTL_LOCKSTATE 1
@@ -1026,6 +1093,11 @@ struct sqlite3_io_methods {
1026
1093
  #define SQLITE_FCNTL_RBU 26
1027
1094
  #define SQLITE_FCNTL_VFS_POINTER 27
1028
1095
  #define SQLITE_FCNTL_JOURNAL_POINTER 28
1096
+ #define SQLITE_FCNTL_WIN32_GET_HANDLE 29
1097
+ #define SQLITE_FCNTL_PDB 30
1098
+ #define SQLITE_FCNTL_BEGIN_ATOMIC_WRITE 31
1099
+ #define SQLITE_FCNTL_COMMIT_ATOMIC_WRITE 32
1100
+ #define SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE 33
1029
1101
 
1030
1102
  /* deprecated names */
1031
1103
  #define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
@@ -1063,12 +1135,18 @@ typedef struct sqlite3_api_routines sqlite3_api_routines;
1063
1135
  ** in the name of the object stands for "virtual file system". See
1064
1136
  ** the [VFS | VFS documentation] for further information.
1065
1137
  **
1066
- ** The value of the iVersion field is initially 1 but may be larger in
1067
- ** future versions of SQLite. Additional fields may be appended to this
1068
- ** object when the iVersion value is increased. Note that the structure
1069
- ** of the sqlite3_vfs object changes in the transaction between
1070
- ** SQLite version 3.5.9 and 3.6.0 and yet the iVersion field was not
1071
- ** modified.
1138
+ ** The VFS interface is sometimes extended by adding new methods onto
1139
+ ** the end. Each time such an extension occurs, the iVersion field
1140
+ ** is incremented. The iVersion value started out as 1 in
1141
+ ** SQLite [version 3.5.0] on [dateof:3.5.0], then increased to 2
1142
+ ** with SQLite [version 3.7.0] on [dateof:3.7.0], and then increased
1143
+ ** to 3 with SQLite [version 3.7.6] on [dateof:3.7.6]. Additional fields
1144
+ ** may be appended to the sqlite3_vfs object and the iVersion value
1145
+ ** may increase again in future versions of SQLite.
1146
+ ** Note that the structure
1147
+ ** of the sqlite3_vfs object changes in the transition from
1148
+ ** SQLite [version 3.5.9] to [version 3.6.0] on [dateof:3.6.0]
1149
+ ** and yet the iVersion field was not modified.
1072
1150
  **
1073
1151
  ** The szOsFile field is the size of the subclassed [sqlite3_file]
1074
1152
  ** structure used by this VFS. mxPathname is the maximum length of
@@ -1390,10 +1468,10 @@ struct sqlite3_vfs {
1390
1468
  ** must return [SQLITE_OK] on success and some other [error code] upon
1391
1469
  ** failure.
1392
1470
  */
1393
- SQLITE_API int SQLITE_STDCALL sqlite3_initialize(void);
1394
- SQLITE_API int SQLITE_STDCALL sqlite3_shutdown(void);
1395
- SQLITE_API int SQLITE_STDCALL sqlite3_os_init(void);
1396
- SQLITE_API int SQLITE_STDCALL sqlite3_os_end(void);
1471
+ SQLITE_API int sqlite3_initialize(void);
1472
+ SQLITE_API int sqlite3_shutdown(void);
1473
+ SQLITE_API int sqlite3_os_init(void);
1474
+ SQLITE_API int sqlite3_os_end(void);
1397
1475
 
1398
1476
  /*
1399
1477
  ** CAPI3REF: Configuring The SQLite Library
@@ -1426,7 +1504,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_os_end(void);
1426
1504
  ** ^If the option is unknown or SQLite is unable to set the option
1427
1505
  ** then this routine returns a non-zero [error code].
1428
1506
  */
1429
- SQLITE_API int SQLITE_CDECL sqlite3_config(int, ...);
1507
+ SQLITE_API int sqlite3_config(int, ...);
1430
1508
 
1431
1509
  /*
1432
1510
  ** CAPI3REF: Configure database connections
@@ -1445,7 +1523,7 @@ SQLITE_API int SQLITE_CDECL sqlite3_config(int, ...);
1445
1523
  ** ^Calls to sqlite3_db_config() return SQLITE_OK if and only if
1446
1524
  ** the call is considered successful.
1447
1525
  */
1448
- SQLITE_API int SQLITE_CDECL sqlite3_db_config(sqlite3*, int op, ...);
1526
+ SQLITE_API int sqlite3_db_config(sqlite3*, int op, ...);
1449
1527
 
1450
1528
  /*
1451
1529
  ** CAPI3REF: Memory Allocation Routines
@@ -1596,6 +1674,16 @@ struct sqlite3_mem_methods {
1596
1674
  ** routines with a wrapper that simulations memory allocation failure or
1597
1675
  ** tracks memory usage, for example. </dd>
1598
1676
  **
1677
+ ** [[SQLITE_CONFIG_SMALL_MALLOC]] <dt>SQLITE_CONFIG_SMALL_MALLOC</dt>
1678
+ ** <dd> ^The SQLITE_CONFIG_SMALL_MALLOC option takes single argument of
1679
+ ** type int, interpreted as a boolean, which if true provides a hint to
1680
+ ** SQLite that it should avoid large memory allocations if possible.
1681
+ ** SQLite will run faster if it is free to make large memory allocations,
1682
+ ** but some application might prefer to run slower in exchange for
1683
+ ** guarantees about memory fragmentation that are possible if large
1684
+ ** allocations are avoided. This hint is normally off.
1685
+ ** </dd>
1686
+ **
1599
1687
  ** [[SQLITE_CONFIG_MEMSTATUS]] <dt>SQLITE_CONFIG_MEMSTATUS</dt>
1600
1688
  ** <dd> ^The SQLITE_CONFIG_MEMSTATUS option takes single argument of type int,
1601
1689
  ** interpreted as a boolean, which enables or disables the collection of
@@ -1613,25 +1701,7 @@ struct sqlite3_mem_methods {
1613
1701
  ** </dd>
1614
1702
  **
1615
1703
  ** [[SQLITE_CONFIG_SCRATCH]] <dt>SQLITE_CONFIG_SCRATCH</dt>
1616
- ** <dd> ^The SQLITE_CONFIG_SCRATCH option specifies a static memory buffer
1617
- ** that SQLite can use for scratch memory. ^(There are three arguments
1618
- ** to SQLITE_CONFIG_SCRATCH: A pointer an 8-byte
1619
- ** aligned memory buffer from which the scratch allocations will be
1620
- ** drawn, the size of each scratch allocation (sz),
1621
- ** and the maximum number of scratch allocations (N).)^
1622
- ** The first argument must be a pointer to an 8-byte aligned buffer
1623
- ** of at least sz*N bytes of memory.
1624
- ** ^SQLite will not use more than one scratch buffers per thread.
1625
- ** ^SQLite will never request a scratch buffer that is more than 6
1626
- ** times the database page size.
1627
- ** ^If SQLite needs needs additional
1628
- ** scratch memory beyond what is provided by this configuration option, then
1629
- ** [sqlite3_malloc()] will be used to obtain the memory needed.<p>
1630
- ** ^When the application provides any amount of scratch memory using
1631
- ** SQLITE_CONFIG_SCRATCH, SQLite avoids unnecessary large
1632
- ** [sqlite3_malloc|heap allocations].
1633
- ** This can help [Robson proof|prevent memory allocation failures] due to heap
1634
- ** fragmentation in low-memory embedded systems.
1704
+ ** <dd> The SQLITE_CONFIG_SCRATCH option is no longer used.
1635
1705
  ** </dd>
1636
1706
  **
1637
1707
  ** [[SQLITE_CONFIG_PAGECACHE]] <dt>SQLITE_CONFIG_PAGECACHE</dt>
@@ -1667,8 +1737,7 @@ struct sqlite3_mem_methods {
1667
1737
  ** [[SQLITE_CONFIG_HEAP]] <dt>SQLITE_CONFIG_HEAP</dt>
1668
1738
  ** <dd> ^The SQLITE_CONFIG_HEAP option specifies a static memory buffer
1669
1739
  ** that SQLite will use for all of its dynamic memory allocation needs
1670
- ** beyond those provided for by [SQLITE_CONFIG_SCRATCH] and
1671
- ** [SQLITE_CONFIG_PAGECACHE].
1740
+ ** beyond those provided for by [SQLITE_CONFIG_PAGECACHE].
1672
1741
  ** ^The SQLITE_CONFIG_HEAP option is only available if SQLite is compiled
1673
1742
  ** with either [SQLITE_ENABLE_MEMSYS3] or [SQLITE_ENABLE_MEMSYS5] and returns
1674
1743
  ** [SQLITE_ERROR] if invoked otherwise.
@@ -1861,7 +1930,7 @@ struct sqlite3_mem_methods {
1861
1930
  #define SQLITE_CONFIG_SERIALIZED 3 /* nil */
1862
1931
  #define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */
1863
1932
  #define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */
1864
- #define SQLITE_CONFIG_SCRATCH 6 /* void*, int sz, int N */
1933
+ #define SQLITE_CONFIG_SCRATCH 6 /* No longer used */
1865
1934
  #define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */
1866
1935
  #define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */
1867
1936
  #define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */
@@ -1882,6 +1951,7 @@ struct sqlite3_mem_methods {
1882
1951
  #define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */
1883
1952
  #define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */
1884
1953
  #define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */
1954
+ #define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */
1885
1955
 
1886
1956
  /*
1887
1957
  ** CAPI3REF: Database Connection Configuration Options
@@ -1969,14 +2039,58 @@ struct sqlite3_mem_methods {
1969
2039
  ** be a NULL pointer, in which case the new setting is not reported back.
1970
2040
  ** </dd>
1971
2041
  **
2042
+ ** <dt>SQLITE_DBCONFIG_MAINDBNAME</dt>
2043
+ ** <dd> ^This option is used to change the name of the "main" database
2044
+ ** schema. ^The sole argument is a pointer to a constant UTF8 string
2045
+ ** which will become the new schema name in place of "main". ^SQLite
2046
+ ** does not make a copy of the new main schema name string, so the application
2047
+ ** must ensure that the argument passed into this DBCONFIG option is unchanged
2048
+ ** until after the database connection closes.
2049
+ ** </dd>
2050
+ **
2051
+ ** <dt>SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE</dt>
2052
+ ** <dd> Usually, when a database in wal mode is closed or detached from a
2053
+ ** database handle, SQLite checks if this will mean that there are now no
2054
+ ** connections at all to the database. If so, it performs a checkpoint
2055
+ ** operation before closing the connection. This option may be used to
2056
+ ** override this behaviour. The first parameter passed to this operation
2057
+ ** is an integer - non-zero to disable checkpoints-on-close, or zero (the
2058
+ ** default) to enable them. The second parameter is a pointer to an integer
2059
+ ** into which is written 0 or 1 to indicate whether checkpoints-on-close
2060
+ ** have been disabled - 0 if they are not disabled, 1 if they are.
2061
+ ** </dd>
2062
+ ** <dt>SQLITE_DBCONFIG_ENABLE_QPSG</dt>
2063
+ ** <dd>^(The SQLITE_DBCONFIG_ENABLE_QPSG option activates or deactivates
2064
+ ** the [query planner stability guarantee] (QPSG). When the QPSG is active,
2065
+ ** a single SQL query statement will always use the same algorithm regardless
2066
+ ** of values of [bound parameters].)^ The QPSG disables some query optimizations
2067
+ ** that look at the values of bound parameters, which can make some queries
2068
+ ** slower. But the QPSG has the advantage of more predictable behavior. With
2069
+ ** the QPSG active, SQLite will always use the same query plan in the field as
2070
+ ** was used during testing in the lab.
2071
+ ** </dd>
2072
+ ** <dt>SQLITE_DBCONFIG_TRIGGER_EQP</dt>
2073
+ ** <dd> By default, the output of EXPLAIN QUERY PLAN commands does not
2074
+ ** include output for any operations performed by trigger programs. This
2075
+ ** option is used to set or clear (the default) a flag that governs this
2076
+ ** behavior. The first parameter passed to this operation is an integer -
2077
+ ** non-zero to enable output for trigger programs, or zero to disable it.
2078
+ ** The second parameter is a pointer to an integer into which is written
2079
+ ** 0 or 1 to indicate whether output-for-triggers has been disabled - 0 if
2080
+ ** it is not disabled, 1 if it is.
2081
+ ** </dd>
1972
2082
  ** </dl>
1973
2083
  */
2084
+ #define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
1974
2085
  #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */
1975
2086
  #define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */
1976
2087
  #define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */
1977
2088
  #define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 /* int int* */
1978
2089
  #define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005 /* int int* */
1979
-
2090
+ #define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE 1006 /* int int* */
2091
+ #define SQLITE_DBCONFIG_ENABLE_QPSG 1007 /* int int* */
2092
+ #define SQLITE_DBCONFIG_TRIGGER_EQP 1008 /* int int* */
2093
+ #define SQLITE_DBCONFIG_MAX 1008 /* Largest DBCONFIG */
1980
2094
 
1981
2095
  /*
1982
2096
  ** CAPI3REF: Enable Or Disable Extended Result Codes
@@ -1986,7 +2100,7 @@ struct sqlite3_mem_methods {
1986
2100
  ** [extended result codes] feature of SQLite. ^The extended result
1987
2101
  ** codes are disabled by default for historical compatibility.
1988
2102
  */
1989
- SQLITE_API int SQLITE_STDCALL sqlite3_extended_result_codes(sqlite3*, int onoff);
2103
+ SQLITE_API int sqlite3_extended_result_codes(sqlite3*, int onoff);
1990
2104
 
1991
2105
  /*
1992
2106
  ** CAPI3REF: Last Insert Rowid
@@ -2000,20 +2114,30 @@ SQLITE_API int SQLITE_STDCALL sqlite3_extended_result_codes(sqlite3*, int onoff)
2000
2114
  ** the table has a column of type [INTEGER PRIMARY KEY] then that column
2001
2115
  ** is another alias for the rowid.
2002
2116
  **
2003
- ** ^The sqlite3_last_insert_rowid(D) interface returns the [rowid] of the
2004
- ** most recent successful [INSERT] into a rowid table or [virtual table]
2005
- ** on database connection D.
2006
- ** ^Inserts into [WITHOUT ROWID] tables are not recorded.
2007
- ** ^If no successful [INSERT]s into rowid tables
2008
- ** have ever occurred on the database connection D,
2009
- ** then sqlite3_last_insert_rowid(D) returns zero.
2010
- **
2011
- ** ^(If an [INSERT] occurs within a trigger or within a [virtual table]
2012
- ** method, then this routine will return the [rowid] of the inserted
2013
- ** row as long as the trigger or virtual table method is running.
2014
- ** But once the trigger or virtual table method ends, the value returned
2015
- ** by this routine reverts to what it was before the trigger or virtual
2016
- ** table method began.)^
2117
+ ** ^The sqlite3_last_insert_rowid(D) interface usually returns the [rowid] of
2118
+ ** the most recent successful [INSERT] into a rowid table or [virtual table]
2119
+ ** on database connection D. ^Inserts into [WITHOUT ROWID] tables are not
2120
+ ** recorded. ^If no successful [INSERT]s into rowid tables have ever occurred
2121
+ ** on the database connection D, then sqlite3_last_insert_rowid(D) returns
2122
+ ** zero.
2123
+ **
2124
+ ** As well as being set automatically as rows are inserted into database
2125
+ ** tables, the value returned by this function may be set explicitly by
2126
+ ** [sqlite3_set_last_insert_rowid()]
2127
+ **
2128
+ ** Some virtual table implementations may INSERT rows into rowid tables as
2129
+ ** part of committing a transaction (e.g. to flush data accumulated in memory
2130
+ ** to disk). In this case subsequent calls to this function return the rowid
2131
+ ** associated with these internal INSERT operations, which leads to
2132
+ ** unintuitive results. Virtual table implementations that do write to rowid
2133
+ ** tables in this way can avoid this problem by restoring the original
2134
+ ** rowid value using [sqlite3_set_last_insert_rowid()] before returning
2135
+ ** control to the user.
2136
+ **
2137
+ ** ^(If an [INSERT] occurs within a trigger then this routine will
2138
+ ** return the [rowid] of the inserted row as long as the trigger is
2139
+ ** running. Once the trigger program ends, the value returned
2140
+ ** by this routine reverts to what it was before the trigger was fired.)^
2017
2141
  **
2018
2142
  ** ^An [INSERT] that fails due to a constraint violation is not a
2019
2143
  ** successful [INSERT] and does not change the value returned by this
@@ -2038,7 +2162,17 @@ SQLITE_API int SQLITE_STDCALL sqlite3_extended_result_codes(sqlite3*, int onoff)
2038
2162
  ** unpredictable and might not equal either the old or the new
2039
2163
  ** last insert [rowid].
2040
2164
  */
2041
- SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_last_insert_rowid(sqlite3*);
2165
+ SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);
2166
+
2167
+ /*
2168
+ ** CAPI3REF: Set the Last Insert Rowid value.
2169
+ ** METHOD: sqlite3
2170
+ **
2171
+ ** The sqlite3_set_last_insert_rowid(D, R) method allows the application to
2172
+ ** set the value returned by calling sqlite3_last_insert_rowid(D) to R
2173
+ ** without inserting a row into the database.
2174
+ */
2175
+ SQLITE_API void sqlite3_set_last_insert_rowid(sqlite3*,sqlite3_int64);
2042
2176
 
2043
2177
  /*
2044
2178
  ** CAPI3REF: Count The Number Of Rows Modified
@@ -2091,7 +2225,7 @@ SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_last_insert_rowid(sqlite3*);
2091
2225
  ** while [sqlite3_changes()] is running then the value returned
2092
2226
  ** is unpredictable and not meaningful.
2093
2227
  */
2094
- SQLITE_API int SQLITE_STDCALL sqlite3_changes(sqlite3*);
2228
+ SQLITE_API int sqlite3_changes(sqlite3*);
2095
2229
 
2096
2230
  /*
2097
2231
  ** CAPI3REF: Total Number Of Rows Modified
@@ -2115,7 +2249,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_changes(sqlite3*);
2115
2249
  ** while [sqlite3_total_changes()] is running then the value
2116
2250
  ** returned is unpredictable and not meaningful.
2117
2251
  */
2118
- SQLITE_API int SQLITE_STDCALL sqlite3_total_changes(sqlite3*);
2252
+ SQLITE_API int sqlite3_total_changes(sqlite3*);
2119
2253
 
2120
2254
  /*
2121
2255
  ** CAPI3REF: Interrupt A Long-Running Query
@@ -2151,11 +2285,8 @@ SQLITE_API int SQLITE_STDCALL sqlite3_total_changes(sqlite3*);
2151
2285
  ** ^A call to sqlite3_interrupt(D) that occurs when there are no running
2152
2286
  ** SQL statements is a no-op and has no effect on SQL statements
2153
2287
  ** that are started after the sqlite3_interrupt() call returns.
2154
- **
2155
- ** If the database connection closes while [sqlite3_interrupt()]
2156
- ** is running then bad things will likely happen.
2157
2288
  */
2158
- SQLITE_API void SQLITE_STDCALL sqlite3_interrupt(sqlite3*);
2289
+ SQLITE_API void sqlite3_interrupt(sqlite3*);
2159
2290
 
2160
2291
  /*
2161
2292
  ** CAPI3REF: Determine If An SQL Statement Is Complete
@@ -2190,8 +2321,8 @@ SQLITE_API void SQLITE_STDCALL sqlite3_interrupt(sqlite3*);
2190
2321
  ** The input to [sqlite3_complete16()] must be a zero-terminated
2191
2322
  ** UTF-16 string in native byte order.
2192
2323
  */
2193
- SQLITE_API int SQLITE_STDCALL sqlite3_complete(const char *sql);
2194
- SQLITE_API int SQLITE_STDCALL sqlite3_complete16(const void *sql);
2324
+ SQLITE_API int sqlite3_complete(const char *sql);
2325
+ SQLITE_API int sqlite3_complete16(const void *sql);
2195
2326
 
2196
2327
  /*
2197
2328
  ** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors
@@ -2252,7 +2383,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_complete16(const void *sql);
2252
2383
  ** A busy handler must not close the database connection
2253
2384
  ** or [prepared statement] that invoked the busy handler.
2254
2385
  */
2255
- SQLITE_API int SQLITE_STDCALL sqlite3_busy_handler(sqlite3*,int(*)(void*,int),void*);
2386
+ SQLITE_API int sqlite3_busy_handler(sqlite3*,int(*)(void*,int),void*);
2256
2387
 
2257
2388
  /*
2258
2389
  ** CAPI3REF: Set A Busy Timeout
@@ -2275,7 +2406,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_busy_handler(sqlite3*,int(*)(void*,int),vo
2275
2406
  **
2276
2407
  ** See also: [PRAGMA busy_timeout]
2277
2408
  */
2278
- SQLITE_API int SQLITE_STDCALL sqlite3_busy_timeout(sqlite3*, int ms);
2409
+ SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms);
2279
2410
 
2280
2411
  /*
2281
2412
  ** CAPI3REF: Convenience Routines For Running Queries
@@ -2350,7 +2481,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_busy_timeout(sqlite3*, int ms);
2350
2481
  ** reflected in subsequent calls to [sqlite3_errcode()] or
2351
2482
  ** [sqlite3_errmsg()].
2352
2483
  */
2353
- SQLITE_API int SQLITE_STDCALL sqlite3_get_table(
2484
+ SQLITE_API int sqlite3_get_table(
2354
2485
  sqlite3 *db, /* An open database */
2355
2486
  const char *zSql, /* SQL to be evaluated */
2356
2487
  char ***pazResult, /* Results of the query */
@@ -2358,7 +2489,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_get_table(
2358
2489
  int *pnColumn, /* Number of result columns written here */
2359
2490
  char **pzErrmsg /* Error msg written here */
2360
2491
  );
2361
- SQLITE_API void SQLITE_STDCALL sqlite3_free_table(char **result);
2492
+ SQLITE_API void sqlite3_free_table(char **result);
2362
2493
 
2363
2494
  /*
2364
2495
  ** CAPI3REF: Formatted String Printing Functions
@@ -2464,10 +2595,10 @@ SQLITE_API void SQLITE_STDCALL sqlite3_free_table(char **result);
2464
2595
  ** addition that after the string has been read and copied into
2465
2596
  ** the result, [sqlite3_free()] is called on the input string.)^
2466
2597
  */
2467
- SQLITE_API char *SQLITE_CDECL sqlite3_mprintf(const char*,...);
2468
- SQLITE_API char *SQLITE_STDCALL sqlite3_vmprintf(const char*, va_list);
2469
- SQLITE_API char *SQLITE_CDECL sqlite3_snprintf(int,char*,const char*, ...);
2470
- SQLITE_API char *SQLITE_STDCALL sqlite3_vsnprintf(int,char*,const char*, va_list);
2598
+ SQLITE_API char *sqlite3_mprintf(const char*,...);
2599
+ SQLITE_API char *sqlite3_vmprintf(const char*, va_list);
2600
+ SQLITE_API char *sqlite3_snprintf(int,char*,const char*, ...);
2601
+ SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list);
2471
2602
 
2472
2603
  /*
2473
2604
  ** CAPI3REF: Memory Allocation Subsystem
@@ -2557,12 +2688,12 @@ SQLITE_API char *SQLITE_STDCALL sqlite3_vsnprintf(int,char*,const char*, va_list
2557
2688
  ** a block of memory after it has been released using
2558
2689
  ** [sqlite3_free()] or [sqlite3_realloc()].
2559
2690
  */
2560
- SQLITE_API void *SQLITE_STDCALL sqlite3_malloc(int);
2561
- SQLITE_API void *SQLITE_STDCALL sqlite3_malloc64(sqlite3_uint64);
2562
- SQLITE_API void *SQLITE_STDCALL sqlite3_realloc(void*, int);
2563
- SQLITE_API void *SQLITE_STDCALL sqlite3_realloc64(void*, sqlite3_uint64);
2564
- SQLITE_API void SQLITE_STDCALL sqlite3_free(void*);
2565
- SQLITE_API sqlite3_uint64 SQLITE_STDCALL sqlite3_msize(void*);
2691
+ SQLITE_API void *sqlite3_malloc(int);
2692
+ SQLITE_API void *sqlite3_malloc64(sqlite3_uint64);
2693
+ SQLITE_API void *sqlite3_realloc(void*, int);
2694
+ SQLITE_API void *sqlite3_realloc64(void*, sqlite3_uint64);
2695
+ SQLITE_API void sqlite3_free(void*);
2696
+ SQLITE_API sqlite3_uint64 sqlite3_msize(void*);
2566
2697
 
2567
2698
  /*
2568
2699
  ** CAPI3REF: Memory Allocator Statistics
@@ -2587,8 +2718,8 @@ SQLITE_API sqlite3_uint64 SQLITE_STDCALL sqlite3_msize(void*);
2587
2718
  ** by [sqlite3_memory_highwater(1)] is the high-water mark
2588
2719
  ** prior to the reset.
2589
2720
  */
2590
- SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_memory_used(void);
2591
- SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_memory_highwater(int resetFlag);
2721
+ SQLITE_API sqlite3_int64 sqlite3_memory_used(void);
2722
+ SQLITE_API sqlite3_int64 sqlite3_memory_highwater(int resetFlag);
2592
2723
 
2593
2724
  /*
2594
2725
  ** CAPI3REF: Pseudo-Random Number Generator
@@ -2611,17 +2742,19 @@ SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_memory_highwater(int resetFlag);
2611
2742
  ** internally and without recourse to the [sqlite3_vfs] xRandomness
2612
2743
  ** method.
2613
2744
  */
2614
- SQLITE_API void SQLITE_STDCALL sqlite3_randomness(int N, void *P);
2745
+ SQLITE_API void sqlite3_randomness(int N, void *P);
2615
2746
 
2616
2747
  /*
2617
2748
  ** CAPI3REF: Compile-Time Authorization Callbacks
2618
2749
  ** METHOD: sqlite3
2750
+ ** KEYWORDS: {authorizer callback}
2619
2751
  **
2620
2752
  ** ^This routine registers an authorizer callback with a particular
2621
2753
  ** [database connection], supplied in the first argument.
2622
2754
  ** ^The authorizer callback is invoked as SQL statements are being compiled
2623
2755
  ** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()],
2624
- ** [sqlite3_prepare16()] and [sqlite3_prepare16_v2()]. ^At various
2756
+ ** [sqlite3_prepare_v3()], [sqlite3_prepare16()], [sqlite3_prepare16_v2()],
2757
+ ** and [sqlite3_prepare16_v3()]. ^At various
2625
2758
  ** points during the compilation process, as logic is being created
2626
2759
  ** to perform various actions, the authorizer callback is invoked to
2627
2760
  ** see if those actions are allowed. ^The authorizer callback should
@@ -2643,8 +2776,10 @@ SQLITE_API void SQLITE_STDCALL sqlite3_randomness(int N, void *P);
2643
2776
  ** parameter to the sqlite3_set_authorizer() interface. ^The second parameter
2644
2777
  ** to the callback is an integer [SQLITE_COPY | action code] that specifies
2645
2778
  ** the particular action to be authorized. ^The third through sixth parameters
2646
- ** to the callback are zero-terminated strings that contain additional
2647
- ** details about the action to be authorized.
2779
+ ** to the callback are either NULL pointers or zero-terminated strings
2780
+ ** that contain additional details about the action to be authorized.
2781
+ ** Applications must always be prepared to encounter a NULL pointer in any
2782
+ ** of the third through the sixth parameters of the authorization callback.
2648
2783
  **
2649
2784
  ** ^If the action code is [SQLITE_READ]
2650
2785
  ** and the callback returns [SQLITE_IGNORE] then the
@@ -2653,6 +2788,10 @@ SQLITE_API void SQLITE_STDCALL sqlite3_randomness(int N, void *P);
2653
2788
  ** been read if [SQLITE_OK] had been returned. The [SQLITE_IGNORE]
2654
2789
  ** return can be used to deny an untrusted user access to individual
2655
2790
  ** columns of a table.
2791
+ ** ^When a table is referenced by a [SELECT] but no column values are
2792
+ ** extracted from that table (for example in a query like
2793
+ ** "SELECT count(*) FROM tab") then the [SQLITE_READ] authorizer callback
2794
+ ** is invoked once for that table with a column name that is an empty string.
2656
2795
  ** ^If the action code is [SQLITE_DELETE] and the callback returns
2657
2796
  ** [SQLITE_IGNORE] then the [DELETE] operation proceeds but the
2658
2797
  ** [truncate optimization] is disabled and all rows are deleted individually.
@@ -2694,7 +2833,7 @@ SQLITE_API void SQLITE_STDCALL sqlite3_randomness(int N, void *P);
2694
2833
  ** as stated in the previous paragraph, sqlite3_step() invokes
2695
2834
  ** sqlite3_prepare_v2() to reprepare a statement after a schema change.
2696
2835
  */
2697
- SQLITE_API int SQLITE_STDCALL sqlite3_set_authorizer(
2836
+ SQLITE_API int sqlite3_set_authorizer(
2698
2837
  sqlite3*,
2699
2838
  int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),
2700
2839
  void *pUserData
@@ -2802,9 +2941,9 @@ SQLITE_API int SQLITE_STDCALL sqlite3_set_authorizer(
2802
2941
  ** sqlite3_profile() function is considered experimental and is
2803
2942
  ** subject to change in future versions of SQLite.
2804
2943
  */
2805
- SQLITE_API SQLITE_DEPRECATED void *SQLITE_STDCALL sqlite3_trace(sqlite3*,
2944
+ SQLITE_API SQLITE_DEPRECATED void *sqlite3_trace(sqlite3*,
2806
2945
  void(*xTrace)(void*,const char*), void*);
2807
- SQLITE_API SQLITE_DEPRECATED void *SQLITE_STDCALL sqlite3_profile(sqlite3*,
2946
+ SQLITE_API SQLITE_DEPRECATED void *sqlite3_profile(sqlite3*,
2808
2947
  void(*xProfile)(void*,const char*,sqlite3_uint64), void*);
2809
2948
 
2810
2949
  /*
@@ -2812,8 +2951,8 @@ SQLITE_API SQLITE_DEPRECATED void *SQLITE_STDCALL sqlite3_profile(sqlite3*,
2812
2951
  ** KEYWORDS: SQLITE_TRACE
2813
2952
  **
2814
2953
  ** These constants identify classes of events that can be monitored
2815
- ** using the [sqlite3_trace_v2()] tracing logic. The third argument
2816
- ** to [sqlite3_trace_v2()] is an OR-ed combination of one or more of
2954
+ ** using the [sqlite3_trace_v2()] tracing logic. The M argument
2955
+ ** to [sqlite3_trace_v2(D,M,X,P)] is an OR-ed combination of one or more of
2817
2956
  ** the following constants. ^The first argument to the trace callback
2818
2957
  ** is one of the following constants.
2819
2958
  **
@@ -2893,7 +3032,7 @@ SQLITE_API SQLITE_DEPRECATED void *SQLITE_STDCALL sqlite3_profile(sqlite3*,
2893
3032
  ** interfaces [sqlite3_trace()] and [sqlite3_profile()], both of which
2894
3033
  ** are deprecated.
2895
3034
  */
2896
- SQLITE_API int SQLITE_STDCALL sqlite3_trace_v2(
3035
+ SQLITE_API int sqlite3_trace_v2(
2897
3036
  sqlite3*,
2898
3037
  unsigned uMask,
2899
3038
  int(*xCallback)(unsigned,void*,void*,void*),
@@ -2932,7 +3071,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_trace_v2(
2932
3071
  ** database connections for the meaning of "modify" in this paragraph.
2933
3072
  **
2934
3073
  */
2935
- SQLITE_API void SQLITE_STDCALL sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
3074
+ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
2936
3075
 
2937
3076
  /*
2938
3077
  ** CAPI3REF: Opening A New Database Connection
@@ -3022,10 +3161,10 @@ SQLITE_API void SQLITE_STDCALL sqlite3_progress_handler(sqlite3*, int, int(*)(vo
3022
3161
  ** ^If [URI filename] interpretation is enabled, and the filename argument
3023
3162
  ** begins with "file:", then the filename is interpreted as a URI. ^URI
3024
3163
  ** filename interpretation is enabled if the [SQLITE_OPEN_URI] flag is
3025
- ** set in the fourth argument to sqlite3_open_v2(), or if it has
3164
+ ** set in the third argument to sqlite3_open_v2(), or if it has
3026
3165
  ** been enabled globally using the [SQLITE_CONFIG_URI] option with the
3027
3166
  ** [sqlite3_config()] method or by the [SQLITE_USE_URI] compile-time option.
3028
- ** As of SQLite version 3.7.7, URI filename interpretation is turned off
3167
+ ** URI filename interpretation is turned off
3029
3168
  ** by default, but future releases of SQLite might enable URI filename
3030
3169
  ** interpretation by default. See "[URI filenames]" for additional
3031
3170
  ** information.
@@ -3161,15 +3300,15 @@ SQLITE_API void SQLITE_STDCALL sqlite3_progress_handler(sqlite3*, int, int(*)(vo
3161
3300
  **
3162
3301
  ** See also: [sqlite3_temp_directory]
3163
3302
  */
3164
- SQLITE_API int SQLITE_STDCALL sqlite3_open(
3303
+ SQLITE_API int sqlite3_open(
3165
3304
  const char *filename, /* Database filename (UTF-8) */
3166
3305
  sqlite3 **ppDb /* OUT: SQLite db handle */
3167
3306
  );
3168
- SQLITE_API int SQLITE_STDCALL sqlite3_open16(
3307
+ SQLITE_API int sqlite3_open16(
3169
3308
  const void *filename, /* Database filename (UTF-16) */
3170
3309
  sqlite3 **ppDb /* OUT: SQLite db handle */
3171
3310
  );
3172
- SQLITE_API int SQLITE_STDCALL sqlite3_open_v2(
3311
+ SQLITE_API int sqlite3_open_v2(
3173
3312
  const char *filename, /* Database filename (UTF-8) */
3174
3313
  sqlite3 **ppDb, /* OUT: SQLite db handle */
3175
3314
  int flags, /* Flags */
@@ -3215,9 +3354,9 @@ SQLITE_API int SQLITE_STDCALL sqlite3_open_v2(
3215
3354
  ** VFS method, then the behavior of this routine is undefined and probably
3216
3355
  ** undesirable.
3217
3356
  */
3218
- SQLITE_API const char *SQLITE_STDCALL sqlite3_uri_parameter(const char *zFilename, const char *zParam);
3219
- SQLITE_API int SQLITE_STDCALL sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault);
3220
- SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_uri_int64(const char*, const char*, sqlite3_int64);
3357
+ SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam);
3358
+ SQLITE_API int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault);
3359
+ SQLITE_API sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int64);
3221
3360
 
3222
3361
 
3223
3362
  /*
@@ -3261,11 +3400,11 @@ SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_uri_int64(const char*, const cha
3261
3400
  ** was invoked incorrectly by the application. In that case, the
3262
3401
  ** error code and message may or may not be set.
3263
3402
  */
3264
- SQLITE_API int SQLITE_STDCALL sqlite3_errcode(sqlite3 *db);
3265
- SQLITE_API int SQLITE_STDCALL sqlite3_extended_errcode(sqlite3 *db);
3266
- SQLITE_API const char *SQLITE_STDCALL sqlite3_errmsg(sqlite3*);
3267
- SQLITE_API const void *SQLITE_STDCALL sqlite3_errmsg16(sqlite3*);
3268
- SQLITE_API const char *SQLITE_STDCALL sqlite3_errstr(int);
3403
+ SQLITE_API int sqlite3_errcode(sqlite3 *db);
3404
+ SQLITE_API int sqlite3_extended_errcode(sqlite3 *db);
3405
+ SQLITE_API const char *sqlite3_errmsg(sqlite3*);
3406
+ SQLITE_API const void *sqlite3_errmsg16(sqlite3*);
3407
+ SQLITE_API const char *sqlite3_errstr(int);
3269
3408
 
3270
3409
  /*
3271
3410
  ** CAPI3REF: Prepared Statement Object
@@ -3333,7 +3472,7 @@ typedef struct sqlite3_stmt sqlite3_stmt;
3333
3472
  **
3334
3473
  ** New run-time limit categories may be added in future releases.
3335
3474
  */
3336
- SQLITE_API int SQLITE_STDCALL sqlite3_limit(sqlite3*, int id, int newVal);
3475
+ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
3337
3476
 
3338
3477
  /*
3339
3478
  ** CAPI3REF: Run-Time Limit Categories
@@ -3364,9 +3503,9 @@ SQLITE_API int SQLITE_STDCALL sqlite3_limit(sqlite3*, int id, int newVal);
3364
3503
  **
3365
3504
  ** [[SQLITE_LIMIT_VDBE_OP]] ^(<dt>SQLITE_LIMIT_VDBE_OP</dt>
3366
3505
  ** <dd>The maximum number of instructions in a virtual machine program
3367
- ** used to implement an SQL statement. This limit is not currently
3368
- ** enforced, though that might be added in some future release of
3369
- ** SQLite.</dd>)^
3506
+ ** used to implement an SQL statement. If [sqlite3_prepare_v2()] or
3507
+ ** the equivalent tries to allocate space for more than this many opcodes
3508
+ ** in a single prepared statement, an SQLITE_NOMEM error is returned.</dd>)^
3370
3509
  **
3371
3510
  ** [[SQLITE_LIMIT_FUNCTION_ARG]] ^(<dt>SQLITE_LIMIT_FUNCTION_ARG</dt>
3372
3511
  ** <dd>The maximum number of arguments on a function.</dd>)^
@@ -3404,23 +3543,59 @@ SQLITE_API int SQLITE_STDCALL sqlite3_limit(sqlite3*, int id, int newVal);
3404
3543
  #define SQLITE_LIMIT_TRIGGER_DEPTH 10
3405
3544
  #define SQLITE_LIMIT_WORKER_THREADS 11
3406
3545
 
3546
+ /*
3547
+ ** CAPI3REF: Prepare Flags
3548
+ **
3549
+ ** These constants define various flags that can be passed into
3550
+ ** "prepFlags" parameter of the [sqlite3_prepare_v3()] and
3551
+ ** [sqlite3_prepare16_v3()] interfaces.
3552
+ **
3553
+ ** New flags may be added in future releases of SQLite.
3554
+ **
3555
+ ** <dl>
3556
+ ** [[SQLITE_PREPARE_PERSISTENT]] ^(<dt>SQLITE_PREPARE_PERSISTENT</dt>
3557
+ ** <dd>The SQLITE_PREPARE_PERSISTENT flag is a hint to the query planner
3558
+ ** that the prepared statement will be retained for a long time and
3559
+ ** probably reused many times.)^ ^Without this flag, [sqlite3_prepare_v3()]
3560
+ ** and [sqlite3_prepare16_v3()] assume that the prepared statement will
3561
+ ** be used just once or at most a few times and then destroyed using
3562
+ ** [sqlite3_finalize()] relatively soon. The current implementation acts
3563
+ ** on this hint by avoiding the use of [lookaside memory] so as not to
3564
+ ** deplete the limited store of lookaside memory. Future versions of
3565
+ ** SQLite may act on this hint differently.
3566
+ ** </dl>
3567
+ */
3568
+ #define SQLITE_PREPARE_PERSISTENT 0x01
3569
+
3407
3570
  /*
3408
3571
  ** CAPI3REF: Compiling An SQL Statement
3409
3572
  ** KEYWORDS: {SQL statement compiler}
3410
3573
  ** METHOD: sqlite3
3411
3574
  ** CONSTRUCTOR: sqlite3_stmt
3412
3575
  **
3413
- ** To execute an SQL query, it must first be compiled into a byte-code
3414
- ** program using one of these routines.
3576
+ ** To execute an SQL statement, it must first be compiled into a byte-code
3577
+ ** program using one of these routines. Or, in other words, these routines
3578
+ ** are constructors for the [prepared statement] object.
3579
+ **
3580
+ ** The preferred routine to use is [sqlite3_prepare_v2()]. The
3581
+ ** [sqlite3_prepare()] interface is legacy and should be avoided.
3582
+ ** [sqlite3_prepare_v3()] has an extra "prepFlags" option that is used
3583
+ ** for special purposes.
3584
+ **
3585
+ ** The use of the UTF-8 interfaces is preferred, as SQLite currently
3586
+ ** does all parsing using UTF-8. The UTF-16 interfaces are provided
3587
+ ** as a convenience. The UTF-16 interfaces work by converting the
3588
+ ** input text into UTF-8, then invoking the corresponding UTF-8 interface.
3415
3589
  **
3416
3590
  ** The first argument, "db", is a [database connection] obtained from a
3417
3591
  ** prior successful call to [sqlite3_open()], [sqlite3_open_v2()] or
3418
3592
  ** [sqlite3_open16()]. The database connection must not have been closed.
3419
3593
  **
3420
3594
  ** The second argument, "zSql", is the statement to be compiled, encoded
3421
- ** as either UTF-8 or UTF-16. The sqlite3_prepare() and sqlite3_prepare_v2()
3422
- ** interfaces use UTF-8, and sqlite3_prepare16() and sqlite3_prepare16_v2()
3423
- ** use UTF-16.
3595
+ ** as either UTF-8 or UTF-16. The sqlite3_prepare(), sqlite3_prepare_v2(),
3596
+ ** and sqlite3_prepare_v3()
3597
+ ** interfaces use UTF-8, and sqlite3_prepare16(), sqlite3_prepare16_v2(),
3598
+ ** and sqlite3_prepare16_v3() use UTF-16.
3424
3599
  **
3425
3600
  ** ^If the nByte argument is negative, then zSql is read up to the
3426
3601
  ** first zero terminator. ^If nByte is positive, then it is the
@@ -3447,10 +3622,11 @@ SQLITE_API int SQLITE_STDCALL sqlite3_limit(sqlite3*, int id, int newVal);
3447
3622
  ** ^On success, the sqlite3_prepare() family of routines return [SQLITE_OK];
3448
3623
  ** otherwise an [error code] is returned.
3449
3624
  **
3450
- ** The sqlite3_prepare_v2() and sqlite3_prepare16_v2() interfaces are
3451
- ** recommended for all new programs. The two older interfaces are retained
3452
- ** for backwards compatibility, but their use is discouraged.
3453
- ** ^In the "v2" interfaces, the prepared statement
3625
+ ** The sqlite3_prepare_v2(), sqlite3_prepare_v3(), sqlite3_prepare16_v2(),
3626
+ ** and sqlite3_prepare16_v3() interfaces are recommended for all new programs.
3627
+ ** The older interfaces (sqlite3_prepare() and sqlite3_prepare16())
3628
+ ** are retained for backwards compatibility, but their use is discouraged.
3629
+ ** ^In the "vX" interfaces, the prepared statement
3454
3630
  ** that is returned (the [sqlite3_stmt] object) contains a copy of the
3455
3631
  ** original SQL text. This causes the [sqlite3_step()] interface to
3456
3632
  ** behave differently in three ways:
@@ -3483,36 +3659,58 @@ SQLITE_API int SQLITE_STDCALL sqlite3_limit(sqlite3*, int id, int newVal);
3483
3659
  ** or [GLOB] operator or if the parameter is compared to an indexed column
3484
3660
  ** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled.
3485
3661
  ** </li>
3662
+ **
3663
+ ** <p>^sqlite3_prepare_v3() differs from sqlite3_prepare_v2() only in having
3664
+ ** the extra prepFlags parameter, which is a bit array consisting of zero or
3665
+ ** more of the [SQLITE_PREPARE_PERSISTENT|SQLITE_PREPARE_*] flags. ^The
3666
+ ** sqlite3_prepare_v2() interface works exactly the same as
3667
+ ** sqlite3_prepare_v3() with a zero prepFlags parameter.
3486
3668
  ** </ol>
3487
3669
  */
3488
- SQLITE_API int SQLITE_STDCALL sqlite3_prepare(
3670
+ SQLITE_API int sqlite3_prepare(
3671
+ sqlite3 *db, /* Database handle */
3672
+ const char *zSql, /* SQL statement, UTF-8 encoded */
3673
+ int nByte, /* Maximum length of zSql in bytes. */
3674
+ sqlite3_stmt **ppStmt, /* OUT: Statement handle */
3675
+ const char **pzTail /* OUT: Pointer to unused portion of zSql */
3676
+ );
3677
+ SQLITE_API int sqlite3_prepare_v2(
3489
3678
  sqlite3 *db, /* Database handle */
3490
3679
  const char *zSql, /* SQL statement, UTF-8 encoded */
3491
3680
  int nByte, /* Maximum length of zSql in bytes. */
3492
3681
  sqlite3_stmt **ppStmt, /* OUT: Statement handle */
3493
3682
  const char **pzTail /* OUT: Pointer to unused portion of zSql */
3494
3683
  );
3495
- SQLITE_API int SQLITE_STDCALL sqlite3_prepare_v2(
3684
+ SQLITE_API int sqlite3_prepare_v3(
3496
3685
  sqlite3 *db, /* Database handle */
3497
3686
  const char *zSql, /* SQL statement, UTF-8 encoded */
3498
3687
  int nByte, /* Maximum length of zSql in bytes. */
3688
+ unsigned int prepFlags, /* Zero or more SQLITE_PREPARE_ flags */
3499
3689
  sqlite3_stmt **ppStmt, /* OUT: Statement handle */
3500
3690
  const char **pzTail /* OUT: Pointer to unused portion of zSql */
3501
3691
  );
3502
- SQLITE_API int SQLITE_STDCALL sqlite3_prepare16(
3692
+ SQLITE_API int sqlite3_prepare16(
3503
3693
  sqlite3 *db, /* Database handle */
3504
3694
  const void *zSql, /* SQL statement, UTF-16 encoded */
3505
3695
  int nByte, /* Maximum length of zSql in bytes. */
3506
3696
  sqlite3_stmt **ppStmt, /* OUT: Statement handle */
3507
3697
  const void **pzTail /* OUT: Pointer to unused portion of zSql */
3508
3698
  );
3509
- SQLITE_API int SQLITE_STDCALL sqlite3_prepare16_v2(
3699
+ SQLITE_API int sqlite3_prepare16_v2(
3510
3700
  sqlite3 *db, /* Database handle */
3511
3701
  const void *zSql, /* SQL statement, UTF-16 encoded */
3512
3702
  int nByte, /* Maximum length of zSql in bytes. */
3513
3703
  sqlite3_stmt **ppStmt, /* OUT: Statement handle */
3514
3704
  const void **pzTail /* OUT: Pointer to unused portion of zSql */
3515
3705
  );
3706
+ SQLITE_API int sqlite3_prepare16_v3(
3707
+ sqlite3 *db, /* Database handle */
3708
+ const void *zSql, /* SQL statement, UTF-16 encoded */
3709
+ int nByte, /* Maximum length of zSql in bytes. */
3710
+ unsigned int prepFlags, /* Zero or more SQLITE_PREPARE_ flags */
3711
+ sqlite3_stmt **ppStmt, /* OUT: Statement handle */
3712
+ const void **pzTail /* OUT: Pointer to unused portion of zSql */
3713
+ );
3516
3714
 
3517
3715
  /*
3518
3716
  ** CAPI3REF: Retrieving Statement SQL
@@ -3520,7 +3718,8 @@ SQLITE_API int SQLITE_STDCALL sqlite3_prepare16_v2(
3520
3718
  **
3521
3719
  ** ^The sqlite3_sql(P) interface returns a pointer to a copy of the UTF-8
3522
3720
  ** SQL text used to create [prepared statement] P if P was
3523
- ** created by either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()].
3721
+ ** created by [sqlite3_prepare_v2()], [sqlite3_prepare_v3()],
3722
+ ** [sqlite3_prepare16_v2()], or [sqlite3_prepare16_v3()].
3524
3723
  ** ^The sqlite3_expanded_sql(P) interface returns a pointer to a UTF-8
3525
3724
  ** string containing the SQL text of prepared statement P with
3526
3725
  ** [bound parameters] expanded.
@@ -3545,8 +3744,8 @@ SQLITE_API int SQLITE_STDCALL sqlite3_prepare16_v2(
3545
3744
  ** is obtained from [sqlite3_malloc()] and must be free by the application
3546
3745
  ** by passing it to [sqlite3_free()].
3547
3746
  */
3548
- SQLITE_API const char *SQLITE_STDCALL sqlite3_sql(sqlite3_stmt *pStmt);
3549
- SQLITE_API char *SQLITE_STDCALL sqlite3_expanded_sql(sqlite3_stmt *pStmt);
3747
+ SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt);
3748
+ SQLITE_API char *sqlite3_expanded_sql(sqlite3_stmt *pStmt);
3550
3749
 
3551
3750
  /*
3552
3751
  ** CAPI3REF: Determine If An SQL Statement Writes The Database
@@ -3577,8 +3776,12 @@ SQLITE_API char *SQLITE_STDCALL sqlite3_expanded_sql(sqlite3_stmt *pStmt);
3577
3776
  ** sqlite3_stmt_readonly() to return true since, while those statements
3578
3777
  ** change the configuration of a database connection, they do not make
3579
3778
  ** changes to the content of the database files on disk.
3779
+ ** ^The sqlite3_stmt_readonly() interface returns true for [BEGIN] since
3780
+ ** [BEGIN] merely sets internal flags, but the [BEGIN|BEGIN IMMEDIATE] and
3781
+ ** [BEGIN|BEGIN EXCLUSIVE] commands do touch the database and so
3782
+ ** sqlite3_stmt_readonly() returns false for those commands.
3580
3783
  */
3581
- SQLITE_API int SQLITE_STDCALL sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
3784
+ SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
3582
3785
 
3583
3786
  /*
3584
3787
  ** CAPI3REF: Determine If A Prepared Statement Has Been Reset
@@ -3599,7 +3802,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
3599
3802
  ** for example, in diagnostic routines to search for prepared
3600
3803
  ** statements that are holding a transaction open.
3601
3804
  */
3602
- SQLITE_API int SQLITE_STDCALL sqlite3_stmt_busy(sqlite3_stmt*);
3805
+ SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*);
3603
3806
 
3604
3807
  /*
3605
3808
  ** CAPI3REF: Dynamically Typed Value Object
@@ -3635,12 +3838,13 @@ SQLITE_API int SQLITE_STDCALL sqlite3_stmt_busy(sqlite3_stmt*);
3635
3838
  ** implementation of [application-defined SQL functions] are protected.
3636
3839
  ** ^The sqlite3_value object returned by
3637
3840
  ** [sqlite3_column_value()] is unprotected.
3638
- ** Unprotected sqlite3_value objects may only be used with
3639
- ** [sqlite3_result_value()] and [sqlite3_bind_value()].
3841
+ ** Unprotected sqlite3_value objects may only be used as arguments
3842
+ ** to [sqlite3_result_value()], [sqlite3_bind_value()], and
3843
+ ** [sqlite3_value_dup()].
3640
3844
  ** The [sqlite3_value_blob | sqlite3_value_type()] family of
3641
3845
  ** interfaces require protected sqlite3_value objects.
3642
3846
  */
3643
- typedef struct Mem sqlite3_value;
3847
+ typedef struct sqlite3_value sqlite3_value;
3644
3848
 
3645
3849
  /*
3646
3850
  ** CAPI3REF: SQL Function Context Object
@@ -3742,6 +3946,15 @@ typedef struct sqlite3_context sqlite3_context;
3742
3946
  ** [sqlite3_blob_open | incremental BLOB I/O] routines.
3743
3947
  ** ^A negative value for the zeroblob results in a zero-length BLOB.
3744
3948
  **
3949
+ ** ^The sqlite3_bind_pointer(S,I,P,T,D) routine causes the I-th parameter in
3950
+ ** [prepared statement] S to have an SQL value of NULL, but to also be
3951
+ ** associated with the pointer P of type T. ^D is either a NULL pointer or
3952
+ ** a pointer to a destructor function for P. ^SQLite will invoke the
3953
+ ** destructor D with a single argument of P when it is finished using
3954
+ ** P. The T parameter should be a static string, preferably a string
3955
+ ** literal. The sqlite3_bind_pointer() routine is part of the
3956
+ ** [pointer passing interface] added for SQLite 3.20.0.
3957
+ **
3745
3958
  ** ^If any of the sqlite3_bind_*() routines are called with a NULL pointer
3746
3959
  ** for the [prepared statement] or with a prepared statement for which
3747
3960
  ** [sqlite3_step()] has been called more recently than [sqlite3_reset()],
@@ -3763,20 +3976,21 @@ typedef struct sqlite3_context sqlite3_context;
3763
3976
  ** See also: [sqlite3_bind_parameter_count()],
3764
3977
  ** [sqlite3_bind_parameter_name()], and [sqlite3_bind_parameter_index()].
3765
3978
  */
3766
- SQLITE_API int SQLITE_STDCALL sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));
3767
- SQLITE_API int SQLITE_STDCALL sqlite3_bind_blob64(sqlite3_stmt*, int, const void*, sqlite3_uint64,
3979
+ SQLITE_API int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));
3980
+ SQLITE_API int sqlite3_bind_blob64(sqlite3_stmt*, int, const void*, sqlite3_uint64,
3768
3981
  void(*)(void*));
3769
- SQLITE_API int SQLITE_STDCALL sqlite3_bind_double(sqlite3_stmt*, int, double);
3770
- SQLITE_API int SQLITE_STDCALL sqlite3_bind_int(sqlite3_stmt*, int, int);
3771
- SQLITE_API int SQLITE_STDCALL sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64);
3772
- SQLITE_API int SQLITE_STDCALL sqlite3_bind_null(sqlite3_stmt*, int);
3773
- SQLITE_API int SQLITE_STDCALL sqlite3_bind_text(sqlite3_stmt*,int,const char*,int,void(*)(void*));
3774
- SQLITE_API int SQLITE_STDCALL sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*));
3775
- SQLITE_API int SQLITE_STDCALL sqlite3_bind_text64(sqlite3_stmt*, int, const char*, sqlite3_uint64,
3982
+ SQLITE_API int sqlite3_bind_double(sqlite3_stmt*, int, double);
3983
+ SQLITE_API int sqlite3_bind_int(sqlite3_stmt*, int, int);
3984
+ SQLITE_API int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64);
3985
+ SQLITE_API int sqlite3_bind_null(sqlite3_stmt*, int);
3986
+ SQLITE_API int sqlite3_bind_text(sqlite3_stmt*,int,const char*,int,void(*)(void*));
3987
+ SQLITE_API int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*));
3988
+ SQLITE_API int sqlite3_bind_text64(sqlite3_stmt*, int, const char*, sqlite3_uint64,
3776
3989
  void(*)(void*), unsigned char encoding);
3777
- SQLITE_API int SQLITE_STDCALL sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
3778
- SQLITE_API int SQLITE_STDCALL sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
3779
- SQLITE_API int SQLITE_STDCALL sqlite3_bind_zeroblob64(sqlite3_stmt*, int, sqlite3_uint64);
3990
+ SQLITE_API int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
3991
+ SQLITE_API int sqlite3_bind_pointer(sqlite3_stmt*, int, void*, const char*,void(*)(void*));
3992
+ SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
3993
+ SQLITE_API int sqlite3_bind_zeroblob64(sqlite3_stmt*, int, sqlite3_uint64);
3780
3994
 
3781
3995
  /*
3782
3996
  ** CAPI3REF: Number Of SQL Parameters
@@ -3797,7 +4011,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_bind_zeroblob64(sqlite3_stmt*, int, sqlite
3797
4011
  ** [sqlite3_bind_parameter_name()], and
3798
4012
  ** [sqlite3_bind_parameter_index()].
3799
4013
  */
3800
- SQLITE_API int SQLITE_STDCALL sqlite3_bind_parameter_count(sqlite3_stmt*);
4014
+ SQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt*);
3801
4015
 
3802
4016
  /*
3803
4017
  ** CAPI3REF: Name Of A Host Parameter
@@ -3818,14 +4032,14 @@ SQLITE_API int SQLITE_STDCALL sqlite3_bind_parameter_count(sqlite3_stmt*);
3818
4032
  ** ^If the value N is out of range or if the N-th parameter is
3819
4033
  ** nameless, then NULL is returned. ^The returned string is
3820
4034
  ** always in UTF-8 encoding even if the named parameter was
3821
- ** originally specified as UTF-16 in [sqlite3_prepare16()] or
3822
- ** [sqlite3_prepare16_v2()].
4035
+ ** originally specified as UTF-16 in [sqlite3_prepare16()],
4036
+ ** [sqlite3_prepare16_v2()], or [sqlite3_prepare16_v3()].
3823
4037
  **
3824
4038
  ** See also: [sqlite3_bind_blob|sqlite3_bind()],
3825
4039
  ** [sqlite3_bind_parameter_count()], and
3826
4040
  ** [sqlite3_bind_parameter_index()].
3827
4041
  */
3828
- SQLITE_API const char *SQLITE_STDCALL sqlite3_bind_parameter_name(sqlite3_stmt*, int);
4042
+ SQLITE_API const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int);
3829
4043
 
3830
4044
  /*
3831
4045
  ** CAPI3REF: Index Of A Parameter With A Given Name
@@ -3836,13 +4050,14 @@ SQLITE_API const char *SQLITE_STDCALL sqlite3_bind_parameter_name(sqlite3_stmt*,
3836
4050
  ** parameter to [sqlite3_bind_blob|sqlite3_bind()]. ^A zero
3837
4051
  ** is returned if no matching parameter is found. ^The parameter
3838
4052
  ** name must be given in UTF-8 even if the original statement
3839
- ** was prepared from UTF-16 text using [sqlite3_prepare16_v2()].
4053
+ ** was prepared from UTF-16 text using [sqlite3_prepare16_v2()] or
4054
+ ** [sqlite3_prepare16_v3()].
3840
4055
  **
3841
4056
  ** See also: [sqlite3_bind_blob|sqlite3_bind()],
3842
4057
  ** [sqlite3_bind_parameter_count()], and
3843
4058
  ** [sqlite3_bind_parameter_name()].
3844
4059
  */
3845
- SQLITE_API int SQLITE_STDCALL sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName);
4060
+ SQLITE_API int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName);
3846
4061
 
3847
4062
  /*
3848
4063
  ** CAPI3REF: Reset All Bindings On A Prepared Statement
@@ -3852,19 +4067,23 @@ SQLITE_API int SQLITE_STDCALL sqlite3_bind_parameter_index(sqlite3_stmt*, const
3852
4067
  ** the [sqlite3_bind_blob | bindings] on a [prepared statement].
3853
4068
  ** ^Use this routine to reset all host parameters to NULL.
3854
4069
  */
3855
- SQLITE_API int SQLITE_STDCALL sqlite3_clear_bindings(sqlite3_stmt*);
4070
+ SQLITE_API int sqlite3_clear_bindings(sqlite3_stmt*);
3856
4071
 
3857
4072
  /*
3858
4073
  ** CAPI3REF: Number Of Columns In A Result Set
3859
4074
  ** METHOD: sqlite3_stmt
3860
4075
  **
3861
4076
  ** ^Return the number of columns in the result set returned by the
3862
- ** [prepared statement]. ^This routine returns 0 if pStmt is an SQL
3863
- ** statement that does not return data (for example an [UPDATE]).
4077
+ ** [prepared statement]. ^If this routine returns 0, that means the
4078
+ ** [prepared statement] returns no data (for example an [UPDATE]).
4079
+ ** ^However, just because this routine returns a positive number does not
4080
+ ** mean that one or more rows of data will be returned. ^A SELECT statement
4081
+ ** will always have a positive sqlite3_column_count() but depending on the
4082
+ ** WHERE clause constraints and the table content, it might return no rows.
3864
4083
  **
3865
4084
  ** See also: [sqlite3_data_count()]
3866
4085
  */
3867
- SQLITE_API int SQLITE_STDCALL sqlite3_column_count(sqlite3_stmt *pStmt);
4086
+ SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt);
3868
4087
 
3869
4088
  /*
3870
4089
  ** CAPI3REF: Column Names In A Result Set
@@ -3893,8 +4112,8 @@ SQLITE_API int SQLITE_STDCALL sqlite3_column_count(sqlite3_stmt *pStmt);
3893
4112
  ** then the name of the column is unspecified and may change from
3894
4113
  ** one release of SQLite to the next.
3895
4114
  */
3896
- SQLITE_API const char *SQLITE_STDCALL sqlite3_column_name(sqlite3_stmt*, int N);
3897
- SQLITE_API const void *SQLITE_STDCALL sqlite3_column_name16(sqlite3_stmt*, int N);
4115
+ SQLITE_API const char *sqlite3_column_name(sqlite3_stmt*, int N);
4116
+ SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt*, int N);
3898
4117
 
3899
4118
  /*
3900
4119
  ** CAPI3REF: Source Of Data In A Query Result
@@ -3942,12 +4161,12 @@ SQLITE_API const void *SQLITE_STDCALL sqlite3_column_name16(sqlite3_stmt*, int N
3942
4161
  ** for the same [prepared statement] and result column
3943
4162
  ** at the same time then the results are undefined.
3944
4163
  */
3945
- SQLITE_API const char *SQLITE_STDCALL sqlite3_column_database_name(sqlite3_stmt*,int);
3946
- SQLITE_API const void *SQLITE_STDCALL sqlite3_column_database_name16(sqlite3_stmt*,int);
3947
- SQLITE_API const char *SQLITE_STDCALL sqlite3_column_table_name(sqlite3_stmt*,int);
3948
- SQLITE_API const void *SQLITE_STDCALL sqlite3_column_table_name16(sqlite3_stmt*,int);
3949
- SQLITE_API const char *SQLITE_STDCALL sqlite3_column_origin_name(sqlite3_stmt*,int);
3950
- SQLITE_API const void *SQLITE_STDCALL sqlite3_column_origin_name16(sqlite3_stmt*,int);
4164
+ SQLITE_API const char *sqlite3_column_database_name(sqlite3_stmt*,int);
4165
+ SQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt*,int);
4166
+ SQLITE_API const char *sqlite3_column_table_name(sqlite3_stmt*,int);
4167
+ SQLITE_API const void *sqlite3_column_table_name16(sqlite3_stmt*,int);
4168
+ SQLITE_API const char *sqlite3_column_origin_name(sqlite3_stmt*,int);
4169
+ SQLITE_API const void *sqlite3_column_origin_name16(sqlite3_stmt*,int);
3951
4170
 
3952
4171
  /*
3953
4172
  ** CAPI3REF: Declared Datatype Of A Query Result
@@ -3979,23 +4198,25 @@ SQLITE_API const void *SQLITE_STDCALL sqlite3_column_origin_name16(sqlite3_stmt*
3979
4198
  ** is associated with individual values, not with the containers
3980
4199
  ** used to hold those values.
3981
4200
  */
3982
- SQLITE_API const char *SQLITE_STDCALL sqlite3_column_decltype(sqlite3_stmt*,int);
3983
- SQLITE_API const void *SQLITE_STDCALL sqlite3_column_decltype16(sqlite3_stmt*,int);
4201
+ SQLITE_API const char *sqlite3_column_decltype(sqlite3_stmt*,int);
4202
+ SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
3984
4203
 
3985
4204
  /*
3986
4205
  ** CAPI3REF: Evaluate An SQL Statement
3987
4206
  ** METHOD: sqlite3_stmt
3988
4207
  **
3989
- ** After a [prepared statement] has been prepared using either
3990
- ** [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] or one of the legacy
4208
+ ** After a [prepared statement] has been prepared using any of
4209
+ ** [sqlite3_prepare_v2()], [sqlite3_prepare_v3()], [sqlite3_prepare16_v2()],
4210
+ ** or [sqlite3_prepare16_v3()] or one of the legacy
3991
4211
  ** interfaces [sqlite3_prepare()] or [sqlite3_prepare16()], this function
3992
4212
  ** must be called one or more times to evaluate the statement.
3993
4213
  **
3994
4214
  ** The details of the behavior of the sqlite3_step() interface depend
3995
- ** on whether the statement was prepared using the newer "v2" interface
3996
- ** [sqlite3_prepare_v2()] and [sqlite3_prepare16_v2()] or the older legacy
3997
- ** interface [sqlite3_prepare()] and [sqlite3_prepare16()]. The use of the
3998
- ** new "v2" interface is recommended for new applications but the legacy
4215
+ ** on whether the statement was prepared using the newer "vX" interfaces
4216
+ ** [sqlite3_prepare_v3()], [sqlite3_prepare_v2()], [sqlite3_prepare16_v3()],
4217
+ ** [sqlite3_prepare16_v2()] or the older legacy
4218
+ ** interfaces [sqlite3_prepare()] and [sqlite3_prepare16()]. The use of the
4219
+ ** new "vX" interface is recommended for new applications but the legacy
3999
4220
  ** interface will continue to be supported.
4000
4221
  **
4001
4222
  ** ^In the legacy interface, the return value will be either [SQLITE_BUSY],
@@ -4041,7 +4262,8 @@ SQLITE_API const void *SQLITE_STDCALL sqlite3_column_decltype16(sqlite3_stmt*,in
4041
4262
  ** other than [SQLITE_ROW] before any subsequent invocation of
4042
4263
  ** sqlite3_step(). Failure to reset the prepared statement using
4043
4264
  ** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from
4044
- ** sqlite3_step(). But after version 3.6.23.1, sqlite3_step() began
4265
+ ** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1],
4266
+ ** sqlite3_step() began
4045
4267
  ** calling [sqlite3_reset()] automatically in this circumstance rather
4046
4268
  ** than returning [SQLITE_MISUSE]. This is not considered a compatibility
4047
4269
  ** break because any application that ever receives an SQLITE_MISUSE error
@@ -4055,12 +4277,13 @@ SQLITE_API const void *SQLITE_STDCALL sqlite3_column_decltype16(sqlite3_stmt*,in
4055
4277
  ** specific [error codes] that better describes the error.
4056
4278
  ** We admit that this is a goofy design. The problem has been fixed
4057
4279
  ** with the "v2" interface. If you prepare all of your SQL statements
4058
- ** using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] instead
4280
+ ** using [sqlite3_prepare_v3()] or [sqlite3_prepare_v2()]
4281
+ ** or [sqlite3_prepare16_v2()] or [sqlite3_prepare16_v3()] instead
4059
4282
  ** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces,
4060
4283
  ** then the more specific [error codes] are returned directly
4061
- ** by sqlite3_step(). The use of the "v2" interface is recommended.
4284
+ ** by sqlite3_step(). The use of the "vX" interfaces is recommended.
4062
4285
  */
4063
- SQLITE_API int SQLITE_STDCALL sqlite3_step(sqlite3_stmt*);
4286
+ SQLITE_API int sqlite3_step(sqlite3_stmt*);
4064
4287
 
4065
4288
  /*
4066
4289
  ** CAPI3REF: Number of columns in a result set
@@ -4081,7 +4304,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_step(sqlite3_stmt*);
4081
4304
  **
4082
4305
  ** See also: [sqlite3_column_count()]
4083
4306
  */
4084
- SQLITE_API int SQLITE_STDCALL sqlite3_data_count(sqlite3_stmt *pStmt);
4307
+ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
4085
4308
 
4086
4309
  /*
4087
4310
  ** CAPI3REF: Fundamental Datatypes
@@ -4120,6 +4343,28 @@ SQLITE_API int SQLITE_STDCALL sqlite3_data_count(sqlite3_stmt *pStmt);
4120
4343
  ** KEYWORDS: {column access functions}
4121
4344
  ** METHOD: sqlite3_stmt
4122
4345
  **
4346
+ ** <b>Summary:</b>
4347
+ ** <blockquote><table border=0 cellpadding=0 cellspacing=0>
4348
+ ** <tr><td><b>sqlite3_column_blob</b><td>&rarr;<td>BLOB result
4349
+ ** <tr><td><b>sqlite3_column_double</b><td>&rarr;<td>REAL result
4350
+ ** <tr><td><b>sqlite3_column_int</b><td>&rarr;<td>32-bit INTEGER result
4351
+ ** <tr><td><b>sqlite3_column_int64</b><td>&rarr;<td>64-bit INTEGER result
4352
+ ** <tr><td><b>sqlite3_column_text</b><td>&rarr;<td>UTF-8 TEXT result
4353
+ ** <tr><td><b>sqlite3_column_text16</b><td>&rarr;<td>UTF-16 TEXT result
4354
+ ** <tr><td><b>sqlite3_column_value</b><td>&rarr;<td>The result as an
4355
+ ** [sqlite3_value|unprotected sqlite3_value] object.
4356
+ ** <tr><td>&nbsp;<td>&nbsp;<td>&nbsp;
4357
+ ** <tr><td><b>sqlite3_column_bytes</b><td>&rarr;<td>Size of a BLOB
4358
+ ** or a UTF-8 TEXT result in bytes
4359
+ ** <tr><td><b>sqlite3_column_bytes16&nbsp;&nbsp;</b>
4360
+ ** <td>&rarr;&nbsp;&nbsp;<td>Size of UTF-16
4361
+ ** TEXT in bytes
4362
+ ** <tr><td><b>sqlite3_column_type</b><td>&rarr;<td>Default
4363
+ ** datatype of the result
4364
+ ** </table></blockquote>
4365
+ **
4366
+ ** <b>Details:</b>
4367
+ **
4123
4368
  ** ^These routines return information about a single column of the current
4124
4369
  ** result row of a query. ^In every case the first argument is a pointer
4125
4370
  ** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*]
@@ -4141,16 +4386,29 @@ SQLITE_API int SQLITE_STDCALL sqlite3_data_count(sqlite3_stmt *pStmt);
4141
4386
  ** are called from a different thread while any of these routines
4142
4387
  ** are pending, then the results are undefined.
4143
4388
  **
4389
+ ** The first six interfaces (_blob, _double, _int, _int64, _text, and _text16)
4390
+ ** each return the value of a result column in a specific data format. If
4391
+ ** the result column is not initially in the requested format (for example,
4392
+ ** if the query returns an integer but the sqlite3_column_text() interface
4393
+ ** is used to extract the value) then an automatic type conversion is performed.
4394
+ **
4144
4395
  ** ^The sqlite3_column_type() routine returns the
4145
4396
  ** [SQLITE_INTEGER | datatype code] for the initial data type
4146
4397
  ** of the result column. ^The returned value is one of [SQLITE_INTEGER],
4147
- ** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL]. The value
4148
- ** returned by sqlite3_column_type() is only meaningful if no type
4149
- ** conversions have occurred as described below. After a type conversion,
4150
- ** the value returned by sqlite3_column_type() is undefined. Future
4398
+ ** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].
4399
+ ** The return value of sqlite3_column_type() can be used to decide which
4400
+ ** of the first six interface should be used to extract the column value.
4401
+ ** The value returned by sqlite3_column_type() is only meaningful if no
4402
+ ** automatic type conversions have occurred for the value in question.
4403
+ ** After a type conversion, the result of calling sqlite3_column_type()
4404
+ ** is undefined, though harmless. Future
4151
4405
  ** versions of SQLite may change the behavior of sqlite3_column_type()
4152
4406
  ** following a type conversion.
4153
4407
  **
4408
+ ** If the result is a BLOB or a TEXT string, then the sqlite3_column_bytes()
4409
+ ** or sqlite3_column_bytes16() interfaces can be used to determine the size
4410
+ ** of that BLOB or string.
4411
+ **
4154
4412
  ** ^If the result is a BLOB or UTF-8 string then the sqlite3_column_bytes()
4155
4413
  ** routine returns the number of bytes in that BLOB or string.
4156
4414
  ** ^If the result is a UTF-16 string, then sqlite3_column_bytes() converts
@@ -4187,9 +4445,13 @@ SQLITE_API int SQLITE_STDCALL sqlite3_data_count(sqlite3_stmt *pStmt);
4187
4445
  ** [sqlite3_column_value()] is used in any other way, including calls
4188
4446
  ** to routines like [sqlite3_value_int()], [sqlite3_value_text()],
4189
4447
  ** or [sqlite3_value_bytes()], the behavior is not threadsafe.
4448
+ ** Hence, the sqlite3_column_value() interface
4449
+ ** is normally only useful within the implementation of
4450
+ ** [application-defined SQL functions] or [virtual tables], not within
4451
+ ** top-level application code.
4190
4452
  **
4191
- ** These routines attempt to convert the value where appropriate. ^For
4192
- ** example, if the internal representation is FLOAT and a text result
4453
+ ** The these routines may attempt to convert the datatype of the result.
4454
+ ** ^For example, if the internal representation is FLOAT and a text result
4193
4455
  ** is requested, [sqlite3_snprintf()] is used internally to perform the
4194
4456
  ** conversion automatically. ^(The following table details the conversions
4195
4457
  ** that are applied:
@@ -4261,7 +4523,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_data_count(sqlite3_stmt *pStmt);
4261
4523
  ** ^The pointers returned are valid until a type conversion occurs as
4262
4524
  ** described above, or until [sqlite3_step()] or [sqlite3_reset()] or
4263
4525
  ** [sqlite3_finalize()] is called. ^The memory space used to hold strings
4264
- ** and BLOBs is freed automatically. Do <em>not</em> pass the pointers returned
4526
+ ** and BLOBs is freed automatically. Do not pass the pointers returned
4265
4527
  ** from [sqlite3_column_blob()], [sqlite3_column_text()], etc. into
4266
4528
  ** [sqlite3_free()].
4267
4529
  **
@@ -4271,16 +4533,16 @@ SQLITE_API int SQLITE_STDCALL sqlite3_data_count(sqlite3_stmt *pStmt);
4271
4533
  ** pointer. Subsequent calls to [sqlite3_errcode()] will return
4272
4534
  ** [SQLITE_NOMEM].)^
4273
4535
  */
4274
- SQLITE_API const void *SQLITE_STDCALL sqlite3_column_blob(sqlite3_stmt*, int iCol);
4275
- SQLITE_API int SQLITE_STDCALL sqlite3_column_bytes(sqlite3_stmt*, int iCol);
4276
- SQLITE_API int SQLITE_STDCALL sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
4277
- SQLITE_API double SQLITE_STDCALL sqlite3_column_double(sqlite3_stmt*, int iCol);
4278
- SQLITE_API int SQLITE_STDCALL sqlite3_column_int(sqlite3_stmt*, int iCol);
4279
- SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_column_int64(sqlite3_stmt*, int iCol);
4280
- SQLITE_API const unsigned char *SQLITE_STDCALL sqlite3_column_text(sqlite3_stmt*, int iCol);
4281
- SQLITE_API const void *SQLITE_STDCALL sqlite3_column_text16(sqlite3_stmt*, int iCol);
4282
- SQLITE_API int SQLITE_STDCALL sqlite3_column_type(sqlite3_stmt*, int iCol);
4283
- SQLITE_API sqlite3_value *SQLITE_STDCALL sqlite3_column_value(sqlite3_stmt*, int iCol);
4536
+ SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol);
4537
+ SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol);
4538
+ SQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol);
4539
+ SQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol);
4540
+ SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol);
4541
+ SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt*, int iCol);
4542
+ SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol);
4543
+ SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
4544
+ SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
4545
+ SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol);
4284
4546
 
4285
4547
  /*
4286
4548
  ** CAPI3REF: Destroy A Prepared Statement Object
@@ -4308,7 +4570,7 @@ SQLITE_API sqlite3_value *SQLITE_STDCALL sqlite3_column_value(sqlite3_stmt*, int
4308
4570
  ** statement after it has been finalized can result in undefined and
4309
4571
  ** undesirable behavior such as segfaults and heap corruption.
4310
4572
  */
4311
- SQLITE_API int SQLITE_STDCALL sqlite3_finalize(sqlite3_stmt *pStmt);
4573
+ SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt);
4312
4574
 
4313
4575
  /*
4314
4576
  ** CAPI3REF: Reset A Prepared Statement Object
@@ -4335,7 +4597,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_finalize(sqlite3_stmt *pStmt);
4335
4597
  ** ^The [sqlite3_reset(S)] interface does not change the values
4336
4598
  ** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S.
4337
4599
  */
4338
- SQLITE_API int SQLITE_STDCALL sqlite3_reset(sqlite3_stmt *pStmt);
4600
+ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
4339
4601
 
4340
4602
  /*
4341
4603
  ** CAPI3REF: Create Or Redefine SQL Functions
@@ -4435,7 +4697,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_reset(sqlite3_stmt *pStmt);
4435
4697
  ** close the database connection nor finalize or reset the prepared
4436
4698
  ** statement in which the function is running.
4437
4699
  */
4438
- SQLITE_API int SQLITE_STDCALL sqlite3_create_function(
4700
+ SQLITE_API int sqlite3_create_function(
4439
4701
  sqlite3 *db,
4440
4702
  const char *zFunctionName,
4441
4703
  int nArg,
@@ -4445,7 +4707,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_create_function(
4445
4707
  void (*xStep)(sqlite3_context*,int,sqlite3_value**),
4446
4708
  void (*xFinal)(sqlite3_context*)
4447
4709
  );
4448
- SQLITE_API int SQLITE_STDCALL sqlite3_create_function16(
4710
+ SQLITE_API int sqlite3_create_function16(
4449
4711
  sqlite3 *db,
4450
4712
  const void *zFunctionName,
4451
4713
  int nArg,
@@ -4455,7 +4717,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_create_function16(
4455
4717
  void (*xStep)(sqlite3_context*,int,sqlite3_value**),
4456
4718
  void (*xFinal)(sqlite3_context*)
4457
4719
  );
4458
- SQLITE_API int SQLITE_STDCALL sqlite3_create_function_v2(
4720
+ SQLITE_API int sqlite3_create_function_v2(
4459
4721
  sqlite3 *db,
4460
4722
  const char *zFunctionName,
4461
4723
  int nArg,
@@ -4501,12 +4763,12 @@ SQLITE_API int SQLITE_STDCALL sqlite3_create_function_v2(
4501
4763
  ** these functions, we will not explain what they do.
4502
4764
  */
4503
4765
  #ifndef SQLITE_OMIT_DEPRECATED
4504
- SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_aggregate_count(sqlite3_context*);
4505
- SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_expired(sqlite3_stmt*);
4506
- SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*);
4507
- SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_global_recover(void);
4508
- SQLITE_API SQLITE_DEPRECATED void SQLITE_STDCALL sqlite3_thread_cleanup(void);
4509
- SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),
4766
+ SQLITE_API SQLITE_DEPRECATED int sqlite3_aggregate_count(sqlite3_context*);
4767
+ SQLITE_API SQLITE_DEPRECATED int sqlite3_expired(sqlite3_stmt*);
4768
+ SQLITE_API SQLITE_DEPRECATED int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*);
4769
+ SQLITE_API SQLITE_DEPRECATED int sqlite3_global_recover(void);
4770
+ SQLITE_API SQLITE_DEPRECATED void sqlite3_thread_cleanup(void);
4771
+ SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),
4510
4772
  void*,sqlite3_int64);
4511
4773
  #endif
4512
4774
 
@@ -4514,21 +4776,43 @@ SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_memory_alarm(void(*)(voi
4514
4776
  ** CAPI3REF: Obtaining SQL Values
4515
4777
  ** METHOD: sqlite3_value
4516
4778
  **
4517
- ** The C-language implementation of SQL functions and aggregates uses
4518
- ** this set of interface routines to access the parameter values on
4519
- ** the function or aggregate.
4520
- **
4521
- ** The xFunc (for scalar functions) or xStep (for aggregates) parameters
4522
- ** to [sqlite3_create_function()] and [sqlite3_create_function16()]
4523
- ** define callbacks that implement the SQL functions and aggregates.
4524
- ** The 3rd parameter to these callbacks is an array of pointers to
4525
- ** [protected sqlite3_value] objects. There is one [sqlite3_value] object for
4526
- ** each parameter to the SQL function. These routines are used to
4527
- ** extract values from the [sqlite3_value] objects.
4779
+ ** <b>Summary:</b>
4780
+ ** <blockquote><table border=0 cellpadding=0 cellspacing=0>
4781
+ ** <tr><td><b>sqlite3_value_blob</b><td>&rarr;<td>BLOB value
4782
+ ** <tr><td><b>sqlite3_value_double</b><td>&rarr;<td>REAL value
4783
+ ** <tr><td><b>sqlite3_value_int</b><td>&rarr;<td>32-bit INTEGER value
4784
+ ** <tr><td><b>sqlite3_value_int64</b><td>&rarr;<td>64-bit INTEGER value
4785
+ ** <tr><td><b>sqlite3_value_pointer</b><td>&rarr;<td>Pointer value
4786
+ ** <tr><td><b>sqlite3_value_text</b><td>&rarr;<td>UTF-8 TEXT value
4787
+ ** <tr><td><b>sqlite3_value_text16</b><td>&rarr;<td>UTF-16 TEXT value in
4788
+ ** the native byteorder
4789
+ ** <tr><td><b>sqlite3_value_text16be</b><td>&rarr;<td>UTF-16be TEXT value
4790
+ ** <tr><td><b>sqlite3_value_text16le</b><td>&rarr;<td>UTF-16le TEXT value
4791
+ ** <tr><td>&nbsp;<td>&nbsp;<td>&nbsp;
4792
+ ** <tr><td><b>sqlite3_value_bytes</b><td>&rarr;<td>Size of a BLOB
4793
+ ** or a UTF-8 TEXT in bytes
4794
+ ** <tr><td><b>sqlite3_value_bytes16&nbsp;&nbsp;</b>
4795
+ ** <td>&rarr;&nbsp;&nbsp;<td>Size of UTF-16
4796
+ ** TEXT in bytes
4797
+ ** <tr><td><b>sqlite3_value_type</b><td>&rarr;<td>Default
4798
+ ** datatype of the value
4799
+ ** <tr><td><b>sqlite3_value_numeric_type&nbsp;&nbsp;</b>
4800
+ ** <td>&rarr;&nbsp;&nbsp;<td>Best numeric datatype of the value
4801
+ ** <tr><td><b>sqlite3_value_nochange&nbsp;&nbsp;</b>
4802
+ ** <td>&rarr;&nbsp;&nbsp;<td>True if the column is unchanged in an UPDATE
4803
+ ** against a virtual table.
4804
+ ** </table></blockquote>
4805
+ **
4806
+ ** <b>Details:</b>
4807
+ **
4808
+ ** These routines extract type, size, and content information from
4809
+ ** [protected sqlite3_value] objects. Protected sqlite3_value objects
4810
+ ** are used to pass parameter information into implementation of
4811
+ ** [application-defined SQL functions] and [virtual tables].
4528
4812
  **
4529
4813
  ** These routines work only with [protected sqlite3_value] objects.
4530
4814
  ** Any attempt to use these routines on an [unprotected sqlite3_value]
4531
- ** object results in undefined behavior.
4815
+ ** is not threadsafe.
4532
4816
  **
4533
4817
  ** ^These routines work just like the corresponding [column access functions]
4534
4818
  ** except that these routines take a single [protected sqlite3_value] object
@@ -4539,6 +4823,24 @@ SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_memory_alarm(void(*)(voi
4539
4823
  ** sqlite3_value_text16be() and sqlite3_value_text16le() interfaces
4540
4824
  ** extract UTF-16 strings as big-endian and little-endian respectively.
4541
4825
  **
4826
+ ** ^If [sqlite3_value] object V was initialized
4827
+ ** using [sqlite3_bind_pointer(S,I,P,X,D)] or [sqlite3_result_pointer(C,P,X,D)]
4828
+ ** and if X and Y are strings that compare equal according to strcmp(X,Y),
4829
+ ** then sqlite3_value_pointer(V,Y) will return the pointer P. ^Otherwise,
4830
+ ** sqlite3_value_pointer(V,Y) returns a NULL. The sqlite3_bind_pointer()
4831
+ ** routine is part of the [pointer passing interface] added for SQLite 3.20.0.
4832
+ **
4833
+ ** ^(The sqlite3_value_type(V) interface returns the
4834
+ ** [SQLITE_INTEGER | datatype code] for the initial datatype of the
4835
+ ** [sqlite3_value] object V. The returned value is one of [SQLITE_INTEGER],
4836
+ ** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].)^
4837
+ ** Other interfaces might change the datatype for an sqlite3_value object.
4838
+ ** For example, if the datatype is initially SQLITE_INTEGER and
4839
+ ** sqlite3_value_text(V) is called to extract a text value for that
4840
+ ** integer, then subsequent calls to sqlite3_value_type(V) might return
4841
+ ** SQLITE_TEXT. Whether or not a persistent internal datatype conversion
4842
+ ** occurs is undefined and may change from one release of SQLite to the next.
4843
+ **
4542
4844
  ** ^(The sqlite3_value_numeric_type() interface attempts to apply
4543
4845
  ** numeric affinity to the value. This means that an attempt is
4544
4846
  ** made to convert the value to an integer or floating point. If
@@ -4547,6 +4849,19 @@ SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_memory_alarm(void(*)(voi
4547
4849
  ** then the conversion is performed. Otherwise no conversion occurs.
4548
4850
  ** The [SQLITE_INTEGER | datatype] after conversion is returned.)^
4549
4851
  **
4852
+ ** ^Within the [xUpdate] method of a [virtual table], the
4853
+ ** sqlite3_value_nochange(X) interface returns true if and only if
4854
+ ** the column corresponding to X is unchanged by the UPDATE operation
4855
+ ** that the xUpdate method call was invoked to implement and if
4856
+ ** and the prior [xColumn] method call that was invoked to extracted
4857
+ ** the value for that column returned without setting a result (probably
4858
+ ** because it queried [sqlite3_vtab_nochange()] and found that the column
4859
+ ** was unchanging). ^Within an [xUpdate] method, any value for which
4860
+ ** sqlite3_value_nochange(X) is true will in all other respects appear
4861
+ ** to be a NULL value. If sqlite3_value_nochange(X) is invoked anywhere other
4862
+ ** than within an [xUpdate] method call for an UPDATE statement, then
4863
+ ** the return value is arbitrary and meaningless.
4864
+ **
4550
4865
  ** Please pay particular attention to the fact that the pointer returned
4551
4866
  ** from [sqlite3_value_blob()], [sqlite3_value_text()], or
4552
4867
  ** [sqlite3_value_text16()] can be invalidated by a subsequent call to
@@ -4556,18 +4871,20 @@ SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_memory_alarm(void(*)(voi
4556
4871
  ** These routines must be called from the same thread as
4557
4872
  ** the SQL function that supplied the [sqlite3_value*] parameters.
4558
4873
  */
4559
- SQLITE_API const void *SQLITE_STDCALL sqlite3_value_blob(sqlite3_value*);
4560
- SQLITE_API int SQLITE_STDCALL sqlite3_value_bytes(sqlite3_value*);
4561
- SQLITE_API int SQLITE_STDCALL sqlite3_value_bytes16(sqlite3_value*);
4562
- SQLITE_API double SQLITE_STDCALL sqlite3_value_double(sqlite3_value*);
4563
- SQLITE_API int SQLITE_STDCALL sqlite3_value_int(sqlite3_value*);
4564
- SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_value_int64(sqlite3_value*);
4565
- SQLITE_API const unsigned char *SQLITE_STDCALL sqlite3_value_text(sqlite3_value*);
4566
- SQLITE_API const void *SQLITE_STDCALL sqlite3_value_text16(sqlite3_value*);
4567
- SQLITE_API const void *SQLITE_STDCALL sqlite3_value_text16le(sqlite3_value*);
4568
- SQLITE_API const void *SQLITE_STDCALL sqlite3_value_text16be(sqlite3_value*);
4569
- SQLITE_API int SQLITE_STDCALL sqlite3_value_type(sqlite3_value*);
4570
- SQLITE_API int SQLITE_STDCALL sqlite3_value_numeric_type(sqlite3_value*);
4874
+ SQLITE_API const void *sqlite3_value_blob(sqlite3_value*);
4875
+ SQLITE_API double sqlite3_value_double(sqlite3_value*);
4876
+ SQLITE_API int sqlite3_value_int(sqlite3_value*);
4877
+ SQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*);
4878
+ SQLITE_API void *sqlite3_value_pointer(sqlite3_value*, const char*);
4879
+ SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value*);
4880
+ SQLITE_API const void *sqlite3_value_text16(sqlite3_value*);
4881
+ SQLITE_API const void *sqlite3_value_text16le(sqlite3_value*);
4882
+ SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*);
4883
+ SQLITE_API int sqlite3_value_bytes(sqlite3_value*);
4884
+ SQLITE_API int sqlite3_value_bytes16(sqlite3_value*);
4885
+ SQLITE_API int sqlite3_value_type(sqlite3_value*);
4886
+ SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);
4887
+ SQLITE_API int sqlite3_value_nochange(sqlite3_value*);
4571
4888
 
4572
4889
  /*
4573
4890
  ** CAPI3REF: Finding The Subtype Of SQL Values
@@ -4578,12 +4895,8 @@ SQLITE_API int SQLITE_STDCALL sqlite3_value_numeric_type(sqlite3_value*);
4578
4895
  ** information can be used to pass a limited amount of context from
4579
4896
  ** one SQL function to another. Use the [sqlite3_result_subtype()]
4580
4897
  ** routine to set the subtype for the return value of an SQL function.
4581
- **
4582
- ** SQLite makes no use of subtype itself. It merely passes the subtype
4583
- ** from the result of one [application-defined SQL function] into the
4584
- ** input of another.
4585
4898
  */
4586
- SQLITE_API unsigned int SQLITE_STDCALL sqlite3_value_subtype(sqlite3_value*);
4899
+ SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value*);
4587
4900
 
4588
4901
  /*
4589
4902
  ** CAPI3REF: Copy And Free SQL Values
@@ -4599,8 +4912,8 @@ SQLITE_API unsigned int SQLITE_STDCALL sqlite3_value_subtype(sqlite3_value*);
4599
4912
  ** previously obtained from [sqlite3_value_dup()]. ^If V is a NULL pointer
4600
4913
  ** then sqlite3_value_free(V) is a harmless no-op.
4601
4914
  */
4602
- SQLITE_API sqlite3_value *SQLITE_STDCALL sqlite3_value_dup(const sqlite3_value*);
4603
- SQLITE_API void SQLITE_STDCALL sqlite3_value_free(sqlite3_value*);
4915
+ SQLITE_API sqlite3_value *sqlite3_value_dup(const sqlite3_value*);
4916
+ SQLITE_API void sqlite3_value_free(sqlite3_value*);
4604
4917
 
4605
4918
  /*
4606
4919
  ** CAPI3REF: Obtain Aggregate Function Context
@@ -4645,7 +4958,7 @@ SQLITE_API void SQLITE_STDCALL sqlite3_value_free(sqlite3_value*);
4645
4958
  ** This routine must be called from the same thread in which
4646
4959
  ** the aggregate SQL function is running.
4647
4960
  */
4648
- SQLITE_API void *SQLITE_STDCALL sqlite3_aggregate_context(sqlite3_context*, int nBytes);
4961
+ SQLITE_API void *sqlite3_aggregate_context(sqlite3_context*, int nBytes);
4649
4962
 
4650
4963
  /*
4651
4964
  ** CAPI3REF: User Data For Functions
@@ -4660,7 +4973,7 @@ SQLITE_API void *SQLITE_STDCALL sqlite3_aggregate_context(sqlite3_context*, int
4660
4973
  ** This routine must be called from the same thread in which
4661
4974
  ** the application-defined function is running.
4662
4975
  */
4663
- SQLITE_API void *SQLITE_STDCALL sqlite3_user_data(sqlite3_context*);
4976
+ SQLITE_API void *sqlite3_user_data(sqlite3_context*);
4664
4977
 
4665
4978
  /*
4666
4979
  ** CAPI3REF: Database Connection For Functions
@@ -4672,7 +4985,7 @@ SQLITE_API void *SQLITE_STDCALL sqlite3_user_data(sqlite3_context*);
4672
4985
  ** and [sqlite3_create_function16()] routines that originally
4673
4986
  ** registered the application defined function.
4674
4987
  */
4675
- SQLITE_API sqlite3 *SQLITE_STDCALL sqlite3_context_db_handle(sqlite3_context*);
4988
+ SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*);
4676
4989
 
4677
4990
  /*
4678
4991
  ** CAPI3REF: Function Auxiliary Data
@@ -4689,10 +5002,11 @@ SQLITE_API sqlite3 *SQLITE_STDCALL sqlite3_context_db_handle(sqlite3_context*);
4689
5002
  ** the compiled regular expression can be reused on multiple
4690
5003
  ** invocations of the same function.
4691
5004
  **
4692
- ** ^The sqlite3_get_auxdata() interface returns a pointer to the metadata
4693
- ** associated by the sqlite3_set_auxdata() function with the Nth argument
4694
- ** value to the application-defined function. ^If there is no metadata
4695
- ** associated with the function argument, this sqlite3_get_auxdata() interface
5005
+ ** ^The sqlite3_get_auxdata(C,N) interface returns a pointer to the metadata
5006
+ ** associated by the sqlite3_set_auxdata(C,N,P,X) function with the Nth argument
5007
+ ** value to the application-defined function. ^N is zero for the left-most
5008
+ ** function argument. ^If there is no metadata
5009
+ ** associated with the function argument, the sqlite3_get_auxdata(C,N) interface
4696
5010
  ** returns a NULL pointer.
4697
5011
  **
4698
5012
  ** ^The sqlite3_set_auxdata(C,N,P,X) interface saves P as metadata for the N-th
@@ -4723,11 +5037,15 @@ SQLITE_API sqlite3 *SQLITE_STDCALL sqlite3_context_db_handle(sqlite3_context*);
4723
5037
  ** function parameters that are compile-time constants, including literal
4724
5038
  ** values and [parameters] and expressions composed from the same.)^
4725
5039
  **
5040
+ ** The value of the N parameter to these interfaces should be non-negative.
5041
+ ** Future enhancements may make use of negative N values to define new
5042
+ ** kinds of function caching behavior.
5043
+ **
4726
5044
  ** These routines must be called from the same thread in which
4727
5045
  ** the SQL function is running.
4728
5046
  */
4729
- SQLITE_API void *SQLITE_STDCALL sqlite3_get_auxdata(sqlite3_context*, int N);
4730
- SQLITE_API void SQLITE_STDCALL sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*));
5047
+ SQLITE_API void *sqlite3_get_auxdata(sqlite3_context*, int N);
5048
+ SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*));
4731
5049
 
4732
5050
 
4733
5051
  /*
@@ -4846,7 +5164,7 @@ typedef void (*sqlite3_destructor_type)(void*);
4846
5164
  ** when it has finished using that result.
4847
5165
  ** ^If the 4th parameter to the sqlite3_result_text* interfaces
4848
5166
  ** or sqlite3_result_blob is the special constant SQLITE_TRANSIENT
4849
- ** then SQLite makes a copy of the result into space obtained from
5167
+ ** then SQLite makes a copy of the result into space obtained
4850
5168
  ** from [sqlite3_malloc()] before it returns.
4851
5169
  **
4852
5170
  ** ^The sqlite3_result_value() interface sets the result of
@@ -4859,31 +5177,43 @@ typedef void (*sqlite3_destructor_type)(void*);
4859
5177
  ** [unprotected sqlite3_value] object is required, so either
4860
5178
  ** kind of [sqlite3_value] object can be used with this interface.
4861
5179
  **
5180
+ ** ^The sqlite3_result_pointer(C,P,T,D) interface sets the result to an
5181
+ ** SQL NULL value, just like [sqlite3_result_null(C)], except that it
5182
+ ** also associates the host-language pointer P or type T with that
5183
+ ** NULL value such that the pointer can be retrieved within an
5184
+ ** [application-defined SQL function] using [sqlite3_value_pointer()].
5185
+ ** ^If the D parameter is not NULL, then it is a pointer to a destructor
5186
+ ** for the P parameter. ^SQLite invokes D with P as its only argument
5187
+ ** when SQLite is finished with P. The T parameter should be a static
5188
+ ** string and preferably a string literal. The sqlite3_result_pointer()
5189
+ ** routine is part of the [pointer passing interface] added for SQLite 3.20.0.
5190
+ **
4862
5191
  ** If these routines are called from within the different thread
4863
5192
  ** than the one containing the application-defined function that received
4864
5193
  ** the [sqlite3_context] pointer, the results are undefined.
4865
5194
  */
4866
- SQLITE_API void SQLITE_STDCALL sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));
4867
- SQLITE_API void SQLITE_STDCALL sqlite3_result_blob64(sqlite3_context*,const void*,
5195
+ SQLITE_API void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));
5196
+ SQLITE_API void sqlite3_result_blob64(sqlite3_context*,const void*,
4868
5197
  sqlite3_uint64,void(*)(void*));
4869
- SQLITE_API void SQLITE_STDCALL sqlite3_result_double(sqlite3_context*, double);
4870
- SQLITE_API void SQLITE_STDCALL sqlite3_result_error(sqlite3_context*, const char*, int);
4871
- SQLITE_API void SQLITE_STDCALL sqlite3_result_error16(sqlite3_context*, const void*, int);
4872
- SQLITE_API void SQLITE_STDCALL sqlite3_result_error_toobig(sqlite3_context*);
4873
- SQLITE_API void SQLITE_STDCALL sqlite3_result_error_nomem(sqlite3_context*);
4874
- SQLITE_API void SQLITE_STDCALL sqlite3_result_error_code(sqlite3_context*, int);
4875
- SQLITE_API void SQLITE_STDCALL sqlite3_result_int(sqlite3_context*, int);
4876
- SQLITE_API void SQLITE_STDCALL sqlite3_result_int64(sqlite3_context*, sqlite3_int64);
4877
- SQLITE_API void SQLITE_STDCALL sqlite3_result_null(sqlite3_context*);
4878
- SQLITE_API void SQLITE_STDCALL sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*));
4879
- SQLITE_API void SQLITE_STDCALL sqlite3_result_text64(sqlite3_context*, const char*,sqlite3_uint64,
5198
+ SQLITE_API void sqlite3_result_double(sqlite3_context*, double);
5199
+ SQLITE_API void sqlite3_result_error(sqlite3_context*, const char*, int);
5200
+ SQLITE_API void sqlite3_result_error16(sqlite3_context*, const void*, int);
5201
+ SQLITE_API void sqlite3_result_error_toobig(sqlite3_context*);
5202
+ SQLITE_API void sqlite3_result_error_nomem(sqlite3_context*);
5203
+ SQLITE_API void sqlite3_result_error_code(sqlite3_context*, int);
5204
+ SQLITE_API void sqlite3_result_int(sqlite3_context*, int);
5205
+ SQLITE_API void sqlite3_result_int64(sqlite3_context*, sqlite3_int64);
5206
+ SQLITE_API void sqlite3_result_null(sqlite3_context*);
5207
+ SQLITE_API void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*));
5208
+ SQLITE_API void sqlite3_result_text64(sqlite3_context*, const char*,sqlite3_uint64,
4880
5209
  void(*)(void*), unsigned char encoding);
4881
- SQLITE_API void SQLITE_STDCALL sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*));
4882
- SQLITE_API void SQLITE_STDCALL sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));
4883
- SQLITE_API void SQLITE_STDCALL sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*));
4884
- SQLITE_API void SQLITE_STDCALL sqlite3_result_value(sqlite3_context*, sqlite3_value*);
4885
- SQLITE_API void SQLITE_STDCALL sqlite3_result_zeroblob(sqlite3_context*, int n);
4886
- SQLITE_API int SQLITE_STDCALL sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n);
5210
+ SQLITE_API void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*));
5211
+ SQLITE_API void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));
5212
+ SQLITE_API void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*));
5213
+ SQLITE_API void sqlite3_result_value(sqlite3_context*, sqlite3_value*);
5214
+ SQLITE_API void sqlite3_result_pointer(sqlite3_context*, void*,const char*,void(*)(void*));
5215
+ SQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n);
5216
+ SQLITE_API int sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n);
4887
5217
 
4888
5218
 
4889
5219
  /*
@@ -4898,7 +5228,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_result_zeroblob64(sqlite3_context*, sqlite
4898
5228
  ** The number of subtype bytes preserved by SQLite might increase
4899
5229
  ** in future releases of SQLite.
4900
5230
  */
4901
- SQLITE_API void SQLITE_STDCALL sqlite3_result_subtype(sqlite3_context*,unsigned int);
5231
+ SQLITE_API void sqlite3_result_subtype(sqlite3_context*,unsigned int);
4902
5232
 
4903
5233
  /*
4904
5234
  ** CAPI3REF: Define New Collating Sequences
@@ -4980,14 +5310,14 @@ SQLITE_API void SQLITE_STDCALL sqlite3_result_subtype(sqlite3_context*,unsigned
4980
5310
  **
4981
5311
  ** See also: [sqlite3_collation_needed()] and [sqlite3_collation_needed16()].
4982
5312
  */
4983
- SQLITE_API int SQLITE_STDCALL sqlite3_create_collation(
5313
+ SQLITE_API int sqlite3_create_collation(
4984
5314
  sqlite3*,
4985
5315
  const char *zName,
4986
5316
  int eTextRep,
4987
5317
  void *pArg,
4988
5318
  int(*xCompare)(void*,int,const void*,int,const void*)
4989
5319
  );
4990
- SQLITE_API int SQLITE_STDCALL sqlite3_create_collation_v2(
5320
+ SQLITE_API int sqlite3_create_collation_v2(
4991
5321
  sqlite3*,
4992
5322
  const char *zName,
4993
5323
  int eTextRep,
@@ -4995,7 +5325,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_create_collation_v2(
4995
5325
  int(*xCompare)(void*,int,const void*,int,const void*),
4996
5326
  void(*xDestroy)(void*)
4997
5327
  );
4998
- SQLITE_API int SQLITE_STDCALL sqlite3_create_collation16(
5328
+ SQLITE_API int sqlite3_create_collation16(
4999
5329
  sqlite3*,
5000
5330
  const void *zName,
5001
5331
  int eTextRep,
@@ -5030,12 +5360,12 @@ SQLITE_API int SQLITE_STDCALL sqlite3_create_collation16(
5030
5360
  ** [sqlite3_create_collation()], [sqlite3_create_collation16()], or
5031
5361
  ** [sqlite3_create_collation_v2()].
5032
5362
  */
5033
- SQLITE_API int SQLITE_STDCALL sqlite3_collation_needed(
5363
+ SQLITE_API int sqlite3_collation_needed(
5034
5364
  sqlite3*,
5035
5365
  void*,
5036
5366
  void(*)(void*,sqlite3*,int eTextRep,const char*)
5037
5367
  );
5038
- SQLITE_API int SQLITE_STDCALL sqlite3_collation_needed16(
5368
+ SQLITE_API int sqlite3_collation_needed16(
5039
5369
  sqlite3*,
5040
5370
  void*,
5041
5371
  void(*)(void*,sqlite3*,int eTextRep,const void*)
@@ -5049,11 +5379,11 @@ SQLITE_API int SQLITE_STDCALL sqlite3_collation_needed16(
5049
5379
  ** The code to implement this API is not available in the public release
5050
5380
  ** of SQLite.
5051
5381
  */
5052
- SQLITE_API int SQLITE_STDCALL sqlite3_key(
5382
+ SQLITE_API int sqlite3_key(
5053
5383
  sqlite3 *db, /* Database to be rekeyed */
5054
5384
  const void *pKey, int nKey /* The key */
5055
5385
  );
5056
- SQLITE_API int SQLITE_STDCALL sqlite3_key_v2(
5386
+ SQLITE_API int sqlite3_key_v2(
5057
5387
  sqlite3 *db, /* Database to be rekeyed */
5058
5388
  const char *zDbName, /* Name of the database */
5059
5389
  const void *pKey, int nKey /* The key */
@@ -5067,11 +5397,11 @@ SQLITE_API int SQLITE_STDCALL sqlite3_key_v2(
5067
5397
  ** The code to implement this API is not available in the public release
5068
5398
  ** of SQLite.
5069
5399
  */
5070
- SQLITE_API int SQLITE_STDCALL sqlite3_rekey(
5400
+ SQLITE_API int sqlite3_rekey(
5071
5401
  sqlite3 *db, /* Database to be rekeyed */
5072
5402
  const void *pKey, int nKey /* The new key */
5073
5403
  );
5074
- SQLITE_API int SQLITE_STDCALL sqlite3_rekey_v2(
5404
+ SQLITE_API int sqlite3_rekey_v2(
5075
5405
  sqlite3 *db, /* Database to be rekeyed */
5076
5406
  const char *zDbName, /* Name of the database */
5077
5407
  const void *pKey, int nKey /* The new key */
@@ -5081,7 +5411,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_rekey_v2(
5081
5411
  ** Specify the activation key for a SEE database. Unless
5082
5412
  ** activated, none of the SEE routines will work.
5083
5413
  */
5084
- SQLITE_API void SQLITE_STDCALL sqlite3_activate_see(
5414
+ SQLITE_API void sqlite3_activate_see(
5085
5415
  const char *zPassPhrase /* Activation phrase */
5086
5416
  );
5087
5417
  #endif
@@ -5091,7 +5421,7 @@ SQLITE_API void SQLITE_STDCALL sqlite3_activate_see(
5091
5421
  ** Specify the activation key for a CEROD database. Unless
5092
5422
  ** activated, none of the CEROD routines will work.
5093
5423
  */
5094
- SQLITE_API void SQLITE_STDCALL sqlite3_activate_cerod(
5424
+ SQLITE_API void sqlite3_activate_cerod(
5095
5425
  const char *zPassPhrase /* Activation phrase */
5096
5426
  );
5097
5427
  #endif
@@ -5113,7 +5443,7 @@ SQLITE_API void SQLITE_STDCALL sqlite3_activate_cerod(
5113
5443
  ** all, then the behavior of sqlite3_sleep() may deviate from the description
5114
5444
  ** in the previous paragraphs.
5115
5445
  */
5116
- SQLITE_API int SQLITE_STDCALL sqlite3_sleep(int);
5446
+ SQLITE_API int sqlite3_sleep(int);
5117
5447
 
5118
5448
  /*
5119
5449
  ** CAPI3REF: Name Of The Folder Holding Temporary Files
@@ -5232,7 +5562,7 @@ SQLITE_API SQLITE_EXTERN char *sqlite3_data_directory;
5232
5562
  ** connection while this routine is running, then the return value
5233
5563
  ** is undefined.
5234
5564
  */
5235
- SQLITE_API int SQLITE_STDCALL sqlite3_get_autocommit(sqlite3*);
5565
+ SQLITE_API int sqlite3_get_autocommit(sqlite3*);
5236
5566
 
5237
5567
  /*
5238
5568
  ** CAPI3REF: Find The Database Handle Of A Prepared Statement
@@ -5245,7 +5575,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_get_autocommit(sqlite3*);
5245
5575
  ** to the [sqlite3_prepare_v2()] call (or its variants) that was used to
5246
5576
  ** create the statement in the first place.
5247
5577
  */
5248
- SQLITE_API sqlite3 *SQLITE_STDCALL sqlite3_db_handle(sqlite3_stmt*);
5578
+ SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*);
5249
5579
 
5250
5580
  /*
5251
5581
  ** CAPI3REF: Return The Filename For A Database Connection
@@ -5262,7 +5592,7 @@ SQLITE_API sqlite3 *SQLITE_STDCALL sqlite3_db_handle(sqlite3_stmt*);
5262
5592
  ** will be an absolute pathname, even if the filename used
5263
5593
  ** to open the database originally was a URI or relative pathname.
5264
5594
  */
5265
- SQLITE_API const char *SQLITE_STDCALL sqlite3_db_filename(sqlite3 *db, const char *zDbName);
5595
+ SQLITE_API const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName);
5266
5596
 
5267
5597
  /*
5268
5598
  ** CAPI3REF: Determine if a database is read-only
@@ -5272,7 +5602,7 @@ SQLITE_API const char *SQLITE_STDCALL sqlite3_db_filename(sqlite3 *db, const cha
5272
5602
  ** of connection D is read-only, 0 if it is read/write, or -1 if N is not
5273
5603
  ** the name of a database on connection D.
5274
5604
  */
5275
- SQLITE_API int SQLITE_STDCALL sqlite3_db_readonly(sqlite3 *db, const char *zDbName);
5605
+ SQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName);
5276
5606
 
5277
5607
  /*
5278
5608
  ** CAPI3REF: Find the next prepared statement
@@ -5288,7 +5618,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_db_readonly(sqlite3 *db, const char *zDbNa
5288
5618
  ** [sqlite3_next_stmt(D,S)] must refer to an open database
5289
5619
  ** connection and in particular must not be a NULL pointer.
5290
5620
  */
5291
- SQLITE_API sqlite3_stmt *SQLITE_STDCALL sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt);
5621
+ SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt);
5292
5622
 
5293
5623
  /*
5294
5624
  ** CAPI3REF: Commit And Rollback Notification Callbacks
@@ -5337,8 +5667,8 @@ SQLITE_API sqlite3_stmt *SQLITE_STDCALL sqlite3_next_stmt(sqlite3 *pDb, sqlite3_
5337
5667
  **
5338
5668
  ** See also the [sqlite3_update_hook()] interface.
5339
5669
  */
5340
- SQLITE_API void *SQLITE_STDCALL sqlite3_commit_hook(sqlite3*, int(*)(void*), void*);
5341
- SQLITE_API void *SQLITE_STDCALL sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
5670
+ SQLITE_API void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*);
5671
+ SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
5342
5672
 
5343
5673
  /*
5344
5674
  ** CAPI3REF: Data Change Notification Callbacks
@@ -5368,7 +5698,7 @@ SQLITE_API void *SQLITE_STDCALL sqlite3_rollback_hook(sqlite3*, void(*)(void *),
5368
5698
  ** ^The update hook is not invoked when [WITHOUT ROWID] tables are modified.
5369
5699
  **
5370
5700
  ** ^In the current implementation, the update hook
5371
- ** is not invoked when duplication rows are deleted because of an
5701
+ ** is not invoked when conflicting rows are deleted because of an
5372
5702
  ** [ON CONFLICT | ON CONFLICT REPLACE] clause. ^Nor is the update hook
5373
5703
  ** invoked when rows are deleted using the [truncate optimization].
5374
5704
  ** The exceptions defined in this paragraph might change in a future
@@ -5389,7 +5719,7 @@ SQLITE_API void *SQLITE_STDCALL sqlite3_rollback_hook(sqlite3*, void(*)(void *),
5389
5719
  ** See also the [sqlite3_commit_hook()], [sqlite3_rollback_hook()],
5390
5720
  ** and [sqlite3_preupdate_hook()] interfaces.
5391
5721
  */
5392
- SQLITE_API void *SQLITE_STDCALL sqlite3_update_hook(
5722
+ SQLITE_API void *sqlite3_update_hook(
5393
5723
  sqlite3*,
5394
5724
  void(*)(void *,int ,char const *,char const *,sqlite3_int64),
5395
5725
  void*
@@ -5404,7 +5734,8 @@ SQLITE_API void *SQLITE_STDCALL sqlite3_update_hook(
5404
5734
  ** and disabled if the argument is false.)^
5405
5735
  **
5406
5736
  ** ^Cache sharing is enabled and disabled for an entire process.
5407
- ** This is a change as of SQLite version 3.5.0. In prior versions of SQLite,
5737
+ ** This is a change as of SQLite [version 3.5.0] ([dateof:3.5.0]).
5738
+ ** In prior versions of SQLite,
5408
5739
  ** sharing was enabled or disabled for each thread separately.
5409
5740
  **
5410
5741
  ** ^(The cache sharing mode set by this interface effects all subsequent
@@ -5429,7 +5760,7 @@ SQLITE_API void *SQLITE_STDCALL sqlite3_update_hook(
5429
5760
  **
5430
5761
  ** See Also: [SQLite Shared-Cache Mode]
5431
5762
  */
5432
- SQLITE_API int SQLITE_STDCALL sqlite3_enable_shared_cache(int);
5763
+ SQLITE_API int sqlite3_enable_shared_cache(int);
5433
5764
 
5434
5765
  /*
5435
5766
  ** CAPI3REF: Attempt To Free Heap Memory
@@ -5445,7 +5776,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_enable_shared_cache(int);
5445
5776
  **
5446
5777
  ** See also: [sqlite3_db_release_memory()]
5447
5778
  */
5448
- SQLITE_API int SQLITE_STDCALL sqlite3_release_memory(int);
5779
+ SQLITE_API int sqlite3_release_memory(int);
5449
5780
 
5450
5781
  /*
5451
5782
  ** CAPI3REF: Free Memory Used By A Database Connection
@@ -5459,7 +5790,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_release_memory(int);
5459
5790
  **
5460
5791
  ** See also: [sqlite3_release_memory()]
5461
5792
  */
5462
- SQLITE_API int SQLITE_STDCALL sqlite3_db_release_memory(sqlite3*);
5793
+ SQLITE_API int sqlite3_db_release_memory(sqlite3*);
5463
5794
 
5464
5795
  /*
5465
5796
  ** CAPI3REF: Impose A Limit On Heap Size
@@ -5498,7 +5829,8 @@ SQLITE_API int SQLITE_STDCALL sqlite3_db_release_memory(sqlite3*);
5498
5829
  ** from the heap.
5499
5830
  ** </ul>)^
5500
5831
  **
5501
- ** Beginning with SQLite version 3.7.3, the soft heap limit is enforced
5832
+ ** Beginning with SQLite [version 3.7.3] ([dateof:3.7.3]),
5833
+ ** the soft heap limit is enforced
5502
5834
  ** regardless of whether or not the [SQLITE_ENABLE_MEMORY_MANAGEMENT]
5503
5835
  ** compile-time option is invoked. With [SQLITE_ENABLE_MEMORY_MANAGEMENT],
5504
5836
  ** the soft heap limit is enforced on every memory allocation. Without
@@ -5511,7 +5843,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_db_release_memory(sqlite3*);
5511
5843
  ** The circumstances under which SQLite will enforce the soft heap limit may
5512
5844
  ** changes in future releases of SQLite.
5513
5845
  */
5514
- SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_soft_heap_limit64(sqlite3_int64 N);
5846
+ SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N);
5515
5847
 
5516
5848
  /*
5517
5849
  ** CAPI3REF: Deprecated Soft Heap Limit Interface
@@ -5522,7 +5854,7 @@ SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_soft_heap_limit64(sqlite3_int64
5522
5854
  ** only. All new applications should use the
5523
5855
  ** [sqlite3_soft_heap_limit64()] interface rather than this one.
5524
5856
  */
5525
- SQLITE_API SQLITE_DEPRECATED void SQLITE_STDCALL sqlite3_soft_heap_limit(int N);
5857
+ SQLITE_API SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N);
5526
5858
 
5527
5859
 
5528
5860
  /*
@@ -5539,7 +5871,9 @@ SQLITE_API SQLITE_DEPRECATED void SQLITE_STDCALL sqlite3_soft_heap_limit(int N);
5539
5871
  ** ^If the column-name parameter to sqlite3_table_column_metadata() is a
5540
5872
  ** NULL pointer, then this routine simply checks for the existence of the
5541
5873
  ** table and returns SQLITE_OK if the table exists and SQLITE_ERROR if it
5542
- ** does not.
5874
+ ** does not. If the table name parameter T in a call to
5875
+ ** sqlite3_table_column_metadata(X,D,T,C,...) is NULL then the result is
5876
+ ** undefined behavior.
5543
5877
  **
5544
5878
  ** ^The column is identified by the second, third and fourth parameters to
5545
5879
  ** this function. ^(The second parameter is either the name of the database
@@ -5592,7 +5926,7 @@ SQLITE_API SQLITE_DEPRECATED void SQLITE_STDCALL sqlite3_soft_heap_limit(int N);
5592
5926
  ** parsed, if that has not already been done, and returns an error if
5593
5927
  ** any errors are encountered while loading the schema.
5594
5928
  */
5595
- SQLITE_API int SQLITE_STDCALL sqlite3_table_column_metadata(
5929
+ SQLITE_API int sqlite3_table_column_metadata(
5596
5930
  sqlite3 *db, /* Connection handle */
5597
5931
  const char *zDbName, /* Database name or NULL */
5598
5932
  const char *zTableName, /* Table name */
@@ -5648,7 +5982,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_table_column_metadata(
5648
5982
  **
5649
5983
  ** See also the [load_extension() SQL function].
5650
5984
  */
5651
- SQLITE_API int SQLITE_STDCALL sqlite3_load_extension(
5985
+ SQLITE_API int sqlite3_load_extension(
5652
5986
  sqlite3 *db, /* Load the extension into this database connection */
5653
5987
  const char *zFile, /* Name of the shared library containing extension */
5654
5988
  const char *zProc, /* Entry point. Derived from zFile if 0 */
@@ -5680,7 +6014,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_load_extension(
5680
6014
  ** remains disabled. This will prevent SQL injections from giving attackers
5681
6015
  ** access to extension loading capabilities.
5682
6016
  */
5683
- SQLITE_API int SQLITE_STDCALL sqlite3_enable_load_extension(sqlite3 *db, int onoff);
6017
+ SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff);
5684
6018
 
5685
6019
  /*
5686
6020
  ** CAPI3REF: Automatically Load Statically Linked Extensions
@@ -5718,7 +6052,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_enable_load_extension(sqlite3 *db, int ono
5718
6052
  ** See also: [sqlite3_reset_auto_extension()]
5719
6053
  ** and [sqlite3_cancel_auto_extension()]
5720
6054
  */
5721
- SQLITE_API int SQLITE_STDCALL sqlite3_auto_extension(void(*xEntryPoint)(void));
6055
+ SQLITE_API int sqlite3_auto_extension(void(*xEntryPoint)(void));
5722
6056
 
5723
6057
  /*
5724
6058
  ** CAPI3REF: Cancel Automatic Extension Loading
@@ -5730,7 +6064,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_auto_extension(void(*xEntryPoint)(void));
5730
6064
  ** unregistered and it returns 0 if X was not on the list of initialization
5731
6065
  ** routines.
5732
6066
  */
5733
- SQLITE_API int SQLITE_STDCALL sqlite3_cancel_auto_extension(void(*xEntryPoint)(void));
6067
+ SQLITE_API int sqlite3_cancel_auto_extension(void(*xEntryPoint)(void));
5734
6068
 
5735
6069
  /*
5736
6070
  ** CAPI3REF: Reset Automatic Extension Loading
@@ -5738,7 +6072,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_cancel_auto_extension(void(*xEntryPoint)(v
5738
6072
  ** ^This interface disables all automatic extensions previously
5739
6073
  ** registered using [sqlite3_auto_extension()].
5740
6074
  */
5741
- SQLITE_API void SQLITE_STDCALL sqlite3_reset_auto_extension(void);
6075
+ SQLITE_API void sqlite3_reset_auto_extension(void);
5742
6076
 
5743
6077
  /*
5744
6078
  ** The interface to the virtual-table mechanism is currently considered
@@ -5892,13 +6226,15 @@ struct sqlite3_module {
5892
6226
  ** the xUpdate method are automatically rolled back by SQLite.
5893
6227
  **
5894
6228
  ** IMPORTANT: The estimatedRows field was added to the sqlite3_index_info
5895
- ** structure for SQLite version 3.8.2. If a virtual table extension is
6229
+ ** structure for SQLite [version 3.8.2] ([dateof:3.8.2]).
6230
+ ** If a virtual table extension is
5896
6231
  ** used with an SQLite version earlier than 3.8.2, the results of attempting
5897
6232
  ** to read or write the estimatedRows field are undefined (but are likely
5898
6233
  ** to included crashing the application). The estimatedRows field should
5899
6234
  ** therefore only be used if [sqlite3_libversion_number()] returns a
5900
6235
  ** value greater than or equal to 3008002. Similarly, the idxFlags field
5901
- ** was added for version 3.9.0. It may therefore only be used if
6236
+ ** was added for [version 3.9.0] ([dateof:3.9.0]).
6237
+ ** It may therefore only be used if
5902
6238
  ** sqlite3_libversion_number() returns a value greater than or equal to
5903
6239
  ** 3009000.
5904
6240
  */
@@ -5947,15 +6283,20 @@ struct sqlite3_index_info {
5947
6283
  ** an operator that is part of a constraint term in the wHERE clause of
5948
6284
  ** a query that uses a [virtual table].
5949
6285
  */
5950
- #define SQLITE_INDEX_CONSTRAINT_EQ 2
5951
- #define SQLITE_INDEX_CONSTRAINT_GT 4
5952
- #define SQLITE_INDEX_CONSTRAINT_LE 8
5953
- #define SQLITE_INDEX_CONSTRAINT_LT 16
5954
- #define SQLITE_INDEX_CONSTRAINT_GE 32
5955
- #define SQLITE_INDEX_CONSTRAINT_MATCH 64
5956
- #define SQLITE_INDEX_CONSTRAINT_LIKE 65
5957
- #define SQLITE_INDEX_CONSTRAINT_GLOB 66
5958
- #define SQLITE_INDEX_CONSTRAINT_REGEXP 67
6286
+ #define SQLITE_INDEX_CONSTRAINT_EQ 2
6287
+ #define SQLITE_INDEX_CONSTRAINT_GT 4
6288
+ #define SQLITE_INDEX_CONSTRAINT_LE 8
6289
+ #define SQLITE_INDEX_CONSTRAINT_LT 16
6290
+ #define SQLITE_INDEX_CONSTRAINT_GE 32
6291
+ #define SQLITE_INDEX_CONSTRAINT_MATCH 64
6292
+ #define SQLITE_INDEX_CONSTRAINT_LIKE 65
6293
+ #define SQLITE_INDEX_CONSTRAINT_GLOB 66
6294
+ #define SQLITE_INDEX_CONSTRAINT_REGEXP 67
6295
+ #define SQLITE_INDEX_CONSTRAINT_NE 68
6296
+ #define SQLITE_INDEX_CONSTRAINT_ISNOT 69
6297
+ #define SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70
6298
+ #define SQLITE_INDEX_CONSTRAINT_ISNULL 71
6299
+ #define SQLITE_INDEX_CONSTRAINT_IS 72
5959
6300
 
5960
6301
  /*
5961
6302
  ** CAPI3REF: Register A Virtual Table Implementation
@@ -5983,13 +6324,13 @@ struct sqlite3_index_info {
5983
6324
  ** interface is equivalent to sqlite3_create_module_v2() with a NULL
5984
6325
  ** destructor.
5985
6326
  */
5986
- SQLITE_API int SQLITE_STDCALL sqlite3_create_module(
6327
+ SQLITE_API int sqlite3_create_module(
5987
6328
  sqlite3 *db, /* SQLite connection to register module with */
5988
6329
  const char *zName, /* Name of the module */
5989
6330
  const sqlite3_module *p, /* Methods for the module */
5990
6331
  void *pClientData /* Client data for xCreate/xConnect */
5991
6332
  );
5992
- SQLITE_API int SQLITE_STDCALL sqlite3_create_module_v2(
6333
+ SQLITE_API int sqlite3_create_module_v2(
5993
6334
  sqlite3 *db, /* SQLite connection to register module with */
5994
6335
  const char *zName, /* Name of the module */
5995
6336
  const sqlite3_module *p, /* Methods for the module */
@@ -6052,7 +6393,7 @@ struct sqlite3_vtab_cursor {
6052
6393
  ** to declare the format (the names and datatypes of the columns) of
6053
6394
  ** the virtual tables they implement.
6054
6395
  */
6055
- SQLITE_API int SQLITE_STDCALL sqlite3_declare_vtab(sqlite3*, const char *zSQL);
6396
+ SQLITE_API int sqlite3_declare_vtab(sqlite3*, const char *zSQL);
6056
6397
 
6057
6398
  /*
6058
6399
  ** CAPI3REF: Overload A Function For A Virtual Table
@@ -6071,7 +6412,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_declare_vtab(sqlite3*, const char *zSQL);
6071
6412
  ** purpose is to be a placeholder function that can be overloaded
6072
6413
  ** by a [virtual table].
6073
6414
  */
6074
- SQLITE_API int SQLITE_STDCALL sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg);
6415
+ SQLITE_API int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg);
6075
6416
 
6076
6417
  /*
6077
6418
  ** The interface to the virtual-table mechanism defined above (back up
@@ -6146,6 +6487,12 @@ typedef struct sqlite3_blob sqlite3_blob;
6146
6487
  ** [database connection] error code and message accessible via
6147
6488
  ** [sqlite3_errcode()] and [sqlite3_errmsg()] and related functions.
6148
6489
  **
6490
+ ** A BLOB referenced by sqlite3_blob_open() may be read using the
6491
+ ** [sqlite3_blob_read()] interface and modified by using
6492
+ ** [sqlite3_blob_write()]. The [BLOB handle] can be moved to a
6493
+ ** different row of the same table using the [sqlite3_blob_reopen()]
6494
+ ** interface. However, the column, table, or database of a [BLOB handle]
6495
+ ** cannot be changed after the [BLOB handle] is opened.
6149
6496
  **
6150
6497
  ** ^(If the row that a BLOB handle points to is modified by an
6151
6498
  ** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects
@@ -6169,8 +6516,12 @@ typedef struct sqlite3_blob sqlite3_blob;
6169
6516
  **
6170
6517
  ** To avoid a resource leak, every open [BLOB handle] should eventually
6171
6518
  ** be released by a call to [sqlite3_blob_close()].
6519
+ **
6520
+ ** See also: [sqlite3_blob_close()],
6521
+ ** [sqlite3_blob_reopen()], [sqlite3_blob_read()],
6522
+ ** [sqlite3_blob_bytes()], [sqlite3_blob_write()].
6172
6523
  */
6173
- SQLITE_API int SQLITE_STDCALL sqlite3_blob_open(
6524
+ SQLITE_API int sqlite3_blob_open(
6174
6525
  sqlite3*,
6175
6526
  const char *zDb,
6176
6527
  const char *zTable,
@@ -6184,11 +6535,11 @@ SQLITE_API int SQLITE_STDCALL sqlite3_blob_open(
6184
6535
  ** CAPI3REF: Move a BLOB Handle to a New Row
6185
6536
  ** METHOD: sqlite3_blob
6186
6537
  **
6187
- ** ^This function is used to move an existing blob handle so that it points
6538
+ ** ^This function is used to move an existing [BLOB handle] so that it points
6188
6539
  ** to a different row of the same database table. ^The new row is identified
6189
6540
  ** by the rowid value passed as the second argument. Only the row can be
6190
6541
  ** changed. ^The database, table and column on which the blob handle is open
6191
- ** remain the same. Moving an existing blob handle to a new row can be
6542
+ ** remain the same. Moving an existing [BLOB handle] to a new row is
6192
6543
  ** faster than closing the existing handle and opening a new one.
6193
6544
  **
6194
6545
  ** ^(The new row must meet the same criteria as for [sqlite3_blob_open()] -
@@ -6203,7 +6554,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_blob_open(
6203
6554
  **
6204
6555
  ** ^This function sets the database handle error code and message.
6205
6556
  */
6206
- SQLITE_API int SQLITE_STDCALL sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64);
6557
+ SQLITE_API int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64);
6207
6558
 
6208
6559
  /*
6209
6560
  ** CAPI3REF: Close A BLOB Handle
@@ -6226,7 +6577,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64)
6226
6577
  ** is passed a valid open blob handle, the values returned by the
6227
6578
  ** sqlite3_errcode() and sqlite3_errmsg() functions are set before returning.
6228
6579
  */
6229
- SQLITE_API int SQLITE_STDCALL sqlite3_blob_close(sqlite3_blob *);
6580
+ SQLITE_API int sqlite3_blob_close(sqlite3_blob *);
6230
6581
 
6231
6582
  /*
6232
6583
  ** CAPI3REF: Return The Size Of An Open BLOB
@@ -6242,7 +6593,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_blob_close(sqlite3_blob *);
6242
6593
  ** been closed by [sqlite3_blob_close()]. Passing any other pointer in
6243
6594
  ** to this routine results in undefined and probably undesirable behavior.
6244
6595
  */
6245
- SQLITE_API int SQLITE_STDCALL sqlite3_blob_bytes(sqlite3_blob *);
6596
+ SQLITE_API int sqlite3_blob_bytes(sqlite3_blob *);
6246
6597
 
6247
6598
  /*
6248
6599
  ** CAPI3REF: Read Data From A BLOB Incrementally
@@ -6271,7 +6622,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_blob_bytes(sqlite3_blob *);
6271
6622
  **
6272
6623
  ** See also: [sqlite3_blob_write()].
6273
6624
  */
6274
- SQLITE_API int SQLITE_STDCALL sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
6625
+ SQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
6275
6626
 
6276
6627
  /*
6277
6628
  ** CAPI3REF: Write Data Into A BLOB Incrementally
@@ -6313,7 +6664,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_blob_read(sqlite3_blob *, void *Z, int N,
6313
6664
  **
6314
6665
  ** See also: [sqlite3_blob_read()].
6315
6666
  */
6316
- SQLITE_API int SQLITE_STDCALL sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset);
6667
+ SQLITE_API int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset);
6317
6668
 
6318
6669
  /*
6319
6670
  ** CAPI3REF: Virtual File System Objects
@@ -6344,9 +6695,9 @@ SQLITE_API int SQLITE_STDCALL sqlite3_blob_write(sqlite3_blob *, const void *z,
6344
6695
  ** ^(If the default VFS is unregistered, another VFS is chosen as
6345
6696
  ** the default. The choice for the new VFS is arbitrary.)^
6346
6697
  */
6347
- SQLITE_API sqlite3_vfs *SQLITE_STDCALL sqlite3_vfs_find(const char *zVfsName);
6348
- SQLITE_API int SQLITE_STDCALL sqlite3_vfs_register(sqlite3_vfs*, int makeDflt);
6349
- SQLITE_API int SQLITE_STDCALL sqlite3_vfs_unregister(sqlite3_vfs*);
6698
+ SQLITE_API sqlite3_vfs *sqlite3_vfs_find(const char *zVfsName);
6699
+ SQLITE_API int sqlite3_vfs_register(sqlite3_vfs*, int makeDflt);
6700
+ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
6350
6701
 
6351
6702
  /*
6352
6703
  ** CAPI3REF: Mutexes
@@ -6462,11 +6813,11 @@ SQLITE_API int SQLITE_STDCALL sqlite3_vfs_unregister(sqlite3_vfs*);
6462
6813
  **
6463
6814
  ** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()].
6464
6815
  */
6465
- SQLITE_API sqlite3_mutex *SQLITE_STDCALL sqlite3_mutex_alloc(int);
6466
- SQLITE_API void SQLITE_STDCALL sqlite3_mutex_free(sqlite3_mutex*);
6467
- SQLITE_API void SQLITE_STDCALL sqlite3_mutex_enter(sqlite3_mutex*);
6468
- SQLITE_API int SQLITE_STDCALL sqlite3_mutex_try(sqlite3_mutex*);
6469
- SQLITE_API void SQLITE_STDCALL sqlite3_mutex_leave(sqlite3_mutex*);
6816
+ SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int);
6817
+ SQLITE_API void sqlite3_mutex_free(sqlite3_mutex*);
6818
+ SQLITE_API void sqlite3_mutex_enter(sqlite3_mutex*);
6819
+ SQLITE_API int sqlite3_mutex_try(sqlite3_mutex*);
6820
+ SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex*);
6470
6821
 
6471
6822
  /*
6472
6823
  ** CAPI3REF: Mutex Methods Object
@@ -6576,8 +6927,8 @@ struct sqlite3_mutex_methods {
6576
6927
  ** interface should also return 1 when given a NULL pointer.
6577
6928
  */
6578
6929
  #ifndef NDEBUG
6579
- SQLITE_API int SQLITE_STDCALL sqlite3_mutex_held(sqlite3_mutex*);
6580
- SQLITE_API int SQLITE_STDCALL sqlite3_mutex_notheld(sqlite3_mutex*);
6930
+ SQLITE_API int sqlite3_mutex_held(sqlite3_mutex*);
6931
+ SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*);
6581
6932
  #endif
6582
6933
 
6583
6934
  /*
@@ -6596,7 +6947,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_mutex_notheld(sqlite3_mutex*);
6596
6947
  #define SQLITE_MUTEX_STATIC_MEM 3 /* sqlite3_malloc() */
6597
6948
  #define SQLITE_MUTEX_STATIC_MEM2 4 /* NOT USED */
6598
6949
  #define SQLITE_MUTEX_STATIC_OPEN 4 /* sqlite3BtreeOpen() */
6599
- #define SQLITE_MUTEX_STATIC_PRNG 5 /* sqlite3_random() */
6950
+ #define SQLITE_MUTEX_STATIC_PRNG 5 /* sqlite3_randomness() */
6600
6951
  #define SQLITE_MUTEX_STATIC_LRU 6 /* lru page list */
6601
6952
  #define SQLITE_MUTEX_STATIC_LRU2 7 /* NOT USED */
6602
6953
  #define SQLITE_MUTEX_STATIC_PMEM 7 /* sqlite3PageMalloc() */
@@ -6617,7 +6968,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_mutex_notheld(sqlite3_mutex*);
6617
6968
  ** ^If the [threading mode] is Single-thread or Multi-thread then this
6618
6969
  ** routine returns a NULL pointer.
6619
6970
  */
6620
- SQLITE_API sqlite3_mutex *SQLITE_STDCALL sqlite3_db_mutex(sqlite3*);
6971
+ SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*);
6621
6972
 
6622
6973
  /*
6623
6974
  ** CAPI3REF: Low-Level Control Of Database Files
@@ -6636,9 +6987,9 @@ SQLITE_API sqlite3_mutex *SQLITE_STDCALL sqlite3_db_mutex(sqlite3*);
6636
6987
  ** the xFileControl method. ^The return value of the xFileControl
6637
6988
  ** method becomes the return value of this routine.
6638
6989
  **
6639
- ** ^The SQLITE_FCNTL_FILE_POINTER value for the op parameter causes
6990
+ ** ^The [SQLITE_FCNTL_FILE_POINTER] value for the op parameter causes
6640
6991
  ** a pointer to the underlying [sqlite3_file] object to be written into
6641
- ** the space pointed to by the 4th parameter. ^The SQLITE_FCNTL_FILE_POINTER
6992
+ ** the space pointed to by the 4th parameter. ^The [SQLITE_FCNTL_FILE_POINTER]
6642
6993
  ** case is a short-circuit path which does not actually invoke the
6643
6994
  ** underlying sqlite3_io_methods.xFileControl method.
6644
6995
  **
@@ -6650,9 +7001,9 @@ SQLITE_API sqlite3_mutex *SQLITE_STDCALL sqlite3_db_mutex(sqlite3*);
6650
7001
  ** an incorrect zDbName and an SQLITE_ERROR return from the underlying
6651
7002
  ** xFileControl method.
6652
7003
  **
6653
- ** See also: [SQLITE_FCNTL_LOCKSTATE]
7004
+ ** See also: [file control opcodes]
6654
7005
  */
6655
- SQLITE_API int SQLITE_STDCALL sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*);
7006
+ SQLITE_API int sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*);
6656
7007
 
6657
7008
  /*
6658
7009
  ** CAPI3REF: Testing Interface
@@ -6671,7 +7022,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_file_control(sqlite3*, const char *zDbName
6671
7022
  ** Unlike most of the SQLite API, this function is not guaranteed to
6672
7023
  ** operate consistently from one release to the next.
6673
7024
  */
6674
- SQLITE_API int SQLITE_CDECL sqlite3_test_control(int op, ...);
7025
+ SQLITE_API int sqlite3_test_control(int op, ...);
6675
7026
 
6676
7027
  /*
6677
7028
  ** CAPI3REF: Testing Interface Operation Codes
@@ -6697,16 +7048,18 @@ SQLITE_API int SQLITE_CDECL sqlite3_test_control(int op, ...);
6697
7048
  #define SQLITE_TESTCTRL_RESERVE 14
6698
7049
  #define SQLITE_TESTCTRL_OPTIMIZATIONS 15
6699
7050
  #define SQLITE_TESTCTRL_ISKEYWORD 16
6700
- #define SQLITE_TESTCTRL_SCRATCHMALLOC 17
7051
+ #define SQLITE_TESTCTRL_SCRATCHMALLOC 17 /* NOT USED */
6701
7052
  #define SQLITE_TESTCTRL_LOCALTIME_FAULT 18
6702
7053
  #define SQLITE_TESTCTRL_EXPLAIN_STMT 19 /* NOT USED */
7054
+ #define SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD 19
6703
7055
  #define SQLITE_TESTCTRL_NEVER_CORRUPT 20
6704
7056
  #define SQLITE_TESTCTRL_VDBE_COVERAGE 21
6705
7057
  #define SQLITE_TESTCTRL_BYTEORDER 22
6706
7058
  #define SQLITE_TESTCTRL_ISINIT 23
6707
7059
  #define SQLITE_TESTCTRL_SORTER_MMAP 24
6708
7060
  #define SQLITE_TESTCTRL_IMPOSTER 25
6709
- #define SQLITE_TESTCTRL_LAST 25
7061
+ #define SQLITE_TESTCTRL_PARSER_COVERAGE 26
7062
+ #define SQLITE_TESTCTRL_LAST 26 /* Largest TESTCTRL */
6710
7063
 
6711
7064
  /*
6712
7065
  ** CAPI3REF: SQLite Runtime Status
@@ -6734,8 +7087,8 @@ SQLITE_API int SQLITE_CDECL sqlite3_test_control(int op, ...);
6734
7087
  **
6735
7088
  ** See also: [sqlite3_db_status()]
6736
7089
  */
6737
- SQLITE_API int SQLITE_STDCALL sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag);
6738
- SQLITE_API int SQLITE_STDCALL sqlite3_status64(
7090
+ SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag);
7091
+ SQLITE_API int sqlite3_status64(
6739
7092
  int op,
6740
7093
  sqlite3_int64 *pCurrent,
6741
7094
  sqlite3_int64 *pHighwater,
@@ -6755,8 +7108,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_status64(
6755
7108
  ** <dd>This parameter is the current amount of memory checked out
6756
7109
  ** using [sqlite3_malloc()], either directly or indirectly. The
6757
7110
  ** figure includes calls made to [sqlite3_malloc()] by the application
6758
- ** and internal memory usage by the SQLite library. Scratch memory
6759
- ** controlled by [SQLITE_CONFIG_SCRATCH] and auxiliary page-cache
7111
+ ** and internal memory usage by the SQLite library. Auxiliary page-cache
6760
7112
  ** memory controlled by [SQLITE_CONFIG_PAGECACHE] is not included in
6761
7113
  ** this parameter. The amount returned is the sum of the allocation
6762
7114
  ** sizes as reported by the xSize method in [sqlite3_mem_methods].</dd>)^
@@ -6794,29 +7146,14 @@ SQLITE_API int SQLITE_STDCALL sqlite3_status64(
6794
7146
  ** *pHighwater parameter to [sqlite3_status()] is of interest.
6795
7147
  ** The value written into the *pCurrent parameter is undefined.</dd>)^
6796
7148
  **
6797
- ** [[SQLITE_STATUS_SCRATCH_USED]] ^(<dt>SQLITE_STATUS_SCRATCH_USED</dt>
6798
- ** <dd>This parameter returns the number of allocations used out of the
6799
- ** [scratch memory allocator] configured using
6800
- ** [SQLITE_CONFIG_SCRATCH]. The value returned is in allocations, not
6801
- ** in bytes. Since a single thread may only have one scratch allocation
6802
- ** outstanding at time, this parameter also reports the number of threads
6803
- ** using scratch memory at the same time.</dd>)^
7149
+ ** [[SQLITE_STATUS_SCRATCH_USED]] <dt>SQLITE_STATUS_SCRATCH_USED</dt>
7150
+ ** <dd>No longer used.</dd>
6804
7151
  **
6805
7152
  ** [[SQLITE_STATUS_SCRATCH_OVERFLOW]] ^(<dt>SQLITE_STATUS_SCRATCH_OVERFLOW</dt>
6806
- ** <dd>This parameter returns the number of bytes of scratch memory
6807
- ** allocation which could not be satisfied by the [SQLITE_CONFIG_SCRATCH]
6808
- ** buffer and where forced to overflow to [sqlite3_malloc()]. The values
6809
- ** returned include overflows because the requested allocation was too
6810
- ** larger (that is, because the requested allocation was larger than the
6811
- ** "sz" parameter to [SQLITE_CONFIG_SCRATCH]) and because no scratch buffer
6812
- ** slots were available.
6813
- ** </dd>)^
6814
- **
6815
- ** [[SQLITE_STATUS_SCRATCH_SIZE]] ^(<dt>SQLITE_STATUS_SCRATCH_SIZE</dt>
6816
- ** <dd>This parameter records the largest memory allocation request
6817
- ** handed to [scratch memory allocator]. Only the value returned in the
6818
- ** *pHighwater parameter to [sqlite3_status()] is of interest.
6819
- ** The value written into the *pCurrent parameter is undefined.</dd>)^
7153
+ ** <dd>No longer used.</dd>
7154
+ **
7155
+ ** [[SQLITE_STATUS_SCRATCH_SIZE]] <dt>SQLITE_STATUS_SCRATCH_SIZE</dt>
7156
+ ** <dd>No longer used.</dd>
6820
7157
  **
6821
7158
  ** [[SQLITE_STATUS_PARSER_STACK]] ^(<dt>SQLITE_STATUS_PARSER_STACK</dt>
6822
7159
  ** <dd>The *pHighwater parameter records the deepest parser stack.
@@ -6829,12 +7166,12 @@ SQLITE_API int SQLITE_STDCALL sqlite3_status64(
6829
7166
  #define SQLITE_STATUS_MEMORY_USED 0
6830
7167
  #define SQLITE_STATUS_PAGECACHE_USED 1
6831
7168
  #define SQLITE_STATUS_PAGECACHE_OVERFLOW 2
6832
- #define SQLITE_STATUS_SCRATCH_USED 3
6833
- #define SQLITE_STATUS_SCRATCH_OVERFLOW 4
7169
+ #define SQLITE_STATUS_SCRATCH_USED 3 /* NOT USED */
7170
+ #define SQLITE_STATUS_SCRATCH_OVERFLOW 4 /* NOT USED */
6834
7171
  #define SQLITE_STATUS_MALLOC_SIZE 5
6835
7172
  #define SQLITE_STATUS_PARSER_STACK 6
6836
7173
  #define SQLITE_STATUS_PAGECACHE_SIZE 7
6837
- #define SQLITE_STATUS_SCRATCH_SIZE 8
7174
+ #define SQLITE_STATUS_SCRATCH_SIZE 8 /* NOT USED */
6838
7175
  #define SQLITE_STATUS_MALLOC_COUNT 9
6839
7176
 
6840
7177
  /*
@@ -6860,7 +7197,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_status64(
6860
7197
  **
6861
7198
  ** See also: [sqlite3_status()] and [sqlite3_stmt_status()].
6862
7199
  */
6863
- SQLITE_API int SQLITE_STDCALL sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
7200
+ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
6864
7201
 
6865
7202
  /*
6866
7203
  ** CAPI3REF: Status Parameters for database connections
@@ -7003,7 +7340,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_db_status(sqlite3*, int op, int *pCur, int
7003
7340
  **
7004
7341
  ** See also: [sqlite3_status()] and [sqlite3_db_status()].
7005
7342
  */
7006
- SQLITE_API int SQLITE_STDCALL sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
7343
+ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
7007
7344
 
7008
7345
  /*
7009
7346
  ** CAPI3REF: Status Parameters for prepared statements
@@ -7039,6 +7376,24 @@ SQLITE_API int SQLITE_STDCALL sqlite3_stmt_status(sqlite3_stmt*, int op,int rese
7039
7376
  ** used as a proxy for the total work done by the prepared statement.
7040
7377
  ** If the number of virtual machine operations exceeds 2147483647
7041
7378
  ** then the value returned by this statement status code is undefined.
7379
+ **
7380
+ ** [[SQLITE_STMTSTATUS_REPREPARE]] <dt>SQLITE_STMTSTATUS_REPREPARE</dt>
7381
+ ** <dd>^This is the number of times that the prepare statement has been
7382
+ ** automatically regenerated due to schema changes or change to
7383
+ ** [bound parameters] that might affect the query plan.
7384
+ **
7385
+ ** [[SQLITE_STMTSTATUS_RUN]] <dt>SQLITE_STMTSTATUS_RUN</dt>
7386
+ ** <dd>^This is the number of times that the prepared statement has
7387
+ ** been run. A single "run" for the purposes of this counter is one
7388
+ ** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()].
7389
+ ** The counter is incremented on the first [sqlite3_step()] call of each
7390
+ ** cycle.
7391
+ **
7392
+ ** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt>
7393
+ ** <dd>^This is the approximate number of bytes of heap memory
7394
+ ** used to store the prepared statement. ^This value is not actually
7395
+ ** a counter, and so the resetFlg parameter to sqlite3_stmt_status()
7396
+ ** is ignored when the opcode is SQLITE_STMTSTATUS_MEMUSED.
7042
7397
  ** </dd>
7043
7398
  ** </dl>
7044
7399
  */
@@ -7046,6 +7401,9 @@ SQLITE_API int SQLITE_STDCALL sqlite3_stmt_status(sqlite3_stmt*, int op,int rese
7046
7401
  #define SQLITE_STMTSTATUS_SORT 2
7047
7402
  #define SQLITE_STMTSTATUS_AUTOINDEX 3
7048
7403
  #define SQLITE_STMTSTATUS_VM_STEP 4
7404
+ #define SQLITE_STMTSTATUS_REPREPARE 5
7405
+ #define SQLITE_STMTSTATUS_RUN 6
7406
+ #define SQLITE_STMTSTATUS_MEMUSED 99
7049
7407
 
7050
7408
  /*
7051
7409
  ** CAPI3REF: Custom Page Cache Object
@@ -7472,16 +7830,16 @@ typedef struct sqlite3_backup sqlite3_backup;
7472
7830
  ** same time as another thread is invoking sqlite3_backup_step() it is
7473
7831
  ** possible that they return invalid values.
7474
7832
  */
7475
- SQLITE_API sqlite3_backup *SQLITE_STDCALL sqlite3_backup_init(
7833
+ SQLITE_API sqlite3_backup *sqlite3_backup_init(
7476
7834
  sqlite3 *pDest, /* Destination database handle */
7477
7835
  const char *zDestName, /* Destination database name */
7478
7836
  sqlite3 *pSource, /* Source database handle */
7479
7837
  const char *zSourceName /* Source database name */
7480
7838
  );
7481
- SQLITE_API int SQLITE_STDCALL sqlite3_backup_step(sqlite3_backup *p, int nPage);
7482
- SQLITE_API int SQLITE_STDCALL sqlite3_backup_finish(sqlite3_backup *p);
7483
- SQLITE_API int SQLITE_STDCALL sqlite3_backup_remaining(sqlite3_backup *p);
7484
- SQLITE_API int SQLITE_STDCALL sqlite3_backup_pagecount(sqlite3_backup *p);
7839
+ SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage);
7840
+ SQLITE_API int sqlite3_backup_finish(sqlite3_backup *p);
7841
+ SQLITE_API int sqlite3_backup_remaining(sqlite3_backup *p);
7842
+ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p);
7485
7843
 
7486
7844
  /*
7487
7845
  ** CAPI3REF: Unlock Notification
@@ -7598,7 +7956,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_backup_pagecount(sqlite3_backup *p);
7598
7956
  ** the special "DROP TABLE/INDEX" case, the extended error code is just
7599
7957
  ** SQLITE_LOCKED.)^
7600
7958
  */
7601
- SQLITE_API int SQLITE_STDCALL sqlite3_unlock_notify(
7959
+ SQLITE_API int sqlite3_unlock_notify(
7602
7960
  sqlite3 *pBlocked, /* Waiting connection */
7603
7961
  void (*xNotify)(void **apArg, int nArg), /* Callback function to invoke */
7604
7962
  void *pNotifyArg /* Argument to pass to xNotify */
@@ -7613,8 +7971,8 @@ SQLITE_API int SQLITE_STDCALL sqlite3_unlock_notify(
7613
7971
  ** strings in a case-independent fashion, using the same definition of "case
7614
7972
  ** independence" that SQLite uses internally when comparing identifiers.
7615
7973
  */
7616
- SQLITE_API int SQLITE_STDCALL sqlite3_stricmp(const char *, const char *);
7617
- SQLITE_API int SQLITE_STDCALL sqlite3_strnicmp(const char *, const char *, int);
7974
+ SQLITE_API int sqlite3_stricmp(const char *, const char *);
7975
+ SQLITE_API int sqlite3_strnicmp(const char *, const char *, int);
7618
7976
 
7619
7977
  /*
7620
7978
  ** CAPI3REF: String Globbing
@@ -7631,7 +7989,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_strnicmp(const char *, const char *, int);
7631
7989
  **
7632
7990
  ** See also: [sqlite3_strlike()].
7633
7991
  */
7634
- SQLITE_API int SQLITE_STDCALL sqlite3_strglob(const char *zGlob, const char *zStr);
7992
+ SQLITE_API int sqlite3_strglob(const char *zGlob, const char *zStr);
7635
7993
 
7636
7994
  /*
7637
7995
  ** CAPI3REF: String LIKE Matching
@@ -7654,7 +8012,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_strglob(const char *zGlob, const char *zSt
7654
8012
  **
7655
8013
  ** See also: [sqlite3_strglob()].
7656
8014
  */
7657
- SQLITE_API int SQLITE_STDCALL sqlite3_strlike(const char *zGlob, const char *zStr, unsigned int cEsc);
8015
+ SQLITE_API int sqlite3_strlike(const char *zGlob, const char *zStr, unsigned int cEsc);
7658
8016
 
7659
8017
  /*
7660
8018
  ** CAPI3REF: Error Logging Interface
@@ -7677,7 +8035,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_strlike(const char *zGlob, const char *zSt
7677
8035
  ** a few hundred characters, it will be truncated to the length of the
7678
8036
  ** buffer.
7679
8037
  */
7680
- SQLITE_API void SQLITE_CDECL sqlite3_log(int iErrCode, const char *zFormat, ...);
8038
+ SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);
7681
8039
 
7682
8040
  /*
7683
8041
  ** CAPI3REF: Write-Ahead Log Commit Hook
@@ -7713,7 +8071,7 @@ SQLITE_API void SQLITE_CDECL sqlite3_log(int iErrCode, const char *zFormat, ...)
7713
8071
  ** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will
7714
8072
  ** overwrite any prior [sqlite3_wal_hook()] settings.
7715
8073
  */
7716
- SQLITE_API void *SQLITE_STDCALL sqlite3_wal_hook(
8074
+ SQLITE_API void *sqlite3_wal_hook(
7717
8075
  sqlite3*,
7718
8076
  int(*)(void *,sqlite3*,const char*,int),
7719
8077
  void*
@@ -7748,7 +8106,7 @@ SQLITE_API void *SQLITE_STDCALL sqlite3_wal_hook(
7748
8106
  ** is only necessary if the default setting is found to be suboptimal
7749
8107
  ** for a particular application.
7750
8108
  */
7751
- SQLITE_API int SQLITE_STDCALL sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
8109
+ SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
7752
8110
 
7753
8111
  /*
7754
8112
  ** CAPI3REF: Checkpoint a database
@@ -7770,7 +8128,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
7770
8128
  ** start a callback but which do not need the full power (and corresponding
7771
8129
  ** complication) of [sqlite3_wal_checkpoint_v2()].
7772
8130
  */
7773
- SQLITE_API int SQLITE_STDCALL sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
8131
+ SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
7774
8132
 
7775
8133
  /*
7776
8134
  ** CAPI3REF: Checkpoint a database
@@ -7864,7 +8222,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_wal_checkpoint(sqlite3 *db, const char *zD
7864
8222
  ** ^The [PRAGMA wal_checkpoint] command can be used to invoke this interface
7865
8223
  ** from SQL.
7866
8224
  */
7867
- SQLITE_API int SQLITE_STDCALL sqlite3_wal_checkpoint_v2(
8225
+ SQLITE_API int sqlite3_wal_checkpoint_v2(
7868
8226
  sqlite3 *db, /* Database handle */
7869
8227
  const char *zDb, /* Name of attached database (or NULL) */
7870
8228
  int eMode, /* SQLITE_CHECKPOINT_* value */
@@ -7900,7 +8258,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_wal_checkpoint_v2(
7900
8258
  ** this function. (See [SQLITE_VTAB_CONSTRAINT_SUPPORT].) Further options
7901
8259
  ** may be added in the future.
7902
8260
  */
7903
- SQLITE_API int SQLITE_CDECL sqlite3_vtab_config(sqlite3*, int op, ...);
8261
+ SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);
7904
8262
 
7905
8263
  /*
7906
8264
  ** CAPI3REF: Virtual Table Configuration Options
@@ -7953,7 +8311,41 @@ SQLITE_API int SQLITE_CDECL sqlite3_vtab_config(sqlite3*, int op, ...);
7953
8311
  ** of the SQL statement that triggered the call to the [xUpdate] method of the
7954
8312
  ** [virtual table].
7955
8313
  */
7956
- SQLITE_API int SQLITE_STDCALL sqlite3_vtab_on_conflict(sqlite3 *);
8314
+ SQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *);
8315
+
8316
+ /*
8317
+ ** CAPI3REF: Determine If Virtual Table Column Access Is For UPDATE
8318
+ **
8319
+ ** If the sqlite3_vtab_nochange(X) routine is called within the [xColumn]
8320
+ ** method of a [virtual table], then it returns true if and only if the
8321
+ ** column is being fetched as part of an UPDATE operation during which the
8322
+ ** column value will not change. Applications might use this to substitute
8323
+ ** a lighter-weight value to return that the corresponding [xUpdate] method
8324
+ ** understands as a "no-change" value.
8325
+ **
8326
+ ** If the [xColumn] method calls sqlite3_vtab_nochange() and finds that
8327
+ ** the column is not changed by the UPDATE statement, they the xColumn
8328
+ ** method can optionally return without setting a result, without calling
8329
+ ** any of the [sqlite3_result_int|sqlite3_result_xxxxx() interfaces].
8330
+ ** In that case, [sqlite3_value_nochange(X)] will return true for the
8331
+ ** same column in the [xUpdate] method.
8332
+ */
8333
+ SQLITE_API int sqlite3_vtab_nochange(sqlite3_context*);
8334
+
8335
+ /*
8336
+ ** CAPI3REF: Determine The Collation For a Virtual Table Constraint
8337
+ **
8338
+ ** This function may only be called from within a call to the [xBestIndex]
8339
+ ** method of a [virtual table].
8340
+ **
8341
+ ** The first argument must be the sqlite3_index_info object that is the
8342
+ ** first parameter to the xBestIndex() method. The second argument must be
8343
+ ** an index into the aConstraint[] array belonging to the sqlite3_index_info
8344
+ ** structure passed to xBestIndex. This function returns a pointer to a buffer
8345
+ ** containing the name of the collation sequence for the corresponding
8346
+ ** constraint.
8347
+ */
8348
+ SQLITE_API SQLITE_EXPERIMENTAL const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
7957
8349
 
7958
8350
  /*
7959
8351
  ** CAPI3REF: Conflict resolution modes
@@ -8058,7 +8450,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_vtab_on_conflict(sqlite3 *);
8058
8450
  **
8059
8451
  ** See also: [sqlite3_stmt_scanstatus_reset()]
8060
8452
  */
8061
- SQLITE_API int SQLITE_STDCALL sqlite3_stmt_scanstatus(
8453
+ SQLITE_API int sqlite3_stmt_scanstatus(
8062
8454
  sqlite3_stmt *pStmt, /* Prepared statement for which info desired */
8063
8455
  int idx, /* Index of loop to report on */
8064
8456
  int iScanStatusOp, /* Information desired. SQLITE_SCANSTAT_* */
@@ -8074,7 +8466,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_stmt_scanstatus(
8074
8466
  ** This API is only available if the library is built with pre-processor
8075
8467
  ** symbol [SQLITE_ENABLE_STMT_SCANSTATUS] defined.
8076
8468
  */
8077
- SQLITE_API void SQLITE_STDCALL sqlite3_stmt_scanstatus_reset(sqlite3_stmt*);
8469
+ SQLITE_API void sqlite3_stmt_scanstatus_reset(sqlite3_stmt*);
8078
8470
 
8079
8471
  /*
8080
8472
  ** CAPI3REF: Flush caches to disk mid-transaction
@@ -8106,7 +8498,7 @@ SQLITE_API void SQLITE_STDCALL sqlite3_stmt_scanstatus_reset(sqlite3_stmt*);
8106
8498
  ** ^This function does not set the database handle error code or message
8107
8499
  ** returned by the [sqlite3_errcode()] and [sqlite3_errmsg()] functions.
8108
8500
  */
8109
- SQLITE_API int SQLITE_STDCALL sqlite3_db_cacheflush(sqlite3*);
8501
+ SQLITE_API int sqlite3_db_cacheflush(sqlite3*);
8110
8502
 
8111
8503
  /*
8112
8504
  ** CAPI3REF: The pre-update hook.
@@ -8116,7 +8508,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_db_cacheflush(sqlite3*);
8116
8508
  **
8117
8509
  ** ^The [sqlite3_preupdate_hook()] interface registers a callback function
8118
8510
  ** that is invoked prior to each [INSERT], [UPDATE], and [DELETE] operation
8119
- ** on a [rowid table].
8511
+ ** on a database table.
8120
8512
  ** ^At most one preupdate hook may be registered at a time on a single
8121
8513
  ** [database connection]; each call to [sqlite3_preupdate_hook()] overrides
8122
8514
  ** the previous setting.
@@ -8125,9 +8517,9 @@ SQLITE_API int SQLITE_STDCALL sqlite3_db_cacheflush(sqlite3*);
8125
8517
  ** ^The third parameter to [sqlite3_preupdate_hook()] is passed through as
8126
8518
  ** the first parameter to callbacks.
8127
8519
  **
8128
- ** ^The preupdate hook only fires for changes to [rowid tables]; the preupdate
8129
- ** hook is not invoked for changes to [virtual tables] or [WITHOUT ROWID]
8130
- ** tables.
8520
+ ** ^The preupdate hook only fires for changes to real database tables; the
8521
+ ** preupdate hook is not invoked for changes to [virtual tables] or to
8522
+ ** system tables like sqlite_master or sqlite_stat1.
8131
8523
  **
8132
8524
  ** ^The second parameter to the preupdate callback is a pointer to
8133
8525
  ** the [database connection] that registered the preupdate hook.
@@ -8141,12 +8533,16 @@ SQLITE_API int SQLITE_STDCALL sqlite3_db_cacheflush(sqlite3*);
8141
8533
  ** databases.)^
8142
8534
  ** ^The fifth parameter to the preupdate callback is the name of the
8143
8535
  ** table that is being modified.
8144
- ** ^The sixth parameter to the preupdate callback is the initial [rowid] of the
8145
- ** row being changes for SQLITE_UPDATE and SQLITE_DELETE changes and is
8146
- ** undefined for SQLITE_INSERT changes.
8147
- ** ^The seventh parameter to the preupdate callback is the final [rowid] of
8148
- ** the row being changed for SQLITE_UPDATE and SQLITE_INSERT changes and is
8149
- ** undefined for SQLITE_DELETE changes.
8536
+ **
8537
+ ** For an UPDATE or DELETE operation on a [rowid table], the sixth
8538
+ ** parameter passed to the preupdate callback is the initial [rowid] of the
8539
+ ** row being modified or deleted. For an INSERT operation on a rowid table,
8540
+ ** or any operation on a WITHOUT ROWID table, the value of the sixth
8541
+ ** parameter is undefined. For an INSERT or UPDATE on a rowid table the
8542
+ ** seventh parameter is the final rowid value of the row being inserted
8543
+ ** or updated. The value of the seventh parameter passed to the callback
8544
+ ** function is not defined for operations on WITHOUT ROWID tables, or for
8545
+ ** INSERT operations on rowid tables.
8150
8546
  **
8151
8547
  ** The [sqlite3_preupdate_old()], [sqlite3_preupdate_new()],
8152
8548
  ** [sqlite3_preupdate_count()], and [sqlite3_preupdate_depth()] interfaces
@@ -8186,7 +8582,8 @@ SQLITE_API int SQLITE_STDCALL sqlite3_db_cacheflush(sqlite3*);
8186
8582
  **
8187
8583
  ** See also: [sqlite3_update_hook()]
8188
8584
  */
8189
- SQLITE_API SQLITE_EXPERIMENTAL void *SQLITE_STDCALL sqlite3_preupdate_hook(
8585
+ #if defined(SQLITE_ENABLE_PREUPDATE_HOOK)
8586
+ SQLITE_API void *sqlite3_preupdate_hook(
8190
8587
  sqlite3 *db,
8191
8588
  void(*xPreUpdate)(
8192
8589
  void *pCtx, /* Copy of third arg to preupdate_hook() */
@@ -8199,10 +8596,11 @@ SQLITE_API SQLITE_EXPERIMENTAL void *SQLITE_STDCALL sqlite3_preupdate_hook(
8199
8596
  ),
8200
8597
  void*
8201
8598
  );
8202
- SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_preupdate_old(sqlite3 *, int, sqlite3_value **);
8203
- SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_preupdate_count(sqlite3 *);
8204
- SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_preupdate_depth(sqlite3 *);
8205
- SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_preupdate_new(sqlite3 *, int, sqlite3_value **);
8599
+ SQLITE_API int sqlite3_preupdate_old(sqlite3 *, int, sqlite3_value **);
8600
+ SQLITE_API int sqlite3_preupdate_count(sqlite3 *);
8601
+ SQLITE_API int sqlite3_preupdate_depth(sqlite3 *);
8602
+ SQLITE_API int sqlite3_preupdate_new(sqlite3 *, int, sqlite3_value **);
8603
+ #endif
8206
8604
 
8207
8605
  /*
8208
8606
  ** CAPI3REF: Low-level system error code
@@ -8214,11 +8612,11 @@ SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_preupdate_new(sqlite3
8214
8612
  ** called to get back the underlying "errno" that caused the problem, such
8215
8613
  ** as ENOSPC, EAUTH, EISDIR, and so forth.
8216
8614
  */
8217
- SQLITE_API int SQLITE_STDCALL sqlite3_system_errno(sqlite3*);
8615
+ SQLITE_API int sqlite3_system_errno(sqlite3*);
8218
8616
 
8219
8617
  /*
8220
8618
  ** CAPI3REF: Database Snapshot
8221
- ** KEYWORDS: {snapshot}
8619
+ ** KEYWORDS: {snapshot} {sqlite3_snapshot}
8222
8620
  ** EXPERIMENTAL
8223
8621
  **
8224
8622
  ** An instance of the snapshot object records the state of a [WAL mode]
@@ -8242,7 +8640,9 @@ SQLITE_API int SQLITE_STDCALL sqlite3_system_errno(sqlite3*);
8242
8640
  ** to an historical snapshot (if possible). The destructor for
8243
8641
  ** sqlite3_snapshot objects is [sqlite3_snapshot_free()].
8244
8642
  */
8245
- typedef struct sqlite3_snapshot sqlite3_snapshot;
8643
+ typedef struct sqlite3_snapshot {
8644
+ unsigned char hidden[48];
8645
+ } sqlite3_snapshot;
8246
8646
 
8247
8647
  /*
8248
8648
  ** CAPI3REF: Record A Database Snapshot
@@ -8253,9 +8653,32 @@ typedef struct sqlite3_snapshot sqlite3_snapshot;
8253
8653
  ** schema S in database connection D. ^On success, the
8254
8654
  ** [sqlite3_snapshot_get(D,S,P)] interface writes a pointer to the newly
8255
8655
  ** created [sqlite3_snapshot] object into *P and returns SQLITE_OK.
8256
- ** ^If schema S of [database connection] D is not a [WAL mode] database
8257
- ** that is in a read transaction, then [sqlite3_snapshot_get(D,S,P)]
8258
- ** leaves the *P value unchanged and returns an appropriate [error code].
8656
+ ** If there is not already a read-transaction open on schema S when
8657
+ ** this function is called, one is opened automatically.
8658
+ **
8659
+ ** The following must be true for this function to succeed. If any of
8660
+ ** the following statements are false when sqlite3_snapshot_get() is
8661
+ ** called, SQLITE_ERROR is returned. The final value of *P is undefined
8662
+ ** in this case.
8663
+ **
8664
+ ** <ul>
8665
+ ** <li> The database handle must be in [autocommit mode].
8666
+ **
8667
+ ** <li> Schema S of [database connection] D must be a [WAL mode] database.
8668
+ **
8669
+ ** <li> There must not be a write transaction open on schema S of database
8670
+ ** connection D.
8671
+ **
8672
+ ** <li> One or more transactions must have been written to the current wal
8673
+ ** file since it was created on disk (by any connection). This means
8674
+ ** that a snapshot cannot be taken on a wal mode database with no wal
8675
+ ** file immediately after it is first opened. At least one transaction
8676
+ ** must be written to it first.
8677
+ ** </ul>
8678
+ **
8679
+ ** This function may also return SQLITE_NOMEM. If it is called with the
8680
+ ** database handle in autocommit mode but fails for some other reason,
8681
+ ** whether or not a read transaction is opened on schema S is undefined.
8259
8682
  **
8260
8683
  ** The [sqlite3_snapshot] object returned from a successful call to
8261
8684
  ** [sqlite3_snapshot_get()] must be freed using [sqlite3_snapshot_free()]
@@ -8264,7 +8687,7 @@ typedef struct sqlite3_snapshot sqlite3_snapshot;
8264
8687
  ** The [sqlite3_snapshot_get()] interface is only available when the
8265
8688
  ** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
8266
8689
  */
8267
- SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_snapshot_get(
8690
+ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_get(
8268
8691
  sqlite3 *db,
8269
8692
  const char *zSchema,
8270
8693
  sqlite3_snapshot **ppSnapshot
@@ -8302,7 +8725,7 @@ SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_snapshot_get(
8302
8725
  ** The [sqlite3_snapshot_open()] interface is only available when the
8303
8726
  ** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
8304
8727
  */
8305
- SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_snapshot_open(
8728
+ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_open(
8306
8729
  sqlite3 *db,
8307
8730
  const char *zSchema,
8308
8731
  sqlite3_snapshot *pSnapshot
@@ -8319,7 +8742,7 @@ SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_snapshot_open(
8319
8742
  ** The [sqlite3_snapshot_free()] interface is only available when the
8320
8743
  ** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
8321
8744
  */
8322
- SQLITE_API SQLITE_EXPERIMENTAL void SQLITE_STDCALL sqlite3_snapshot_free(sqlite3_snapshot*);
8745
+ SQLITE_API SQLITE_EXPERIMENTAL void sqlite3_snapshot_free(sqlite3_snapshot*);
8323
8746
 
8324
8747
  /*
8325
8748
  ** CAPI3REF: Compare the ages of two snapshot handles.
@@ -8343,11 +8766,33 @@ SQLITE_API SQLITE_EXPERIMENTAL void SQLITE_STDCALL sqlite3_snapshot_free(sqlite3
8343
8766
  ** snapshot than P2, zero if the two handles refer to the same database
8344
8767
  ** snapshot, and a positive value if P1 is a newer snapshot than P2.
8345
8768
  */
8346
- SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_snapshot_cmp(
8769
+ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_cmp(
8347
8770
  sqlite3_snapshot *p1,
8348
8771
  sqlite3_snapshot *p2
8349
8772
  );
8350
8773
 
8774
+ /*
8775
+ ** CAPI3REF: Recover snapshots from a wal file
8776
+ ** EXPERIMENTAL
8777
+ **
8778
+ ** If all connections disconnect from a database file but do not perform
8779
+ ** a checkpoint, the existing wal file is opened along with the database
8780
+ ** file the next time the database is opened. At this point it is only
8781
+ ** possible to successfully call sqlite3_snapshot_open() to open the most
8782
+ ** recent snapshot of the database (the one at the head of the wal file),
8783
+ ** even though the wal file may contain other valid snapshots for which
8784
+ ** clients have sqlite3_snapshot handles.
8785
+ **
8786
+ ** This function attempts to scan the wal file associated with database zDb
8787
+ ** of database handle db and make all valid snapshots available to
8788
+ ** sqlite3_snapshot_open(). It is an error if there is already a read
8789
+ ** transaction open on the database, or if the database is not a wal mode
8790
+ ** database.
8791
+ **
8792
+ ** SQLITE_OK is returned if successful, or an SQLite error code otherwise.
8793
+ */
8794
+ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const char *zDb);
8795
+
8351
8796
  /*
8352
8797
  ** Undo the hack that converts floating point types to integer for
8353
8798
  ** builds on processors without floating point support.
@@ -8401,7 +8846,7 @@ typedef struct sqlite3_rtree_query_info sqlite3_rtree_query_info;
8401
8846
  **
8402
8847
  ** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zGeom(... params ...)
8403
8848
  */
8404
- SQLITE_API int SQLITE_STDCALL sqlite3_rtree_geometry_callback(
8849
+ SQLITE_API int sqlite3_rtree_geometry_callback(
8405
8850
  sqlite3 *db,
8406
8851
  const char *zGeom,
8407
8852
  int (*xGeom)(sqlite3_rtree_geometry*, int, sqlite3_rtree_dbl*,int*),
@@ -8427,7 +8872,7 @@ struct sqlite3_rtree_geometry {
8427
8872
  **
8428
8873
  ** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zQueryFunc(... params ...)
8429
8874
  */
8430
- SQLITE_API int SQLITE_STDCALL sqlite3_rtree_query_callback(
8875
+ SQLITE_API int sqlite3_rtree_query_callback(
8431
8876
  sqlite3 *db,
8432
8877
  const char *zQueryFunc,
8433
8878
  int (*xQueryFunc)(sqlite3_rtree_query_info*),
@@ -8533,7 +8978,7 @@ typedef struct sqlite3_changeset_iter sqlite3_changeset_iter;
8533
8978
  ** attached database. It is not an error if database zDb is not attached
8534
8979
  ** to the database when the session object is created.
8535
8980
  */
8536
- int sqlite3session_create(
8981
+ SQLITE_API int sqlite3session_create(
8537
8982
  sqlite3 *db, /* Database handle */
8538
8983
  const char *zDb, /* Name of db (e.g. "main") */
8539
8984
  sqlite3_session **ppSession /* OUT: New session object */
@@ -8551,7 +8996,7 @@ int sqlite3session_create(
8551
8996
  ** are attached is closed. Refer to the documentation for
8552
8997
  ** [sqlite3session_create()] for details.
8553
8998
  */
8554
- void sqlite3session_delete(sqlite3_session *pSession);
8999
+ SQLITE_API void sqlite3session_delete(sqlite3_session *pSession);
8555
9000
 
8556
9001
 
8557
9002
  /*
@@ -8571,7 +9016,7 @@ void sqlite3session_delete(sqlite3_session *pSession);
8571
9016
  ** The return value indicates the final state of the session object: 0 if
8572
9017
  ** the session is disabled, or 1 if it is enabled.
8573
9018
  */
8574
- int sqlite3session_enable(sqlite3_session *pSession, int bEnable);
9019
+ SQLITE_API int sqlite3session_enable(sqlite3_session *pSession, int bEnable);
8575
9020
 
8576
9021
  /*
8577
9022
  ** CAPI3REF: Set Or Clear the Indirect Change Flag
@@ -8600,7 +9045,7 @@ int sqlite3session_enable(sqlite3_session *pSession, int bEnable);
8600
9045
  ** The return value indicates the final state of the indirect flag: 0 if
8601
9046
  ** it is clear, or 1 if it is set.
8602
9047
  */
8603
- int sqlite3session_indirect(sqlite3_session *pSession, int bIndirect);
9048
+ SQLITE_API int sqlite3session_indirect(sqlite3_session *pSession, int bIndirect);
8604
9049
 
8605
9050
  /*
8606
9051
  ** CAPI3REF: Attach A Table To A Session Object
@@ -8629,8 +9074,37 @@ int sqlite3session_indirect(sqlite3_session *pSession, int bIndirect);
8629
9074
  **
8630
9075
  ** SQLITE_OK is returned if the call completes without error. Or, if an error
8631
9076
  ** occurs, an SQLite error code (e.g. SQLITE_NOMEM) is returned.
8632
- */
8633
- int sqlite3session_attach(
9077
+ **
9078
+ ** <h3>Special sqlite_stat1 Handling</h3>
9079
+ **
9080
+ ** As of SQLite version 3.22.0, the "sqlite_stat1" table is an exception to
9081
+ ** some of the rules above. In SQLite, the schema of sqlite_stat1 is:
9082
+ ** <pre>
9083
+ ** &nbsp; CREATE TABLE sqlite_stat1(tbl,idx,stat)
9084
+ ** </pre>
9085
+ **
9086
+ ** Even though sqlite_stat1 does not have a PRIMARY KEY, changes are
9087
+ ** recorded for it as if the PRIMARY KEY is (tbl,idx). Additionally, changes
9088
+ ** are recorded for rows for which (idx IS NULL) is true. However, for such
9089
+ ** rows a zero-length blob (SQL value X'') is stored in the changeset or
9090
+ ** patchset instead of a NULL value. This allows such changesets to be
9091
+ ** manipulated by legacy implementations of sqlite3changeset_invert(),
9092
+ ** concat() and similar.
9093
+ **
9094
+ ** The sqlite3changeset_apply() function automatically converts the
9095
+ ** zero-length blob back to a NULL value when updating the sqlite_stat1
9096
+ ** table. However, if the application calls sqlite3changeset_new(),
9097
+ ** sqlite3changeset_old() or sqlite3changeset_conflict on a changeset
9098
+ ** iterator directly (including on a changeset iterator passed to a
9099
+ ** conflict-handler callback) then the X'' value is returned. The application
9100
+ ** must translate X'' to NULL itself if required.
9101
+ **
9102
+ ** Legacy (older than 3.22.0) versions of the sessions module cannot capture
9103
+ ** changes made to the sqlite_stat1 table. Legacy versions of the
9104
+ ** sqlite3changeset_apply() function silently ignore any modifications to the
9105
+ ** sqlite_stat1 table that are part of a changeset or patchset.
9106
+ */
9107
+ SQLITE_API int sqlite3session_attach(
8634
9108
  sqlite3_session *pSession, /* Session object */
8635
9109
  const char *zTab /* Table name */
8636
9110
  );
@@ -8639,12 +9113,12 @@ int sqlite3session_attach(
8639
9113
  ** CAPI3REF: Set a table filter on a Session Object.
8640
9114
  **
8641
9115
  ** The second argument (xFilter) is the "filter callback". For changes to rows
8642
- ** in tables that are not attached to the Session oject, the filter is called
9116
+ ** in tables that are not attached to the Session object, the filter is called
8643
9117
  ** to determine whether changes to the table's rows should be tracked or not.
8644
9118
  ** If xFilter returns 0, changes is not tracked. Note that once a table is
8645
9119
  ** attached, xFilter will not be called again.
8646
9120
  */
8647
- void sqlite3session_table_filter(
9121
+ SQLITE_API void sqlite3session_table_filter(
8648
9122
  sqlite3_session *pSession, /* Session object */
8649
9123
  int(*xFilter)(
8650
9124
  void *pCtx, /* Copy of third arg to _filter_table() */
@@ -8757,7 +9231,7 @@ void sqlite3session_table_filter(
8757
9231
  ** another field of the same row is updated while the session is enabled, the
8758
9232
  ** resulting changeset will contain an UPDATE change that updates both fields.
8759
9233
  */
8760
- int sqlite3session_changeset(
9234
+ SQLITE_API int sqlite3session_changeset(
8761
9235
  sqlite3_session *pSession, /* Session object */
8762
9236
  int *pnChangeset, /* OUT: Size of buffer at *ppChangeset */
8763
9237
  void **ppChangeset /* OUT: Buffer containing changeset */
@@ -8801,7 +9275,8 @@ int sqlite3session_changeset(
8801
9275
  ** the from-table, a DELETE record is added to the session object.
8802
9276
  **
8803
9277
  ** <li> For each row (primary key) that exists in both tables, but features
8804
- ** different in each, an UPDATE record is added to the session.
9278
+ ** different non-PK values in each, an UPDATE record is added to the
9279
+ ** session.
8805
9280
  ** </ul>
8806
9281
  **
8807
9282
  ** To clarify, if this function is called and then a changeset constructed
@@ -8818,7 +9293,7 @@ int sqlite3session_changeset(
8818
9293
  ** message. It is the responsibility of the caller to free this buffer using
8819
9294
  ** sqlite3_free().
8820
9295
  */
8821
- int sqlite3session_diff(
9296
+ SQLITE_API int sqlite3session_diff(
8822
9297
  sqlite3_session *pSession,
8823
9298
  const char *zFromDb,
8824
9299
  const char *zTbl,
@@ -8854,10 +9329,10 @@ int sqlite3session_diff(
8854
9329
  ** a single table are grouped together, tables appear in the order in which
8855
9330
  ** they were attached to the session object).
8856
9331
  */
8857
- int sqlite3session_patchset(
9332
+ SQLITE_API int sqlite3session_patchset(
8858
9333
  sqlite3_session *pSession, /* Session object */
8859
- int *pnPatchset, /* OUT: Size of buffer at *ppChangeset */
8860
- void **ppPatchset /* OUT: Buffer containing changeset */
9334
+ int *pnPatchset, /* OUT: Size of buffer at *ppPatchset */
9335
+ void **ppPatchset /* OUT: Buffer containing patchset */
8861
9336
  );
8862
9337
 
8863
9338
  /*
@@ -8875,7 +9350,7 @@ int sqlite3session_patchset(
8875
9350
  ** guaranteed that a call to sqlite3session_changeset() will return a
8876
9351
  ** changeset containing zero changes.
8877
9352
  */
8878
- int sqlite3session_isempty(sqlite3_session *pSession);
9353
+ SQLITE_API int sqlite3session_isempty(sqlite3_session *pSession);
8879
9354
 
8880
9355
  /*
8881
9356
  ** CAPI3REF: Create An Iterator To Traverse A Changeset
@@ -8905,12 +9380,12 @@ int sqlite3session_isempty(sqlite3_session *pSession);
8905
9380
  ** [sqlite3changeset_invert()] functions, all changes within the changeset
8906
9381
  ** that apply to a single table are grouped together. This means that when
8907
9382
  ** an application iterates through a changeset using an iterator created by
8908
- ** this function, all changes that relate to a single table are visted
9383
+ ** this function, all changes that relate to a single table are visited
8909
9384
  ** consecutively. There is no chance that the iterator will visit a change
8910
9385
  ** the applies to table X, then one for table Y, and then later on visit
8911
9386
  ** another change for table X.
8912
9387
  */
8913
- int sqlite3changeset_start(
9388
+ SQLITE_API int sqlite3changeset_start(
8914
9389
  sqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */
8915
9390
  int nChangeset, /* Size of changeset blob in bytes */
8916
9391
  void *pChangeset /* Pointer to blob containing changeset */
@@ -8939,7 +9414,7 @@ int sqlite3changeset_start(
8939
9414
  ** codes include SQLITE_CORRUPT (if the changeset buffer is corrupt) or
8940
9415
  ** SQLITE_NOMEM.
8941
9416
  */
8942
- int sqlite3changeset_next(sqlite3_changeset_iter *pIter);
9417
+ SQLITE_API int sqlite3changeset_next(sqlite3_changeset_iter *pIter);
8943
9418
 
8944
9419
  /*
8945
9420
  ** CAPI3REF: Obtain The Current Operation From A Changeset Iterator
@@ -8967,7 +9442,7 @@ int sqlite3changeset_next(sqlite3_changeset_iter *pIter);
8967
9442
  ** SQLite error code is returned. The values of the output variables may not
8968
9443
  ** be trusted in this case.
8969
9444
  */
8970
- int sqlite3changeset_op(
9445
+ SQLITE_API int sqlite3changeset_op(
8971
9446
  sqlite3_changeset_iter *pIter, /* Iterator object */
8972
9447
  const char **pzTab, /* OUT: Pointer to table name */
8973
9448
  int *pnCol, /* OUT: Number of columns in table */
@@ -8992,7 +9467,7 @@ int sqlite3changeset_op(
8992
9467
  ** 0x01 if the corresponding column is part of the tables primary key, or
8993
9468
  ** 0x00 if it is not.
8994
9469
  **
8995
- ** If argumet pnCol is not NULL, then *pnCol is set to the number of columns
9470
+ ** If argument pnCol is not NULL, then *pnCol is set to the number of columns
8996
9471
  ** in the table.
8997
9472
  **
8998
9473
  ** If this function is called when the iterator does not point to a valid
@@ -9000,7 +9475,7 @@ int sqlite3changeset_op(
9000
9475
  ** SQLITE_OK is returned and the output variables populated as described
9001
9476
  ** above.
9002
9477
  */
9003
- int sqlite3changeset_pk(
9478
+ SQLITE_API int sqlite3changeset_pk(
9004
9479
  sqlite3_changeset_iter *pIter, /* Iterator object */
9005
9480
  unsigned char **pabPK, /* OUT: Array of boolean - true for PK cols */
9006
9481
  int *pnCol /* OUT: Number of entries in output array */
@@ -9030,7 +9505,7 @@ int sqlite3changeset_pk(
9030
9505
  ** If some other error occurs (e.g. an OOM condition), an SQLite error code
9031
9506
  ** is returned and *ppValue is set to NULL.
9032
9507
  */
9033
- int sqlite3changeset_old(
9508
+ SQLITE_API int sqlite3changeset_old(
9034
9509
  sqlite3_changeset_iter *pIter, /* Changeset iterator */
9035
9510
  int iVal, /* Column number */
9036
9511
  sqlite3_value **ppValue /* OUT: Old value (or NULL pointer) */
@@ -9063,7 +9538,7 @@ int sqlite3changeset_old(
9063
9538
  ** If some other error occurs (e.g. an OOM condition), an SQLite error code
9064
9539
  ** is returned and *ppValue is set to NULL.
9065
9540
  */
9066
- int sqlite3changeset_new(
9541
+ SQLITE_API int sqlite3changeset_new(
9067
9542
  sqlite3_changeset_iter *pIter, /* Changeset iterator */
9068
9543
  int iVal, /* Column number */
9069
9544
  sqlite3_value **ppValue /* OUT: New value (or NULL pointer) */
@@ -9090,7 +9565,7 @@ int sqlite3changeset_new(
9090
9565
  ** If some other error occurs (e.g. an OOM condition), an SQLite error code
9091
9566
  ** is returned and *ppValue is set to NULL.
9092
9567
  */
9093
- int sqlite3changeset_conflict(
9568
+ SQLITE_API int sqlite3changeset_conflict(
9094
9569
  sqlite3_changeset_iter *pIter, /* Changeset iterator */
9095
9570
  int iVal, /* Column number */
9096
9571
  sqlite3_value **ppValue /* OUT: Value from conflicting row */
@@ -9106,7 +9581,7 @@ int sqlite3changeset_conflict(
9106
9581
  **
9107
9582
  ** In all other cases this function returns SQLITE_MISUSE.
9108
9583
  */
9109
- int sqlite3changeset_fk_conflicts(
9584
+ SQLITE_API int sqlite3changeset_fk_conflicts(
9110
9585
  sqlite3_changeset_iter *pIter, /* Changeset iterator */
9111
9586
  int *pnOut /* OUT: Number of FK violations */
9112
9587
  );
@@ -9139,7 +9614,7 @@ int sqlite3changeset_fk_conflicts(
9139
9614
  ** // An error has occurred
9140
9615
  ** }
9141
9616
  */
9142
- int sqlite3changeset_finalize(sqlite3_changeset_iter *pIter);
9617
+ SQLITE_API int sqlite3changeset_finalize(sqlite3_changeset_iter *pIter);
9143
9618
 
9144
9619
  /*
9145
9620
  ** CAPI3REF: Invert A Changeset
@@ -9169,7 +9644,7 @@ int sqlite3changeset_finalize(sqlite3_changeset_iter *pIter);
9169
9644
  ** WARNING/TODO: This function currently assumes that the input is a valid
9170
9645
  ** changeset. If it is not, the results are undefined.
9171
9646
  */
9172
- int sqlite3changeset_invert(
9647
+ SQLITE_API int sqlite3changeset_invert(
9173
9648
  int nIn, const void *pIn, /* Input changeset */
9174
9649
  int *pnOut, void **ppOut /* OUT: Inverse of input */
9175
9650
  );
@@ -9198,7 +9673,7 @@ int sqlite3changeset_invert(
9198
9673
  **
9199
9674
  ** Refer to the sqlite3_changegroup documentation below for details.
9200
9675
  */
9201
- int sqlite3changeset_concat(
9676
+ SQLITE_API int sqlite3changeset_concat(
9202
9677
  int nA, /* Number of bytes in buffer pA */
9203
9678
  void *pA, /* Pointer to buffer containing changeset A */
9204
9679
  int nB, /* Number of bytes in buffer pB */
@@ -9209,12 +9684,12 @@ int sqlite3changeset_concat(
9209
9684
 
9210
9685
 
9211
9686
  /*
9212
- ** Changegroup handle.
9687
+ ** CAPI3REF: Changegroup Handle
9213
9688
  */
9214
9689
  typedef struct sqlite3_changegroup sqlite3_changegroup;
9215
9690
 
9216
9691
  /*
9217
- ** CAPI3REF: Combine two or more changesets into a single changeset.
9692
+ ** CAPI3REF: Create A New Changegroup Object
9218
9693
  **
9219
9694
  ** An sqlite3_changegroup object is used to combine two or more changesets
9220
9695
  ** (or patchsets) into a single changeset (or patchset). A single changegroup
@@ -9248,9 +9723,11 @@ typedef struct sqlite3_changegroup sqlite3_changegroup;
9248
9723
  ** sqlite3changegroup_output() functions, also available are the streaming
9249
9724
  ** versions sqlite3changegroup_add_strm() and sqlite3changegroup_output_strm().
9250
9725
  */
9251
- int sqlite3changegroup_new(sqlite3_changegroup **pp);
9726
+ SQLITE_API int sqlite3changegroup_new(sqlite3_changegroup **pp);
9252
9727
 
9253
9728
  /*
9729
+ ** CAPI3REF: Add A Changeset To A Changegroup
9730
+ **
9254
9731
  ** Add all changes within the changeset (or patchset) in buffer pData (size
9255
9732
  ** nData bytes) to the changegroup.
9256
9733
  **
@@ -9265,7 +9742,7 @@ int sqlite3changegroup_new(sqlite3_changegroup **pp);
9265
9742
  ** apply to the same row as a change already present in the changegroup if
9266
9743
  ** the two rows have the same primary key.
9267
9744
  **
9268
- ** Changes to rows that that do not already appear in the changegroup are
9745
+ ** Changes to rows that do not already appear in the changegroup are
9269
9746
  ** simply copied into it. Or, if both the new changeset and the changegroup
9270
9747
  ** contain changes that apply to a single row, the final contents of the
9271
9748
  ** changegroup depends on the type of each change, as follows:
@@ -9323,9 +9800,11 @@ int sqlite3changegroup_new(sqlite3_changegroup **pp);
9323
9800
  **
9324
9801
  ** If no error occurs, SQLITE_OK is returned.
9325
9802
  */
9326
- int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData);
9803
+ SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData);
9327
9804
 
9328
9805
  /*
9806
+ ** CAPI3REF: Obtain A Composite Changeset From A Changegroup
9807
+ **
9329
9808
  ** Obtain a buffer containing a changeset (or patchset) representing the
9330
9809
  ** current contents of the changegroup. If the inputs to the changegroup
9331
9810
  ** were themselves changesets, the output is a changeset. Or, if the
@@ -9347,16 +9826,16 @@ int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData);
9347
9826
  ** responsibility of the caller to eventually free the buffer using a
9348
9827
  ** call to sqlite3_free().
9349
9828
  */
9350
- int sqlite3changegroup_output(
9829
+ SQLITE_API int sqlite3changegroup_output(
9351
9830
  sqlite3_changegroup*,
9352
9831
  int *pnData, /* OUT: Size of output buffer in bytes */
9353
9832
  void **ppData /* OUT: Pointer to output buffer */
9354
9833
  );
9355
9834
 
9356
9835
  /*
9357
- ** Delete a changegroup object.
9836
+ ** CAPI3REF: Delete A Changegroup Object
9358
9837
  */
9359
- void sqlite3changegroup_delete(sqlite3_changegroup*);
9838
+ SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup*);
9360
9839
 
9361
9840
  /*
9362
9841
  ** CAPI3REF: Apply A Changeset To A Database
@@ -9382,7 +9861,7 @@ void sqlite3changegroup_delete(sqlite3_changegroup*);
9382
9861
  ** <ul>
9383
9862
  ** <li> The table has the same name as the name recorded in the
9384
9863
  ** changeset, and
9385
- ** <li> The table has the same number of columns as recorded in the
9864
+ ** <li> The table has at least as many columns as recorded in the
9386
9865
  ** changeset, and
9387
9866
  ** <li> The table has primary key columns in the same position as
9388
9867
  ** recorded in the changeset.
@@ -9427,7 +9906,11 @@ void sqlite3changegroup_delete(sqlite3_changegroup*);
9427
9906
  ** If a row with matching primary key values is found, but one or more of
9428
9907
  ** the non-primary key fields contains a value different from the original
9429
9908
  ** row value stored in the changeset, the conflict-handler function is
9430
- ** invoked with [SQLITE_CHANGESET_DATA] as the second argument.
9909
+ ** invoked with [SQLITE_CHANGESET_DATA] as the second argument. If the
9910
+ ** database table has more columns than are recorded in the changeset,
9911
+ ** only the values of those non-primary key fields are compared against
9912
+ ** the current database contents - any trailing database table columns
9913
+ ** are ignored.
9431
9914
  **
9432
9915
  ** If no row with matching primary key values is found in the database,
9433
9916
  ** the conflict-handler function is invoked with [SQLITE_CHANGESET_NOTFOUND]
@@ -9442,7 +9925,9 @@ void sqlite3changegroup_delete(sqlite3_changegroup*);
9442
9925
  **
9443
9926
  ** <dt>INSERT Changes<dd>
9444
9927
  ** For each INSERT change, an attempt is made to insert the new row into
9445
- ** the database.
9928
+ ** the database. If the changeset row contains fewer fields than the
9929
+ ** database table, the trailing fields are populated with their default
9930
+ ** values.
9446
9931
  **
9447
9932
  ** If the attempt to insert the row fails because the database already
9448
9933
  ** contains a row with the same primary key values, the conflict handler
@@ -9460,13 +9945,13 @@ void sqlite3changegroup_delete(sqlite3_changegroup*);
9460
9945
  ** For each UPDATE change, this function checks if the target database
9461
9946
  ** contains a row with the same primary key value (or values) as the
9462
9947
  ** original row values stored in the changeset. If it does, and the values
9463
- ** stored in all non-primary key columns also match the values stored in
9464
- ** the changeset the row is updated within the target database.
9948
+ ** stored in all modified non-primary key columns also match the values
9949
+ ** stored in the changeset the row is updated within the target database.
9465
9950
  **
9466
9951
  ** If a row with matching primary key values is found, but one or more of
9467
- ** the non-primary key fields contains a value different from an original
9468
- ** row value stored in the changeset, the conflict-handler function is
9469
- ** invoked with [SQLITE_CHANGESET_DATA] as the second argument. Since
9952
+ ** the modified non-primary key fields contains a value different from an
9953
+ ** original row value stored in the changeset, the conflict-handler function
9954
+ ** is invoked with [SQLITE_CHANGESET_DATA] as the second argument. Since
9470
9955
  ** UPDATE changes only contain values for non-primary key fields that are
9471
9956
  ** to be modified, only those fields need to match the original values to
9472
9957
  ** avoid the SQLITE_CHANGESET_DATA conflict-handler callback.
@@ -9494,7 +9979,7 @@ void sqlite3changegroup_delete(sqlite3_changegroup*);
9494
9979
  ** rolled back, restoring the target database to its original state, and an
9495
9980
  ** SQLite error code returned.
9496
9981
  */
9497
- int sqlite3changeset_apply(
9982
+ SQLITE_API int sqlite3changeset_apply(
9498
9983
  sqlite3 *db, /* Apply change to "main" db of this handle */
9499
9984
  int nChangeset, /* Size of changeset in bytes */
9500
9985
  void *pChangeset, /* Changeset blob */
@@ -9614,12 +10099,12 @@ int sqlite3changeset_apply(
9614
10099
  **
9615
10100
  ** <table border=1 style="margin-left:8ex;margin-right:8ex">
9616
10101
  ** <tr><th>Streaming function<th>Non-streaming equivalent</th>
9617
- ** <tr><td>sqlite3changeset_apply_str<td>[sqlite3changeset_apply]
9618
- ** <tr><td>sqlite3changeset_concat_str<td>[sqlite3changeset_concat]
9619
- ** <tr><td>sqlite3changeset_invert_str<td>[sqlite3changeset_invert]
9620
- ** <tr><td>sqlite3changeset_start_str<td>[sqlite3changeset_start]
9621
- ** <tr><td>sqlite3session_changeset_str<td>[sqlite3session_changeset]
9622
- ** <tr><td>sqlite3session_patchset_str<td>[sqlite3session_patchset]
10102
+ ** <tr><td>sqlite3changeset_apply_strm<td>[sqlite3changeset_apply]
10103
+ ** <tr><td>sqlite3changeset_concat_strm<td>[sqlite3changeset_concat]
10104
+ ** <tr><td>sqlite3changeset_invert_strm<td>[sqlite3changeset_invert]
10105
+ ** <tr><td>sqlite3changeset_start_strm<td>[sqlite3changeset_start]
10106
+ ** <tr><td>sqlite3session_changeset_strm<td>[sqlite3session_changeset]
10107
+ ** <tr><td>sqlite3session_patchset_strm<td>[sqlite3session_patchset]
9623
10108
  ** </table>
9624
10109
  **
9625
10110
  ** Non-streaming functions that accept changesets (or patchsets) as input
@@ -9695,7 +10180,7 @@ int sqlite3changeset_apply(
9695
10180
  ** parameter set to a value less than or equal to zero. Other than this,
9696
10181
  ** no guarantees are made as to the size of the chunks of data returned.
9697
10182
  */
9698
- int sqlite3changeset_apply_strm(
10183
+ SQLITE_API int sqlite3changeset_apply_strm(
9699
10184
  sqlite3 *db, /* Apply change to "main" db of this handle */
9700
10185
  int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */
9701
10186
  void *pIn, /* First arg for xInput */
@@ -9710,7 +10195,7 @@ int sqlite3changeset_apply_strm(
9710
10195
  ),
9711
10196
  void *pCtx /* First argument passed to xConflict */
9712
10197
  );
9713
- int sqlite3changeset_concat_strm(
10198
+ SQLITE_API int sqlite3changeset_concat_strm(
9714
10199
  int (*xInputA)(void *pIn, void *pData, int *pnData),
9715
10200
  void *pInA,
9716
10201
  int (*xInputB)(void *pIn, void *pData, int *pnData),
@@ -9718,32 +10203,32 @@ int sqlite3changeset_concat_strm(
9718
10203
  int (*xOutput)(void *pOut, const void *pData, int nData),
9719
10204
  void *pOut
9720
10205
  );
9721
- int sqlite3changeset_invert_strm(
10206
+ SQLITE_API int sqlite3changeset_invert_strm(
9722
10207
  int (*xInput)(void *pIn, void *pData, int *pnData),
9723
10208
  void *pIn,
9724
10209
  int (*xOutput)(void *pOut, const void *pData, int nData),
9725
10210
  void *pOut
9726
10211
  );
9727
- int sqlite3changeset_start_strm(
10212
+ SQLITE_API int sqlite3changeset_start_strm(
9728
10213
  sqlite3_changeset_iter **pp,
9729
10214
  int (*xInput)(void *pIn, void *pData, int *pnData),
9730
10215
  void *pIn
9731
10216
  );
9732
- int sqlite3session_changeset_strm(
10217
+ SQLITE_API int sqlite3session_changeset_strm(
9733
10218
  sqlite3_session *pSession,
9734
10219
  int (*xOutput)(void *pOut, const void *pData, int nData),
9735
10220
  void *pOut
9736
10221
  );
9737
- int sqlite3session_patchset_strm(
10222
+ SQLITE_API int sqlite3session_patchset_strm(
9738
10223
  sqlite3_session *pSession,
9739
10224
  int (*xOutput)(void *pOut, const void *pData, int nData),
9740
10225
  void *pOut
9741
10226
  );
9742
- int sqlite3changegroup_add_strm(sqlite3_changegroup*,
10227
+ SQLITE_API int sqlite3changegroup_add_strm(sqlite3_changegroup*,
9743
10228
  int (*xInput)(void *pIn, void *pData, int *pnData),
9744
10229
  void *pIn
9745
10230
  );
9746
- int sqlite3changegroup_output_strm(sqlite3_changegroup*,
10231
+ SQLITE_API int sqlite3changegroup_output_strm(sqlite3_changegroup*,
9747
10232
  int (*xOutput)(void *pOut, const void *pData, int nData),
9748
10233
  void *pOut
9749
10234
  );