Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: third_party/sqlite/amalgamation/sqlite3.h

Issue 1610963002: Import SQLite 3.10.2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 ** 2001 September 15 2 ** 2001 September 15
3 ** 3 **
4 ** The author disclaims copyright to this source code. In place of 4 ** The author disclaims copyright to this source code. In place of
5 ** a legal notice, here is a blessing: 5 ** a legal notice, here is a blessing:
6 ** 6 **
7 ** May you do good and not evil. 7 ** May you do good and not evil.
8 ** May you find forgiveness for yourself and forgive others. 8 ** May you find forgiveness for yourself and forgive others.
9 ** May you share freely, never taking more than you give. 9 ** May you share freely, never taking more than you give.
10 ** 10 **
11 ************************************************************************* 11 *************************************************************************
12 ** This header file defines the interface that the SQLite library 12 ** This header file defines the interface that the SQLite library
13 ** presents to client programs. If a C-function, structure, datatype, 13 ** presents to client programs. If a C-function, structure, datatype,
14 ** or constant definition does not appear in this file, then it is 14 ** or constant definition does not appear in this file, then it is
15 ** not a published API of SQLite, is subject to change without 15 ** not a published API of SQLite, is subject to change without
16 ** notice, and should not be referenced by programs that use SQLite. 16 ** notice, and should not be referenced by programs that use SQLite.
17 ** 17 **
18 ** Some of the definitions that are in this file are marked as 18 ** Some of the definitions that are in this file are marked as
19 ** "experimental". Experimental interfaces are normally new 19 ** "experimental". Experimental interfaces are normally new
20 ** features recently added to SQLite. We do not anticipate changes 20 ** features recently added to SQLite. We do not anticipate changes
21 ** to experimental interfaces but reserve the right to make minor changes 21 ** to experimental interfaces but reserve the right to make minor changes
22 ** if experience from use "in the wild" suggest such changes are prudent. 22 ** if experience from use "in the wild" suggest such changes are prudent.
23 ** 23 **
24 ** The official C-language API documentation for SQLite is derived 24 ** The official C-language API documentation for SQLite is derived
25 ** from comments in this file. This file is the authoritative source 25 ** from comments in this file. This file is the authoritative source
26 ** on how SQLite interfaces are suppose to operate. 26 ** on how SQLite interfaces are supposed to operate.
27 ** 27 **
28 ** The name of this file under configuration management is "sqlite.h.in". 28 ** The name of this file under configuration management is "sqlite.h.in".
29 ** The makefile makes some minor changes to this file (such as inserting 29 ** The makefile makes some minor changes to this file (such as inserting
30 ** the version number) and changes its name to "sqlite3.h" as 30 ** the version number) and changes its name to "sqlite3.h" as
31 ** part of the build process. 31 ** part of the build process.
32 */ 32 */
33 #ifndef _SQLITE3_H_ 33 #ifndef _SQLITE3_H_
34 #define _SQLITE3_H_ 34 #define _SQLITE3_H_
35 #include <stdarg.h> /* Needed for the definition of va_list */ 35 #include <stdarg.h> /* Needed for the definition of va_list */
36 36
37 /* 37 /*
38 ** Make sure we can call this stuff from C++. 38 ** Make sure we can call this stuff from C++.
39 */ 39 */
40 #ifdef __cplusplus 40 #ifdef __cplusplus
41 extern "C" { 41 extern "C" {
42 #endif 42 #endif
43 43
44 44
45 /* 45 /*
46 ** Add the ability to override 'extern' 46 ** Provide the ability to override linkage features of the interface.
47 */ 47 */
48 #ifndef SQLITE_EXTERN 48 #ifndef SQLITE_EXTERN
49 # define SQLITE_EXTERN extern 49 # define SQLITE_EXTERN extern
50 #endif 50 #endif
51
52 #ifndef SQLITE_API 51 #ifndef SQLITE_API
53 # define SQLITE_API 52 # define SQLITE_API
54 #endif 53 #endif
55 54 #ifndef SQLITE_CDECL
55 # define SQLITE_CDECL
56 #endif
57 #ifndef SQLITE_STDCALL
58 # define SQLITE_STDCALL
59 #endif
56 60
57 /* 61 /*
58 ** These no-op macros are used in front of interfaces to mark those 62 ** These no-op macros are used in front of interfaces to mark those
59 ** interfaces as either deprecated or experimental. New applications 63 ** interfaces as either deprecated or experimental. New applications
60 ** should not use deprecated interfaces - they are support for backwards 64 ** should not use deprecated interfaces - they are supported for backwards
61 ** compatibility only. Application writers should be aware that 65 ** compatibility only. Application writers should be aware that
62 ** experimental interfaces are subject to change in point releases. 66 ** experimental interfaces are subject to change in point releases.
63 ** 67 **
64 ** These macros used to resolve to various kinds of compiler magic that 68 ** These macros used to resolve to various kinds of compiler magic that
65 ** would generate warning messages when they were used. But that 69 ** would generate warning messages when they were used. But that
66 ** compiler magic ended up generating such a flurry of bug reports 70 ** compiler magic ended up generating such a flurry of bug reports
67 ** that we have taken it all out and gone back to using simple 71 ** that we have taken it all out and gone back to using simple
68 ** noop macros. 72 ** noop macros.
69 */ 73 */
70 #define SQLITE_DEPRECATED 74 #define SQLITE_DEPRECATED
(...skipping 29 matching lines...) Expand all
100 ** system</a>. ^The SQLITE_SOURCE_ID macro evaluates to 104 ** system</a>. ^The SQLITE_SOURCE_ID macro evaluates to
101 ** a string which identifies a particular check-in of SQLite 105 ** a string which identifies a particular check-in of SQLite
102 ** within its configuration management system. ^The SQLITE_SOURCE_ID 106 ** within its configuration management system. ^The SQLITE_SOURCE_ID
103 ** string contains the date and time of the check-in (UTC) and an SHA1 107 ** string contains the date and time of the check-in (UTC) and an SHA1
104 ** hash of the entire source tree. 108 ** hash of the entire source tree.
105 ** 109 **
106 ** See also: [sqlite3_libversion()], 110 ** See also: [sqlite3_libversion()],
107 ** [sqlite3_libversion_number()], [sqlite3_sourceid()], 111 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108 ** [sqlite_version()] and [sqlite_source_id()]. 112 ** [sqlite_version()] and [sqlite_source_id()].
109 */ 113 */
110 #define SQLITE_VERSION "3.8.7.4" 114 #define SQLITE_VERSION "3.10.2"
111 #define SQLITE_VERSION_NUMBER 3008007 115 #define SQLITE_VERSION_NUMBER 3010002
112 #define SQLITE_SOURCE_ID "2014-12-09 01:34:36 f66f7a17b78ba617acde90fc81010 7f34f1a1f2e" 116 #define SQLITE_SOURCE_ID "2016-01-20 15:27:19 17efb4209f97fb4971656086b1385 99a91a75ff9"
113 117
114 /* 118 /*
115 ** CAPI3REF: Run-Time Library Version Numbers 119 ** CAPI3REF: Run-Time Library Version Numbers
116 ** KEYWORDS: sqlite3_version, sqlite3_sourceid 120 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
117 ** 121 **
118 ** These interfaces provide the same information as the [SQLITE_VERSION], 122 ** These interfaces provide the same information as the [SQLITE_VERSION],
119 ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros 123 ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros
120 ** but are associated with the library instead of the header file. ^(Cautious 124 ** but are associated with the library instead of the header file. ^(Cautious
121 ** programmers might include assert() statements in their application to 125 ** programmers might include assert() statements in their application to
122 ** verify that values returned by these interfaces match the macros in 126 ** verify that values returned by these interfaces match the macros in
123 ** the header, and thus insure that the application is 127 ** the header, and thus ensure that the application is
124 ** compiled with matching library and header files. 128 ** compiled with matching library and header files.
125 ** 129 **
126 ** <blockquote><pre> 130 ** <blockquote><pre>
127 ** assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER ); 131 ** assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER );
128 ** assert( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)==0 ); 132 ** assert( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)==0 );
129 ** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 ); 133 ** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 );
130 ** </pre></blockquote>)^ 134 ** </pre></blockquote>)^
131 ** 135 **
132 ** ^The sqlite3_version[] string constant contains the text of [SQLITE_VERSION] 136 ** ^The sqlite3_version[] string constant contains the text of [SQLITE_VERSION]
133 ** macro. ^The sqlite3_libversion() function returns a pointer to the 137 ** macro. ^The sqlite3_libversion() function returns a pointer to the
134 ** to the sqlite3_version[] string constant. The sqlite3_libversion() 138 ** to the sqlite3_version[] string constant. The sqlite3_libversion()
135 ** function is provided for use in DLLs since DLL users usually do not have 139 ** function is provided for use in DLLs since DLL users usually do not have
136 ** direct access to string constants within the DLL. ^The 140 ** direct access to string constants within the DLL. ^The
137 ** sqlite3_libversion_number() function returns an integer equal to 141 ** sqlite3_libversion_number() function returns an integer equal to
138 ** [SQLITE_VERSION_NUMBER]. ^The sqlite3_sourceid() function returns 142 ** [SQLITE_VERSION_NUMBER]. ^The sqlite3_sourceid() function returns
139 ** a pointer to a string constant whose value is the same as the 143 ** a pointer to a string constant whose value is the same as the
140 ** [SQLITE_SOURCE_ID] C preprocessor macro. 144 ** [SQLITE_SOURCE_ID] C preprocessor macro.
141 ** 145 **
142 ** See also: [sqlite_version()] and [sqlite_source_id()]. 146 ** See also: [sqlite_version()] and [sqlite_source_id()].
143 */ 147 */
144 SQLITE_API SQLITE_EXTERN const char sqlite3_version[]; 148 SQLITE_API SQLITE_EXTERN const char sqlite3_version[];
145 SQLITE_API const char *sqlite3_libversion(void); 149 SQLITE_API const char *SQLITE_STDCALL sqlite3_libversion(void);
146 SQLITE_API const char *sqlite3_sourceid(void); 150 SQLITE_API const char *SQLITE_STDCALL sqlite3_sourceid(void);
147 SQLITE_API int sqlite3_libversion_number(void); 151 SQLITE_API int SQLITE_STDCALL sqlite3_libversion_number(void);
148 152
149 /* 153 /*
150 ** CAPI3REF: Run-Time Library Compilation Options Diagnostics 154 ** CAPI3REF: Run-Time Library Compilation Options Diagnostics
151 ** 155 **
152 ** ^The sqlite3_compileoption_used() function returns 0 or 1 156 ** ^The sqlite3_compileoption_used() function returns 0 or 1
153 ** indicating whether the specified option was defined at 157 ** indicating whether the specified option was defined at
154 ** compile time. ^The SQLITE_ prefix may be omitted from the 158 ** compile time. ^The SQLITE_ prefix may be omitted from the
155 ** option name passed to sqlite3_compileoption_used(). 159 ** option name passed to sqlite3_compileoption_used().
156 ** 160 **
157 ** ^The sqlite3_compileoption_get() function allows iterating 161 ** ^The sqlite3_compileoption_get() function allows iterating
158 ** over the list of options that were defined at compile time by 162 ** over the list of options that were defined at compile time by
159 ** returning the N-th compile time option string. ^If N is out of range, 163 ** returning the N-th compile time option string. ^If N is out of range,
160 ** sqlite3_compileoption_get() returns a NULL pointer. ^The SQLITE_ 164 ** sqlite3_compileoption_get() returns a NULL pointer. ^The SQLITE_
161 ** prefix is omitted from any strings returned by 165 ** prefix is omitted from any strings returned by
162 ** sqlite3_compileoption_get(). 166 ** sqlite3_compileoption_get().
163 ** 167 **
164 ** ^Support for the diagnostic functions sqlite3_compileoption_used() 168 ** ^Support for the diagnostic functions sqlite3_compileoption_used()
165 ** and sqlite3_compileoption_get() may be omitted by specifying the 169 ** and sqlite3_compileoption_get() may be omitted by specifying the
166 ** [SQLITE_OMIT_COMPILEOPTION_DIAGS] option at compile time. 170 ** [SQLITE_OMIT_COMPILEOPTION_DIAGS] option at compile time.
167 ** 171 **
168 ** See also: SQL functions [sqlite_compileoption_used()] and 172 ** See also: SQL functions [sqlite_compileoption_used()] and
169 ** [sqlite_compileoption_get()] and the [compile_options pragma]. 173 ** [sqlite_compileoption_get()] and the [compile_options pragma].
170 */ 174 */
171 #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS 175 #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
172 SQLITE_API int sqlite3_compileoption_used(const char *zOptName); 176 SQLITE_API int SQLITE_STDCALL sqlite3_compileoption_used(const char *zOptName);
173 SQLITE_API const char *sqlite3_compileoption_get(int N); 177 SQLITE_API const char *SQLITE_STDCALL sqlite3_compileoption_get(int N);
174 #endif 178 #endif
175 179
176 /* 180 /*
177 ** CAPI3REF: Test To See If The Library Is Threadsafe 181 ** CAPI3REF: Test To See If The Library Is Threadsafe
178 ** 182 **
179 ** ^The sqlite3_threadsafe() function returns zero if and only if 183 ** ^The sqlite3_threadsafe() function returns zero if and only if
180 ** SQLite was compiled with mutexing code omitted due to the 184 ** SQLite was compiled with mutexing code omitted due to the
181 ** [SQLITE_THREADSAFE] compile-time option being set to 0. 185 ** [SQLITE_THREADSAFE] compile-time option being set to 0.
182 ** 186 **
183 ** SQLite can be compiled with or without mutexes. When 187 ** SQLite can be compiled with or without mutexes. When
(...skipping 10 matching lines...) Expand all
194 ** 198 **
195 ** This interface can be used by an application to make sure that the 199 ** This interface can be used by an application to make sure that the
196 ** version of SQLite that it is linking against was compiled with 200 ** version of SQLite that it is linking against was compiled with
197 ** the desired setting of the [SQLITE_THREADSAFE] macro. 201 ** the desired setting of the [SQLITE_THREADSAFE] macro.
198 ** 202 **
199 ** This interface only reports on the compile-time mutex setting 203 ** This interface only reports on the compile-time mutex setting
200 ** of the [SQLITE_THREADSAFE] flag. If SQLite is compiled with 204 ** of the [SQLITE_THREADSAFE] flag. If SQLite is compiled with
201 ** SQLITE_THREADSAFE=1 or =2 then mutexes are enabled by default but 205 ** SQLITE_THREADSAFE=1 or =2 then mutexes are enabled by default but
202 ** can be fully or partially disabled using a call to [sqlite3_config()] 206 ** can be fully or partially disabled using a call to [sqlite3_config()]
203 ** with the verbs [SQLITE_CONFIG_SINGLETHREAD], [SQLITE_CONFIG_MULTITHREAD], 207 ** with the verbs [SQLITE_CONFIG_SINGLETHREAD], [SQLITE_CONFIG_MULTITHREAD],
204 ** or [SQLITE_CONFIG_MUTEX]. ^(The return value of the 208 ** or [SQLITE_CONFIG_SERIALIZED]. ^(The return value of the
205 ** sqlite3_threadsafe() function shows only the compile-time setting of 209 ** sqlite3_threadsafe() function shows only the compile-time setting of
206 ** thread safety, not any run-time changes to that setting made by 210 ** thread safety, not any run-time changes to that setting made by
207 ** sqlite3_config(). In other words, the return value from sqlite3_threadsafe() 211 ** sqlite3_config(). In other words, the return value from sqlite3_threadsafe()
208 ** is unchanged by calls to sqlite3_config().)^ 212 ** is unchanged by calls to sqlite3_config().)^
209 ** 213 **
210 ** See the [threading mode] documentation for additional information. 214 ** See the [threading mode] documentation for additional information.
211 */ 215 */
212 SQLITE_API int sqlite3_threadsafe(void); 216 SQLITE_API int SQLITE_STDCALL sqlite3_threadsafe(void);
213 217
214 /* 218 /*
215 ** CAPI3REF: Database Connection Handle 219 ** CAPI3REF: Database Connection Handle
216 ** KEYWORDS: {database connection} {database connections} 220 ** KEYWORDS: {database connection} {database connections}
217 ** 221 **
218 ** Each open SQLite database is represented by a pointer to an instance of 222 ** Each open SQLite database is represented by a pointer to an instance of
219 ** the opaque structure named "sqlite3". It is useful to think of an sqlite3 223 ** the opaque structure named "sqlite3". It is useful to think of an sqlite3
220 ** pointer as an object. The [sqlite3_open()], [sqlite3_open16()], and 224 ** pointer as an object. The [sqlite3_open()], [sqlite3_open16()], and
221 ** [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()] 225 ** [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()]
222 ** and [sqlite3_close_v2()] are its destructors. There are many other 226 ** and [sqlite3_close_v2()] are its destructors. There are many other
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 /* 263 /*
260 ** If compiling for a processor that lacks floating point support, 264 ** If compiling for a processor that lacks floating point support,
261 ** substitute integer for floating-point. 265 ** substitute integer for floating-point.
262 */ 266 */
263 #ifdef SQLITE_OMIT_FLOATING_POINT 267 #ifdef SQLITE_OMIT_FLOATING_POINT
264 # define double sqlite3_int64 268 # define double sqlite3_int64
265 #endif 269 #endif
266 270
267 /* 271 /*
268 ** CAPI3REF: Closing A Database Connection 272 ** CAPI3REF: Closing A Database Connection
273 ** DESTRUCTOR: sqlite3
269 ** 274 **
270 ** ^The sqlite3_close() and sqlite3_close_v2() routines are destructors 275 ** ^The sqlite3_close() and sqlite3_close_v2() routines are destructors
271 ** for the [sqlite3] object. 276 ** for the [sqlite3] object.
272 ** ^Calls to sqlite3_close() and sqlite3_close_v2() return [SQLITE_OK] if 277 ** ^Calls to sqlite3_close() and sqlite3_close_v2() return [SQLITE_OK] if
273 ** the [sqlite3] object is successfully destroyed and all associated 278 ** the [sqlite3] object is successfully destroyed and all associated
274 ** resources are deallocated. 279 ** resources are deallocated.
275 ** 280 **
276 ** ^If the database connection is associated with unfinalized prepared 281 ** ^If the database connection is associated with unfinalized prepared
277 ** statements or unfinished sqlite3_backup objects then sqlite3_close() 282 ** statements or unfinished sqlite3_backup objects then sqlite3_close()
278 ** will leave the database connection open and return [SQLITE_BUSY]. 283 ** will leave the database connection open and return [SQLITE_BUSY].
(...skipping 19 matching lines...) Expand all
298 ** the transaction is automatically rolled back. 303 ** the transaction is automatically rolled back.
299 ** 304 **
300 ** The C parameter to [sqlite3_close(C)] and [sqlite3_close_v2(C)] 305 ** The C parameter to [sqlite3_close(C)] and [sqlite3_close_v2(C)]
301 ** must be either a NULL 306 ** must be either a NULL
302 ** pointer or an [sqlite3] object pointer obtained 307 ** pointer or an [sqlite3] object pointer obtained
303 ** from [sqlite3_open()], [sqlite3_open16()], or 308 ** from [sqlite3_open()], [sqlite3_open16()], or
304 ** [sqlite3_open_v2()], and not previously closed. 309 ** [sqlite3_open_v2()], and not previously closed.
305 ** ^Calling sqlite3_close() or sqlite3_close_v2() with a NULL pointer 310 ** ^Calling sqlite3_close() or sqlite3_close_v2() with a NULL pointer
306 ** argument is a harmless no-op. 311 ** argument is a harmless no-op.
307 */ 312 */
308 SQLITE_API int sqlite3_close(sqlite3*); 313 SQLITE_API int SQLITE_STDCALL sqlite3_close(sqlite3*);
309 SQLITE_API int sqlite3_close_v2(sqlite3*); 314 SQLITE_API int SQLITE_STDCALL sqlite3_close_v2(sqlite3*);
310 315
311 /* 316 /*
312 ** The type for a callback function. 317 ** The type for a callback function.
313 ** This is legacy and deprecated. It is included for historical 318 ** This is legacy and deprecated. It is included for historical
314 ** compatibility and is not documented. 319 ** compatibility and is not documented.
315 */ 320 */
316 typedef int (*sqlite3_callback)(void*,int,char**, char**); 321 typedef int (*sqlite3_callback)(void*,int,char**, char**);
317 322
318 /* 323 /*
319 ** CAPI3REF: One-Step Query Execution Interface 324 ** CAPI3REF: One-Step Query Execution Interface
325 ** METHOD: sqlite3
320 ** 326 **
321 ** The sqlite3_exec() interface is a convenience wrapper around 327 ** The sqlite3_exec() interface is a convenience wrapper around
322 ** [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()], 328 ** [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()],
323 ** that allows an application to run multiple statements of SQL 329 ** that allows an application to run multiple statements of SQL
324 ** without having to use a lot of C code. 330 ** without having to use a lot of C code.
325 ** 331 **
326 ** ^The sqlite3_exec() interface runs zero or more UTF-8 encoded, 332 ** ^The sqlite3_exec() interface runs zero or more UTF-8 encoded,
327 ** semicolon-separate SQL statements passed into its 2nd argument, 333 ** semicolon-separate SQL statements passed into its 2nd argument,
328 ** in the context of the [database connection] passed in as its 1st 334 ** in the context of the [database connection] passed in as its 1st
329 ** argument. ^If the callback function of the 3rd argument to 335 ** argument. ^If the callback function of the 3rd argument to
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 ** from [sqlite3_column_name()]. 367 ** from [sqlite3_column_name()].
362 ** 368 **
363 ** ^If the 2nd parameter to sqlite3_exec() is a NULL pointer, a pointer 369 ** ^If the 2nd parameter to sqlite3_exec() is a NULL pointer, a pointer
364 ** to an empty string, or a pointer that contains only whitespace and/or 370 ** to an empty string, or a pointer that contains only whitespace and/or
365 ** SQL comments, then no SQL statements are evaluated and the database 371 ** SQL comments, then no SQL statements are evaluated and the database
366 ** is not changed. 372 ** is not changed.
367 ** 373 **
368 ** Restrictions: 374 ** Restrictions:
369 ** 375 **
370 ** <ul> 376 ** <ul>
371 ** <li> The application must insure that the 1st parameter to sqlite3_exec() 377 ** <li> The application must ensure that the 1st parameter to sqlite3_exec()
372 ** is a valid and open [database connection]. 378 ** is a valid and open [database connection].
373 ** <li> The application must not close the [database connection] specified by 379 ** <li> The application must not close the [database connection] specified by
374 ** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running. 380 ** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running.
375 ** <li> The application must not modify the SQL statement text passed into 381 ** <li> The application must not modify the SQL statement text passed into
376 ** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running. 382 ** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running.
377 ** </ul> 383 ** </ul>
378 */ 384 */
379 SQLITE_API int sqlite3_exec( 385 SQLITE_API int SQLITE_STDCALL sqlite3_exec(
380 sqlite3*, /* An open database */ 386 sqlite3*, /* An open database */
381 const char *sql, /* SQL to be evaluated */ 387 const char *sql, /* SQL to be evaluated */
382 int (*callback)(void*,int,char**,char**), /* Callback function */ 388 int (*callback)(void*,int,char**,char**), /* Callback function */
383 void *, /* 1st argument to callback */ 389 void *, /* 1st argument to callback */
384 char **errmsg /* Error msg written here */ 390 char **errmsg /* Error msg written here */
385 ); 391 );
386 392
387 /* 393 /*
388 ** CAPI3REF: Result Codes 394 ** CAPI3REF: Result Codes
389 ** KEYWORDS: {result code definitions} 395 ** KEYWORDS: {result code definitions}
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 #define SQLITE_IOERR_DIR_CLOSE (SQLITE_IOERR | (17<<8)) 470 #define SQLITE_IOERR_DIR_CLOSE (SQLITE_IOERR | (17<<8))
465 #define SQLITE_IOERR_SHMOPEN (SQLITE_IOERR | (18<<8)) 471 #define SQLITE_IOERR_SHMOPEN (SQLITE_IOERR | (18<<8))
466 #define SQLITE_IOERR_SHMSIZE (SQLITE_IOERR | (19<<8)) 472 #define SQLITE_IOERR_SHMSIZE (SQLITE_IOERR | (19<<8))
467 #define SQLITE_IOERR_SHMLOCK (SQLITE_IOERR | (20<<8)) 473 #define SQLITE_IOERR_SHMLOCK (SQLITE_IOERR | (20<<8))
468 #define SQLITE_IOERR_SHMMAP (SQLITE_IOERR | (21<<8)) 474 #define SQLITE_IOERR_SHMMAP (SQLITE_IOERR | (21<<8))
469 #define SQLITE_IOERR_SEEK (SQLITE_IOERR | (22<<8)) 475 #define SQLITE_IOERR_SEEK (SQLITE_IOERR | (22<<8))
470 #define SQLITE_IOERR_DELETE_NOENT (SQLITE_IOERR | (23<<8)) 476 #define SQLITE_IOERR_DELETE_NOENT (SQLITE_IOERR | (23<<8))
471 #define SQLITE_IOERR_MMAP (SQLITE_IOERR | (24<<8)) 477 #define SQLITE_IOERR_MMAP (SQLITE_IOERR | (24<<8))
472 #define SQLITE_IOERR_GETTEMPPATH (SQLITE_IOERR | (25<<8)) 478 #define SQLITE_IOERR_GETTEMPPATH (SQLITE_IOERR | (25<<8))
473 #define SQLITE_IOERR_CONVPATH (SQLITE_IOERR | (26<<8)) 479 #define SQLITE_IOERR_CONVPATH (SQLITE_IOERR | (26<<8))
480 #define SQLITE_IOERR_VNODE (SQLITE_IOERR | (27<<8))
481 #define SQLITE_IOERR_AUTH (SQLITE_IOERR | (28<<8))
474 #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8)) 482 #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8))
475 #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) 483 #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8))
476 #define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2<<8)) 484 #define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2<<8))
477 #define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) 485 #define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8))
478 #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) 486 #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8))
479 #define SQLITE_CANTOPEN_FULLPATH (SQLITE_CANTOPEN | (3<<8)) 487 #define SQLITE_CANTOPEN_FULLPATH (SQLITE_CANTOPEN | (3<<8))
480 #define SQLITE_CANTOPEN_CONVPATH (SQLITE_CANTOPEN | (4<<8)) 488 #define SQLITE_CANTOPEN_CONVPATH (SQLITE_CANTOPEN | (4<<8))
481 #define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1<<8)) 489 #define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1<<8))
482 #define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8)) 490 #define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8))
483 #define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8)) 491 #define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8))
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 }; 757 };
750 758
751 /* 759 /*
752 ** CAPI3REF: Standard File Control Opcodes 760 ** CAPI3REF: Standard File Control Opcodes
753 ** KEYWORDS: {file control opcodes} {file control opcode} 761 ** KEYWORDS: {file control opcodes} {file control opcode}
754 ** 762 **
755 ** These integer constants are opcodes for the xFileControl method 763 ** These integer constants are opcodes for the xFileControl method
756 ** of the [sqlite3_io_methods] object and for the [sqlite3_file_control()] 764 ** of the [sqlite3_io_methods] object and for the [sqlite3_file_control()]
757 ** interface. 765 ** interface.
758 ** 766 **
767 ** <ul>
768 ** <li>[[SQLITE_FCNTL_LOCKSTATE]]
759 ** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging. This 769 ** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging. This
760 ** opcode causes the xFileControl method to write the current state of 770 ** opcode causes the xFileControl method to write the current state of
761 ** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED], 771 ** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED],
762 ** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE]) 772 ** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE])
763 ** into an integer that the pArg argument points to. This capability 773 ** into an integer that the pArg argument points to. This capability
764 ** is used during testing and only needs to be supported when SQLITE_TEST 774 ** is used during testing and is only available when the SQLITE_TEST
765 ** is defined. 775 ** compile-time option is used.
766 ** <ul> 776 **
767 ** <li>[[SQLITE_FCNTL_SIZE_HINT]] 777 ** <li>[[SQLITE_FCNTL_SIZE_HINT]]
768 ** The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS 778 ** The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS
769 ** layer a hint of how large the database file will grow to be during the 779 ** layer a hint of how large the database file will grow to be during the
770 ** current transaction. This hint is not guaranteed to be accurate but it 780 ** current transaction. This hint is not guaranteed to be accurate but it
771 ** is often close. The underlying VFS might choose to preallocate database 781 ** is often close. The underlying VFS might choose to preallocate database
772 ** file space based on this hint in order to help writes to the database 782 ** file space based on this hint in order to help writes to the database
773 ** file run faster. 783 ** file run faster.
774 ** 784 **
775 ** <li>[[SQLITE_FCNTL_CHUNK_SIZE]] 785 ** <li>[[SQLITE_FCNTL_CHUNK_SIZE]]
776 ** The [SQLITE_FCNTL_CHUNK_SIZE] opcode is used to request that the VFS 786 ** The [SQLITE_FCNTL_CHUNK_SIZE] opcode is used to request that the VFS
777 ** extends and truncates the database file in chunks of a size specified 787 ** extends and truncates the database file in chunks of a size specified
778 ** by the user. The fourth argument to [sqlite3_file_control()] should 788 ** by the user. The fourth argument to [sqlite3_file_control()] should
779 ** point to an integer (type int) containing the new chunk-size to use 789 ** point to an integer (type int) containing the new chunk-size to use
780 ** for the nominated database. Allocating database file space in large 790 ** for the nominated database. Allocating database file space in large
781 ** chunks (say 1MB at a time), may reduce file-system fragmentation and 791 ** chunks (say 1MB at a time), may reduce file-system fragmentation and
782 ** improve performance on some systems. 792 ** improve performance on some systems.
783 ** 793 **
784 ** <li>[[SQLITE_FCNTL_FILE_POINTER]] 794 ** <li>[[SQLITE_FCNTL_FILE_POINTER]]
785 ** The [SQLITE_FCNTL_FILE_POINTER] opcode is used to obtain a pointer 795 ** The [SQLITE_FCNTL_FILE_POINTER] opcode is used to obtain a pointer
786 ** to the [sqlite3_file] object associated with a particular database 796 ** to the [sqlite3_file] object associated with a particular database
787 ** connection. See the [sqlite3_file_control()] documentation for 797 ** connection. See also [SQLITE_FCNTL_JOURNAL_POINTER].
788 ** additional information. 798 **
799 ** <li>[[SQLITE_FCNTL_JOURNAL_POINTER]]
800 ** The [SQLITE_FCNTL_JOURNAL_POINTER] opcode is used to obtain a pointer
801 ** to the [sqlite3_file] object associated with the journal file (either
802 ** the [rollback journal] or the [write-ahead log]) for a particular database
803 ** connection. See also [SQLITE_FCNTL_FILE_POINTER].
789 ** 804 **
790 ** <li>[[SQLITE_FCNTL_SYNC_OMITTED]] 805 ** <li>[[SQLITE_FCNTL_SYNC_OMITTED]]
791 ** No longer in use. 806 ** No longer in use.
792 ** 807 **
793 ** <li>[[SQLITE_FCNTL_SYNC]] 808 ** <li>[[SQLITE_FCNTL_SYNC]]
794 ** The [SQLITE_FCNTL_SYNC] opcode is generated internally by SQLite and 809 ** The [SQLITE_FCNTL_SYNC] opcode is generated internally by SQLite and
795 ** sent to the VFS immediately before the xSync method is invoked on a 810 ** sent to the VFS immediately before the xSync method is invoked on a
796 ** database file descriptor. Or, if the xSync method is not invoked 811 ** database file descriptor. Or, if the xSync method is not invoked
797 ** because the user has configured SQLite with 812 ** because the user has configured SQLite with
798 ** [PRAGMA synchronous | PRAGMA synchronous=OFF] it is invoked in place 813 ** [PRAGMA synchronous | PRAGMA synchronous=OFF] it is invoked in place
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 ** all [VFSes] in the VFS stack. The names are of all VFS shims and the 880 ** all [VFSes] in the VFS stack. The names are of all VFS shims and the
866 ** final bottom-level VFS are written into memory obtained from 881 ** final bottom-level VFS are written into memory obtained from
867 ** [sqlite3_malloc()] and the result is stored in the char* variable 882 ** [sqlite3_malloc()] and the result is stored in the char* variable
868 ** that the fourth parameter of [sqlite3_file_control()] points to. 883 ** that the fourth parameter of [sqlite3_file_control()] points to.
869 ** The caller is responsible for freeing the memory when done. As with 884 ** The caller is responsible for freeing the memory when done. As with
870 ** all file-control actions, there is no guarantee that this will actually 885 ** all file-control actions, there is no guarantee that this will actually
871 ** do anything. Callers should initialize the char* variable to a NULL 886 ** do anything. Callers should initialize the char* variable to a NULL
872 ** pointer in case this file-control is not implemented. This file-control 887 ** pointer in case this file-control is not implemented. This file-control
873 ** is intended for diagnostic use only. 888 ** is intended for diagnostic use only.
874 ** 889 **
890 ** <li>[[SQLITE_FCNTL_VFS_POINTER]]
891 ** ^The [SQLITE_FCNTL_VFS_POINTER] opcode finds a pointer to the top-level
892 ** [VFSes] currently in use. ^(The argument X in
893 ** sqlite3_file_control(db,SQLITE_FCNTL_VFS_POINTER,X) must be
894 ** of type "[sqlite3_vfs] **". This opcodes will set *X
895 ** to a pointer to the top-level VFS.)^
896 ** ^When there are multiple VFS shims in the stack, this opcode finds the
897 ** upper-most shim only.
898 **
875 ** <li>[[SQLITE_FCNTL_PRAGMA]] 899 ** <li>[[SQLITE_FCNTL_PRAGMA]]
876 ** ^Whenever a [PRAGMA] statement is parsed, an [SQLITE_FCNTL_PRAGMA] 900 ** ^Whenever a [PRAGMA] statement is parsed, an [SQLITE_FCNTL_PRAGMA]
877 ** file control is sent to the open [sqlite3_file] object corresponding 901 ** file control is sent to the open [sqlite3_file] object corresponding
878 ** to the database file to which the pragma statement refers. ^The argument 902 ** to the database file to which the pragma statement refers. ^The argument
879 ** to the [SQLITE_FCNTL_PRAGMA] file control is an array of 903 ** to the [SQLITE_FCNTL_PRAGMA] file control is an array of
880 ** pointers to strings (char**) in which the second element of the array 904 ** pointers to strings (char**) in which the second element of the array
881 ** is the name of the pragma and the third element is the argument to the 905 ** is the name of the pragma and the third element is the argument to the
882 ** pragma or NULL if the pragma has no argument. ^The handler for an 906 ** pragma or NULL if the pragma has no argument. ^The handler for an
883 ** [SQLITE_FCNTL_PRAGMA] file control can optionally make the first element 907 ** [SQLITE_FCNTL_PRAGMA] file control can optionally make the first element
884 ** of the char** argument point to a string obtained from [sqlite3_mprintf()] 908 ** of the char** argument point to a string obtained from [sqlite3_mprintf()]
885 ** or the equivalent and that string will become the result of the pragma or 909 ** or the equivalent and that string will become the result of the pragma or
886 ** the error message if the pragma fails. ^If the 910 ** the error message if the pragma fails. ^If the
887 ** [SQLITE_FCNTL_PRAGMA] file control returns [SQLITE_NOTFOUND], then normal 911 ** [SQLITE_FCNTL_PRAGMA] file control returns [SQLITE_NOTFOUND], then normal
888 ** [PRAGMA] processing continues. ^If the [SQLITE_FCNTL_PRAGMA] 912 ** [PRAGMA] processing continues. ^If the [SQLITE_FCNTL_PRAGMA]
889 ** file control returns [SQLITE_OK], then the parser assumes that the 913 ** file control returns [SQLITE_OK], then the parser assumes that the
890 ** VFS has handled the PRAGMA itself and the parser generates a no-op 914 ** VFS has handled the PRAGMA itself and the parser generates a no-op
891 ** prepared statement. ^If the [SQLITE_FCNTL_PRAGMA] file control returns 915 ** prepared statement if result string is NULL, or that returns a copy
916 ** of the result string if the string is non-NULL.
917 ** ^If the [SQLITE_FCNTL_PRAGMA] file control returns
892 ** any result code other than [SQLITE_OK] or [SQLITE_NOTFOUND], that means 918 ** any result code other than [SQLITE_OK] or [SQLITE_NOTFOUND], that means
893 ** that the VFS encountered an error while handling the [PRAGMA] and the 919 ** that the VFS encountered an error while handling the [PRAGMA] and the
894 ** compilation of the PRAGMA fails with an error. ^The [SQLITE_FCNTL_PRAGMA] 920 ** compilation of the PRAGMA fails with an error. ^The [SQLITE_FCNTL_PRAGMA]
895 ** file control occurs at the beginning of pragma statement analysis and so 921 ** file control occurs at the beginning of pragma statement analysis and so
896 ** it is able to override built-in [PRAGMA] statements. 922 ** it is able to override built-in [PRAGMA] statements.
897 ** 923 **
898 ** <li>[[SQLITE_FCNTL_BUSYHANDLER]] 924 ** <li>[[SQLITE_FCNTL_BUSYHANDLER]]
899 ** ^The [SQLITE_FCNTL_BUSYHANDLER] 925 ** ^The [SQLITE_FCNTL_BUSYHANDLER]
900 ** file-control may be invoked by SQLite on the database file handle 926 ** file-control may be invoked by SQLite on the database file handle
901 ** shortly after it is opened in order to provide a custom VFS with access 927 ** shortly after it is opened in order to provide a custom VFS with access
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 ** pointer to an integer and it writes a boolean into that integer depending 965 ** pointer to an integer and it writes a boolean into that integer depending
940 ** on whether or not the file has been renamed, moved, or deleted since it 966 ** on whether or not the file has been renamed, moved, or deleted since it
941 ** was first opened. 967 ** was first opened.
942 ** 968 **
943 ** <li>[[SQLITE_FCNTL_WIN32_SET_HANDLE]] 969 ** <li>[[SQLITE_FCNTL_WIN32_SET_HANDLE]]
944 ** The [SQLITE_FCNTL_WIN32_SET_HANDLE] opcode is used for debugging. This 970 ** The [SQLITE_FCNTL_WIN32_SET_HANDLE] opcode is used for debugging. This
945 ** opcode causes the xFileControl method to swap the file handle with the one 971 ** opcode causes the xFileControl method to swap the file handle with the one
946 ** pointed to by the pArg argument. This capability is used during testing 972 ** pointed to by the pArg argument. This capability is used during testing
947 ** and only needs to be supported when SQLITE_TEST is defined. 973 ** and only needs to be supported when SQLITE_TEST is defined.
948 ** 974 **
975 ** <li>[[SQLITE_FCNTL_WAL_BLOCK]]
976 ** The [SQLITE_FCNTL_WAL_BLOCK] is a signal to the VFS layer that it might
977 ** be advantageous to block on the next WAL lock if the lock is not immediately
978 ** available. The WAL subsystem issues this signal during rare
979 ** circumstances in order to fix a problem with priority inversion.
980 ** Applications should <em>not</em> use this file-control.
981 **
982 ** <li>[[SQLITE_FCNTL_ZIPVFS]]
983 ** The [SQLITE_FCNTL_ZIPVFS] opcode is implemented by zipvfs only. All other
984 ** VFS should return SQLITE_NOTFOUND for this opcode.
985 **
986 ** <li>[[SQLITE_FCNTL_RBU]]
987 ** The [SQLITE_FCNTL_RBU] opcode is implemented by the special VFS used by
988 ** the RBU extension only. All other VFS should return SQLITE_NOTFOUND for
989 ** this opcode.
949 ** </ul> 990 ** </ul>
950 */ 991 */
951 #define SQLITE_FCNTL_LOCKSTATE 1 992 #define SQLITE_FCNTL_LOCKSTATE 1
952 #define SQLITE_GET_LOCKPROXYFILE 2 993 #define SQLITE_FCNTL_GET_LOCKPROXYFILE 2
953 #define SQLITE_SET_LOCKPROXYFILE 3 994 #define SQLITE_FCNTL_SET_LOCKPROXYFILE 3
954 #define SQLITE_LAST_ERRNO 4 995 #define SQLITE_FCNTL_LAST_ERRNO 4
955 #define SQLITE_FCNTL_SIZE_HINT 5 996 #define SQLITE_FCNTL_SIZE_HINT 5
956 #define SQLITE_FCNTL_CHUNK_SIZE 6 997 #define SQLITE_FCNTL_CHUNK_SIZE 6
957 #define SQLITE_FCNTL_FILE_POINTER 7 998 #define SQLITE_FCNTL_FILE_POINTER 7
958 #define SQLITE_FCNTL_SYNC_OMITTED 8 999 #define SQLITE_FCNTL_SYNC_OMITTED 8
959 #define SQLITE_FCNTL_WIN32_AV_RETRY 9 1000 #define SQLITE_FCNTL_WIN32_AV_RETRY 9
960 #define SQLITE_FCNTL_PERSIST_WAL 10 1001 #define SQLITE_FCNTL_PERSIST_WAL 10
961 #define SQLITE_FCNTL_OVERWRITE 11 1002 #define SQLITE_FCNTL_OVERWRITE 11
962 #define SQLITE_FCNTL_VFSNAME 12 1003 #define SQLITE_FCNTL_VFSNAME 12
963 #define SQLITE_FCNTL_POWERSAFE_OVERWRITE 13 1004 #define SQLITE_FCNTL_POWERSAFE_OVERWRITE 13
964 #define SQLITE_FCNTL_PRAGMA 14 1005 #define SQLITE_FCNTL_PRAGMA 14
965 #define SQLITE_FCNTL_BUSYHANDLER 15 1006 #define SQLITE_FCNTL_BUSYHANDLER 15
966 #define SQLITE_FCNTL_TEMPFILENAME 16 1007 #define SQLITE_FCNTL_TEMPFILENAME 16
967 #define SQLITE_FCNTL_MMAP_SIZE 18 1008 #define SQLITE_FCNTL_MMAP_SIZE 18
968 #define SQLITE_FCNTL_TRACE 19 1009 #define SQLITE_FCNTL_TRACE 19
969 #define SQLITE_FCNTL_HAS_MOVED 20 1010 #define SQLITE_FCNTL_HAS_MOVED 20
970 #define SQLITE_FCNTL_SYNC 21 1011 #define SQLITE_FCNTL_SYNC 21
971 #define SQLITE_FCNTL_COMMIT_PHASETWO 22 1012 #define SQLITE_FCNTL_COMMIT_PHASETWO 22
972 #define SQLITE_FCNTL_WIN32_SET_HANDLE 23 1013 #define SQLITE_FCNTL_WIN32_SET_HANDLE 23
1014 #define SQLITE_FCNTL_WAL_BLOCK 24
1015 #define SQLITE_FCNTL_ZIPVFS 25
1016 #define SQLITE_FCNTL_RBU 26
1017 #define SQLITE_FCNTL_VFS_POINTER 27
1018 #define SQLITE_FCNTL_JOURNAL_POINTER 28
1019
1020 /* deprecated names */
1021 #define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
1022 #define SQLITE_SET_LOCKPROXYFILE SQLITE_FCNTL_SET_LOCKPROXYFILE
1023 #define SQLITE_LAST_ERRNO SQLITE_FCNTL_LAST_ERRNO
1024
973 1025
974 /* 1026 /*
975 ** CAPI3REF: Mutex Handle 1027 ** CAPI3REF: Mutex Handle
976 ** 1028 **
977 ** The mutex module within SQLite defines [sqlite3_mutex] to be an 1029 ** The mutex module within SQLite defines [sqlite3_mutex] to be an
978 ** abstract type for a mutex object. The SQLite core never looks 1030 ** abstract type for a mutex object. The SQLite core never looks
979 ** at the internal representation of an [sqlite3_mutex]. It only 1031 ** at the internal representation of an [sqlite3_mutex]. It only
980 ** deals with pointers to the [sqlite3_mutex] object. 1032 ** deals with pointers to the [sqlite3_mutex] object.
981 ** 1033 **
982 ** Mutexes are created using [sqlite3_mutex_alloc()]. 1034 ** Mutexes are created using [sqlite3_mutex_alloc()].
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1214 ** xShmLock method: 1266 ** xShmLock method:
1215 ** 1267 **
1216 ** <ul> 1268 ** <ul>
1217 ** <li> SQLITE_SHM_LOCK | SQLITE_SHM_SHARED 1269 ** <li> SQLITE_SHM_LOCK | SQLITE_SHM_SHARED
1218 ** <li> SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE 1270 ** <li> SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE
1219 ** <li> SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED 1271 ** <li> SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED
1220 ** <li> SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE 1272 ** <li> SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE
1221 ** </ul> 1273 ** </ul>
1222 ** 1274 **
1223 ** When unlocking, the same SHARED or EXCLUSIVE flag must be supplied as 1275 ** When unlocking, the same SHARED or EXCLUSIVE flag must be supplied as
1224 ** was given no the corresponding lock. 1276 ** was given on the corresponding lock.
1225 ** 1277 **
1226 ** The xShmLock method can transition between unlocked and SHARED or 1278 ** The xShmLock method can transition between unlocked and SHARED or
1227 ** between unlocked and EXCLUSIVE. It cannot transition between SHARED 1279 ** between unlocked and EXCLUSIVE. It cannot transition between SHARED
1228 ** and EXCLUSIVE. 1280 ** and EXCLUSIVE.
1229 */ 1281 */
1230 #define SQLITE_SHM_UNLOCK 1 1282 #define SQLITE_SHM_UNLOCK 1
1231 #define SQLITE_SHM_LOCK 2 1283 #define SQLITE_SHM_LOCK 2
1232 #define SQLITE_SHM_SHARED 4 1284 #define SQLITE_SHM_SHARED 4
1233 #define SQLITE_SHM_EXCLUSIVE 8 1285 #define SQLITE_SHM_EXCLUSIVE 8
1234 1286
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1311 ** implementations for sqlite3_os_init() and sqlite3_os_end() 1363 ** implementations for sqlite3_os_init() and sqlite3_os_end()
1312 ** are built into SQLite when it is compiled for Unix, Windows, or OS/2. 1364 ** are built into SQLite when it is compiled for Unix, Windows, or OS/2.
1313 ** When [custom builds | built for other platforms] 1365 ** When [custom builds | built for other platforms]
1314 ** (using the [SQLITE_OS_OTHER=1] compile-time 1366 ** (using the [SQLITE_OS_OTHER=1] compile-time
1315 ** option) the application must supply a suitable implementation for 1367 ** option) the application must supply a suitable implementation for
1316 ** sqlite3_os_init() and sqlite3_os_end(). An application-supplied 1368 ** sqlite3_os_init() and sqlite3_os_end(). An application-supplied
1317 ** implementation of sqlite3_os_init() or sqlite3_os_end() 1369 ** implementation of sqlite3_os_init() or sqlite3_os_end()
1318 ** must return [SQLITE_OK] on success and some other [error code] upon 1370 ** must return [SQLITE_OK] on success and some other [error code] upon
1319 ** failure. 1371 ** failure.
1320 */ 1372 */
1321 SQLITE_API int sqlite3_initialize(void); 1373 SQLITE_API int SQLITE_STDCALL sqlite3_initialize(void);
1322 SQLITE_API int sqlite3_shutdown(void); 1374 SQLITE_API int SQLITE_STDCALL sqlite3_shutdown(void);
1323 SQLITE_API int sqlite3_os_init(void); 1375 SQLITE_API int SQLITE_STDCALL sqlite3_os_init(void);
1324 SQLITE_API int sqlite3_os_end(void); 1376 SQLITE_API int SQLITE_STDCALL sqlite3_os_end(void);
1325 1377
1326 /* 1378 /*
1327 ** CAPI3REF: Configuring The SQLite Library 1379 ** CAPI3REF: Configuring The SQLite Library
1328 ** 1380 **
1329 ** The sqlite3_config() interface is used to make global configuration 1381 ** The sqlite3_config() interface is used to make global configuration
1330 ** changes to SQLite in order to tune SQLite to the specific needs of 1382 ** changes to SQLite in order to tune SQLite to the specific needs of
1331 ** the application. The default configuration is recommended for most 1383 ** the application. The default configuration is recommended for most
1332 ** applications and so this routine is usually not necessary. It is 1384 ** applications and so this routine is usually not necessary. It is
1333 ** provided to support rare applications with unusual needs. 1385 ** provided to support rare applications with unusual needs.
1334 ** 1386 **
1335 ** The sqlite3_config() interface is not threadsafe. The application 1387 ** <b>The sqlite3_config() interface is not threadsafe. The application
1336 ** must insure that no other SQLite interfaces are invoked by other 1388 ** must ensure that no other SQLite interfaces are invoked by other
1337 ** threads while sqlite3_config() is running. Furthermore, sqlite3_config() 1389 ** threads while sqlite3_config() is running.</b>
1390 **
1391 ** The sqlite3_config() interface
1338 ** may only be invoked prior to library initialization using 1392 ** may only be invoked prior to library initialization using
1339 ** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()]. 1393 ** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].
1340 ** ^If sqlite3_config() is called after [sqlite3_initialize()] and before 1394 ** ^If sqlite3_config() is called after [sqlite3_initialize()] and before
1341 ** [sqlite3_shutdown()] then it will return SQLITE_MISUSE. 1395 ** [sqlite3_shutdown()] then it will return SQLITE_MISUSE.
1342 ** Note, however, that ^sqlite3_config() can be called as part of the 1396 ** Note, however, that ^sqlite3_config() can be called as part of the
1343 ** implementation of an application-defined [sqlite3_os_init()]. 1397 ** implementation of an application-defined [sqlite3_os_init()].
1344 ** 1398 **
1345 ** The first argument to sqlite3_config() is an integer 1399 ** The first argument to sqlite3_config() is an integer
1346 ** [configuration option] that determines 1400 ** [configuration option] that determines
1347 ** what property of SQLite is to be configured. Subsequent arguments 1401 ** what property of SQLite is to be configured. Subsequent arguments
1348 ** vary depending on the [configuration option] 1402 ** vary depending on the [configuration option]
1349 ** in the first argument. 1403 ** in the first argument.
1350 ** 1404 **
1351 ** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK]. 1405 ** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK].
1352 ** ^If the option is unknown or SQLite is unable to set the option 1406 ** ^If the option is unknown or SQLite is unable to set the option
1353 ** then this routine returns a non-zero [error code]. 1407 ** then this routine returns a non-zero [error code].
1354 */ 1408 */
1355 SQLITE_API int sqlite3_config(int, ...); 1409 SQLITE_API int SQLITE_CDECL sqlite3_config(int, ...);
1356 1410
1357 /* 1411 /*
1358 ** CAPI3REF: Configure database connections 1412 ** CAPI3REF: Configure database connections
1413 ** METHOD: sqlite3
1359 ** 1414 **
1360 ** The sqlite3_db_config() interface is used to make configuration 1415 ** The sqlite3_db_config() interface is used to make configuration
1361 ** changes to a [database connection]. The interface is similar to 1416 ** changes to a [database connection]. The interface is similar to
1362 ** [sqlite3_config()] except that the changes apply to a single 1417 ** [sqlite3_config()] except that the changes apply to a single
1363 ** [database connection] (specified in the first argument). 1418 ** [database connection] (specified in the first argument).
1364 ** 1419 **
1365 ** The second argument to sqlite3_db_config(D,V,...) is the 1420 ** The second argument to sqlite3_db_config(D,V,...) is the
1366 ** [SQLITE_DBCONFIG_LOOKASIDE | configuration verb] - an integer code 1421 ** [SQLITE_DBCONFIG_LOOKASIDE | configuration verb] - an integer code
1367 ** that indicates what aspect of the [database connection] is being configured. 1422 ** that indicates what aspect of the [database connection] is being configured.
1368 ** Subsequent arguments vary depending on the configuration verb. 1423 ** Subsequent arguments vary depending on the configuration verb.
1369 ** 1424 **
1370 ** ^Calls to sqlite3_db_config() return SQLITE_OK if and only if 1425 ** ^Calls to sqlite3_db_config() return SQLITE_OK if and only if
1371 ** the call is considered successful. 1426 ** the call is considered successful.
1372 */ 1427 */
1373 SQLITE_API int sqlite3_db_config(sqlite3*, int op, ...); 1428 SQLITE_API int SQLITE_CDECL sqlite3_db_config(sqlite3*, int op, ...);
1374 1429
1375 /* 1430 /*
1376 ** CAPI3REF: Memory Allocation Routines 1431 ** CAPI3REF: Memory Allocation Routines
1377 ** 1432 **
1378 ** An instance of this object defines the interface between SQLite 1433 ** An instance of this object defines the interface between SQLite
1379 ** and low-level memory allocation routines. 1434 ** and low-level memory allocation routines.
1380 ** 1435 **
1381 ** This object is used in only one place in the SQLite interface. 1436 ** This object is used in only one place in the SQLite interface.
1382 ** A pointer to an instance of this object is the argument to 1437 ** A pointer to an instance of this object is the argument to
1383 ** [sqlite3_config()] when the configuration option is 1438 ** [sqlite3_config()] when the configuration option is
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1497 ** to [database connections] and [prepared statements] so that the 1552 ** to [database connections] and [prepared statements] so that the
1498 ** application is free to use the same [database connection] or the 1553 ** application is free to use the same [database connection] or the
1499 ** same [prepared statement] in different threads at the same time. 1554 ** same [prepared statement] in different threads at the same time.
1500 ** ^If SQLite is compiled with 1555 ** ^If SQLite is compiled with
1501 ** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then 1556 ** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
1502 ** it is not possible to set the Serialized [threading mode] and 1557 ** it is not possible to set the Serialized [threading mode] and
1503 ** [sqlite3_config()] will return [SQLITE_ERROR] if called with the 1558 ** [sqlite3_config()] will return [SQLITE_ERROR] if called with the
1504 ** SQLITE_CONFIG_SERIALIZED configuration option.</dd> 1559 ** SQLITE_CONFIG_SERIALIZED configuration option.</dd>
1505 ** 1560 **
1506 ** [[SQLITE_CONFIG_MALLOC]] <dt>SQLITE_CONFIG_MALLOC</dt> 1561 ** [[SQLITE_CONFIG_MALLOC]] <dt>SQLITE_CONFIG_MALLOC</dt>
1507 ** <dd> ^(This option takes a single argument which is a pointer to an 1562 ** <dd> ^(The SQLITE_CONFIG_MALLOC option takes a single argument which is
1508 ** instance of the [sqlite3_mem_methods] structure. The argument specifies 1563 ** a pointer to an instance of the [sqlite3_mem_methods] structure.
1564 ** The argument specifies
1509 ** alternative low-level memory allocation routines to be used in place of 1565 ** alternative low-level memory allocation routines to be used in place of
1510 ** the memory allocation routines built into SQLite.)^ ^SQLite makes 1566 ** the memory allocation routines built into SQLite.)^ ^SQLite makes
1511 ** its own private copy of the content of the [sqlite3_mem_methods] structure 1567 ** its own private copy of the content of the [sqlite3_mem_methods] structure
1512 ** before the [sqlite3_config()] call returns.</dd> 1568 ** before the [sqlite3_config()] call returns.</dd>
1513 ** 1569 **
1514 ** [[SQLITE_CONFIG_GETMALLOC]] <dt>SQLITE_CONFIG_GETMALLOC</dt> 1570 ** [[SQLITE_CONFIG_GETMALLOC]] <dt>SQLITE_CONFIG_GETMALLOC</dt>
1515 ** <dd> ^(This option takes a single argument which is a pointer to an 1571 ** <dd> ^(The SQLITE_CONFIG_GETMALLOC option takes a single argument which
1516 ** instance of the [sqlite3_mem_methods] structure. The [sqlite3_mem_methods] 1572 ** is a pointer to an instance of the [sqlite3_mem_methods] structure.
1573 ** The [sqlite3_mem_methods]
1517 ** structure is filled with the currently defined memory allocation routines.)^ 1574 ** structure is filled with the currently defined memory allocation routines.)^
1518 ** This option can be used to overload the default memory allocation 1575 ** This option can be used to overload the default memory allocation
1519 ** routines with a wrapper that simulations memory allocation failure or 1576 ** routines with a wrapper that simulations memory allocation failure or
1520 ** tracks memory usage, for example. </dd> 1577 ** tracks memory usage, for example. </dd>
1521 ** 1578 **
1522 ** [[SQLITE_CONFIG_MEMSTATUS]] <dt>SQLITE_CONFIG_MEMSTATUS</dt> 1579 ** [[SQLITE_CONFIG_MEMSTATUS]] <dt>SQLITE_CONFIG_MEMSTATUS</dt>
1523 ** <dd> ^This option takes single argument of type int, interpreted as a 1580 ** <dd> ^The SQLITE_CONFIG_MEMSTATUS option takes single argument of type int,
1524 ** boolean, which enables or disables the collection of memory allocation 1581 ** interpreted as a boolean, which enables or disables the collection of
1525 ** statistics. ^(When memory allocation statistics are disabled, the 1582 ** memory allocation statistics. ^(When memory allocation statistics are
1526 ** following SQLite interfaces become non-operational: 1583 ** disabled, the following SQLite interfaces become non-operational:
1527 ** <ul> 1584 ** <ul>
1528 ** <li> [sqlite3_memory_used()] 1585 ** <li> [sqlite3_memory_used()]
1529 ** <li> [sqlite3_memory_highwater()] 1586 ** <li> [sqlite3_memory_highwater()]
1530 ** <li> [sqlite3_soft_heap_limit64()] 1587 ** <li> [sqlite3_soft_heap_limit64()]
1531 ** <li> [sqlite3_status()] 1588 ** <li> [sqlite3_status64()]
1532 ** </ul>)^ 1589 ** </ul>)^
1533 ** ^Memory allocation statistics are enabled by default unless SQLite is 1590 ** ^Memory allocation statistics are enabled by default unless SQLite is
1534 ** compiled with [SQLITE_DEFAULT_MEMSTATUS]=0 in which case memory 1591 ** compiled with [SQLITE_DEFAULT_MEMSTATUS]=0 in which case memory
1535 ** allocation statistics are disabled by default. 1592 ** allocation statistics are disabled by default.
1536 ** </dd> 1593 ** </dd>
1537 ** 1594 **
1538 ** [[SQLITE_CONFIG_SCRATCH]] <dt>SQLITE_CONFIG_SCRATCH</dt> 1595 ** [[SQLITE_CONFIG_SCRATCH]] <dt>SQLITE_CONFIG_SCRATCH</dt>
1539 ** <dd> ^This option specifies a static memory buffer that SQLite can use for 1596 ** <dd> ^The SQLITE_CONFIG_SCRATCH option specifies a static memory buffer
1540 ** scratch memory. There are three arguments: A pointer an 8-byte 1597 ** that SQLite can use for scratch memory. ^(There are three arguments
1598 ** to SQLITE_CONFIG_SCRATCH: A pointer an 8-byte
1541 ** aligned memory buffer from which the scratch allocations will be 1599 ** aligned memory buffer from which the scratch allocations will be
1542 ** drawn, the size of each scratch allocation (sz), 1600 ** drawn, the size of each scratch allocation (sz),
1543 ** and the maximum number of scratch allocations (N). The sz 1601 ** and the maximum number of scratch allocations (N).)^
1544 ** argument must be a multiple of 16.
1545 ** The first argument must be a pointer to an 8-byte aligned buffer 1602 ** The first argument must be a pointer to an 8-byte aligned buffer
1546 ** of at least sz*N bytes of memory. 1603 ** of at least sz*N bytes of memory.
1547 ** ^SQLite will use no more than two scratch buffers per thread. So 1604 ** ^SQLite will not use more than one scratch buffers per thread.
1548 ** N should be set to twice the expected maximum number of threads. 1605 ** ^SQLite will never request a scratch buffer that is more than 6
1549 ** ^SQLite will never require a scratch buffer that is more than 6 1606 ** times the database page size.
1550 ** times the database page size. ^If SQLite needs needs additional 1607 ** ^If SQLite needs needs additional
1551 ** scratch memory beyond what is provided by this configuration option, then 1608 ** scratch memory beyond what is provided by this configuration option, then
1552 ** [sqlite3_malloc()] will be used to obtain the memory needed.</dd> 1609 ** [sqlite3_malloc()] will be used to obtain the memory needed.<p>
1610 ** ^When the application provides any amount of scratch memory using
1611 ** SQLITE_CONFIG_SCRATCH, SQLite avoids unnecessary large
1612 ** [sqlite3_malloc|heap allocations].
1613 ** This can help [Robson proof|prevent memory allocation failures] due to heap
1614 ** fragmentation in low-memory embedded systems.
1615 ** </dd>
1553 ** 1616 **
1554 ** [[SQLITE_CONFIG_PAGECACHE]] <dt>SQLITE_CONFIG_PAGECACHE</dt> 1617 ** [[SQLITE_CONFIG_PAGECACHE]] <dt>SQLITE_CONFIG_PAGECACHE</dt>
1555 ** <dd> ^This option specifies a static memory buffer that SQLite can use for 1618 ** <dd> ^The SQLITE_CONFIG_PAGECACHE option specifies a memory pool
1556 ** the database page cache with the default page cache implementation. 1619 ** that SQLite can use for the database page cache with the default page
1557 ** This configuration should not be used if an application-define page 1620 ** cache implementation.
1558 ** cache implementation is loaded using the SQLITE_CONFIG_PCACHE2 option. 1621 ** This configuration option is a no-op if an application-define page
1559 ** There are three arguments to this option: A pointer to 8-byte aligned 1622 ** cache implementation is loaded using the [SQLITE_CONFIG_PCACHE2].
1560 ** memory, the size of each page buffer (sz), and the number of pages (N). 1623 ** ^There are three arguments to SQLITE_CONFIG_PAGECACHE: A pointer to
1624 ** 8-byte aligned memory (pMem), the size of each page cache line (sz),
1625 ** and the number of cache lines (N).
1561 ** The sz argument should be the size of the largest database page 1626 ** The sz argument should be the size of the largest database page
1562 ** (a power of two between 512 and 32768) plus a little extra for each 1627 ** (a power of two between 512 and 65536) plus some extra bytes for each
1563 ** page header. ^The page header size is 20 to 40 bytes depending on 1628 ** page header. ^The number of extra bytes needed by the page header
1564 ** the host architecture. ^It is harmless, apart from the wasted memory, 1629 ** can be determined using [SQLITE_CONFIG_PCACHE_HDRSZ].
1565 ** to make sz a little too large. The first 1630 ** ^It is harmless, apart from the wasted memory,
1566 ** argument should point to an allocation of at least sz*N bytes of memory. 1631 ** for the sz parameter to be larger than necessary. The pMem
1567 ** ^SQLite will use the memory provided by the first argument to satisfy its 1632 ** argument must be either a NULL pointer or a pointer to an 8-byte
1568 ** memory needs for the first N pages that it adds to cache. ^If additional 1633 ** aligned block of memory of at least sz*N bytes, otherwise
1569 ** page cache memory is needed beyond what is provided by this option, then 1634 ** subsequent behavior is undefined.
1570 ** SQLite goes to [sqlite3_malloc()] for the additional storage space. 1635 ** ^When pMem is not NULL, SQLite will strive to use the memory provided
1571 ** The pointer in the first argument must 1636 ** to satisfy page cache needs, falling back to [sqlite3_malloc()] if
1572 ** be aligned to an 8-byte boundary or subsequent behavior of SQLite 1637 ** a page cache line is larger than sz bytes or if all of the pMem buffer
1573 ** will be undefined.</dd> 1638 ** is exhausted.
1639 ** ^If pMem is NULL and N is non-zero, then each database connection
1640 ** does an initial bulk allocation for page cache memory
1641 ** from [sqlite3_malloc()] sufficient for N cache lines if N is positive or
1642 ** of -1024*N bytes if N is negative, . ^If additional
1643 ** page cache memory is needed beyond what is provided by the initial
1644 ** allocation, then SQLite goes to [sqlite3_malloc()] separately for each
1645 ** additional cache line. </dd>
1574 ** 1646 **
1575 ** [[SQLITE_CONFIG_HEAP]] <dt>SQLITE_CONFIG_HEAP</dt> 1647 ** [[SQLITE_CONFIG_HEAP]] <dt>SQLITE_CONFIG_HEAP</dt>
1576 ** <dd> ^This option specifies a static memory buffer that SQLite will use 1648 ** <dd> ^The SQLITE_CONFIG_HEAP option specifies a static memory buffer
1577 ** for all of its dynamic memory allocation needs beyond those provided 1649 ** that SQLite will use for all of its dynamic memory allocation needs
1578 ** for by [SQLITE_CONFIG_SCRATCH] and [SQLITE_CONFIG_PAGECACHE]. 1650 ** beyond those provided for by [SQLITE_CONFIG_SCRATCH] and
1579 ** There are three arguments: An 8-byte aligned pointer to the memory, 1651 ** [SQLITE_CONFIG_PAGECACHE].
1652 ** ^The SQLITE_CONFIG_HEAP option is only available if SQLite is compiled
1653 ** with either [SQLITE_ENABLE_MEMSYS3] or [SQLITE_ENABLE_MEMSYS5] and returns
1654 ** [SQLITE_ERROR] if invoked otherwise.
1655 ** ^There are three arguments to SQLITE_CONFIG_HEAP:
1656 ** An 8-byte aligned pointer to the memory,
1580 ** the number of bytes in the memory buffer, and the minimum allocation size. 1657 ** the number of bytes in the memory buffer, and the minimum allocation size.
1581 ** ^If the first pointer (the memory pointer) is NULL, then SQLite reverts 1658 ** ^If the first pointer (the memory pointer) is NULL, then SQLite reverts
1582 ** to using its default memory allocator (the system malloc() implementation), 1659 ** to using its default memory allocator (the system malloc() implementation),
1583 ** undoing any prior invocation of [SQLITE_CONFIG_MALLOC]. ^If the 1660 ** undoing any prior invocation of [SQLITE_CONFIG_MALLOC]. ^If the
1584 ** memory pointer is not NULL and either [SQLITE_ENABLE_MEMSYS3] or 1661 ** memory pointer is not NULL then the alternative memory
1585 ** [SQLITE_ENABLE_MEMSYS5] are defined, then the alternative memory
1586 ** allocator is engaged to handle all of SQLites memory allocation needs. 1662 ** allocator is engaged to handle all of SQLites memory allocation needs.
1587 ** The first pointer (the memory pointer) must be aligned to an 8-byte 1663 ** The first pointer (the memory pointer) must be aligned to an 8-byte
1588 ** boundary or subsequent behavior of SQLite will be undefined. 1664 ** boundary or subsequent behavior of SQLite will be undefined.
1589 ** The minimum allocation size is capped at 2**12. Reasonable values 1665 ** The minimum allocation size is capped at 2**12. Reasonable values
1590 ** for the minimum allocation size are 2**5 through 2**8.</dd> 1666 ** for the minimum allocation size are 2**5 through 2**8.</dd>
1591 ** 1667 **
1592 ** [[SQLITE_CONFIG_MUTEX]] <dt>SQLITE_CONFIG_MUTEX</dt> 1668 ** [[SQLITE_CONFIG_MUTEX]] <dt>SQLITE_CONFIG_MUTEX</dt>
1593 ** <dd> ^(This option takes a single argument which is a pointer to an 1669 ** <dd> ^(The SQLITE_CONFIG_MUTEX option takes a single argument which is a
1594 ** instance of the [sqlite3_mutex_methods] structure. The argument specifies 1670 ** pointer to an instance of the [sqlite3_mutex_methods] structure.
1595 ** alternative low-level mutex routines to be used in place 1671 ** The argument specifies alternative low-level mutex routines to be used
1596 ** the mutex routines built into SQLite.)^ ^SQLite makes a copy of the 1672 ** in place the mutex routines built into SQLite.)^ ^SQLite makes a copy of
1597 ** content of the [sqlite3_mutex_methods] structure before the call to 1673 ** the content of the [sqlite3_mutex_methods] structure before the call to
1598 ** [sqlite3_config()] returns. ^If SQLite is compiled with 1674 ** [sqlite3_config()] returns. ^If SQLite is compiled with
1599 ** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then 1675 ** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
1600 ** the entire mutexing subsystem is omitted from the build and hence calls to 1676 ** the entire mutexing subsystem is omitted from the build and hence calls to
1601 ** [sqlite3_config()] with the SQLITE_CONFIG_MUTEX configuration option will 1677 ** [sqlite3_config()] with the SQLITE_CONFIG_MUTEX configuration option will
1602 ** return [SQLITE_ERROR].</dd> 1678 ** return [SQLITE_ERROR].</dd>
1603 ** 1679 **
1604 ** [[SQLITE_CONFIG_GETMUTEX]] <dt>SQLITE_CONFIG_GETMUTEX</dt> 1680 ** [[SQLITE_CONFIG_GETMUTEX]] <dt>SQLITE_CONFIG_GETMUTEX</dt>
1605 ** <dd> ^(This option takes a single argument which is a pointer to an 1681 ** <dd> ^(The SQLITE_CONFIG_GETMUTEX option takes a single argument which
1606 ** instance of the [sqlite3_mutex_methods] structure. The 1682 ** is a pointer to an instance of the [sqlite3_mutex_methods] structure. The
1607 ** [sqlite3_mutex_methods] 1683 ** [sqlite3_mutex_methods]
1608 ** structure is filled with the currently defined mutex routines.)^ 1684 ** structure is filled with the currently defined mutex routines.)^
1609 ** This option can be used to overload the default mutex allocation 1685 ** This option can be used to overload the default mutex allocation
1610 ** routines with a wrapper used to track mutex usage for performance 1686 ** routines with a wrapper used to track mutex usage for performance
1611 ** profiling or testing, for example. ^If SQLite is compiled with 1687 ** profiling or testing, for example. ^If SQLite is compiled with
1612 ** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then 1688 ** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
1613 ** the entire mutexing subsystem is omitted from the build and hence calls to 1689 ** the entire mutexing subsystem is omitted from the build and hence calls to
1614 ** [sqlite3_config()] with the SQLITE_CONFIG_GETMUTEX configuration option will 1690 ** [sqlite3_config()] with the SQLITE_CONFIG_GETMUTEX configuration option will
1615 ** return [SQLITE_ERROR].</dd> 1691 ** return [SQLITE_ERROR].</dd>
1616 ** 1692 **
1617 ** [[SQLITE_CONFIG_LOOKASIDE]] <dt>SQLITE_CONFIG_LOOKASIDE</dt> 1693 ** [[SQLITE_CONFIG_LOOKASIDE]] <dt>SQLITE_CONFIG_LOOKASIDE</dt>
1618 ** <dd> ^(This option takes two arguments that determine the default 1694 ** <dd> ^(The SQLITE_CONFIG_LOOKASIDE option takes two arguments that determine
1619 ** memory allocation for the lookaside memory allocator on each 1695 ** the default size of lookaside memory on each [database connection].
1620 ** [database connection]. The first argument is the 1696 ** The first argument is the
1621 ** size of each lookaside buffer slot and the second is the number of 1697 ** size of each lookaside buffer slot and the second is the number of
1622 ** slots allocated to each database connection.)^ ^(This option sets the 1698 ** slots allocated to each database connection.)^ ^(SQLITE_CONFIG_LOOKASIDE
1623 ** <i>default</i> lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE] 1699 ** sets the <i>default</i> lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE]
1624 ** verb to [sqlite3_db_config()] can be used to change the lookaside 1700 ** option to [sqlite3_db_config()] can be used to change the lookaside
1625 ** configuration on individual connections.)^ </dd> 1701 ** configuration on individual connections.)^ </dd>
1626 ** 1702 **
1627 ** [[SQLITE_CONFIG_PCACHE2]] <dt>SQLITE_CONFIG_PCACHE2</dt> 1703 ** [[SQLITE_CONFIG_PCACHE2]] <dt>SQLITE_CONFIG_PCACHE2</dt>
1628 ** <dd> ^(This option takes a single argument which is a pointer to 1704 ** <dd> ^(The SQLITE_CONFIG_PCACHE2 option takes a single argument which is
1629 ** an [sqlite3_pcache_methods2] object. This object specifies the interface 1705 ** a pointer to an [sqlite3_pcache_methods2] object. This object specifies
1630 ** to a custom page cache implementation.)^ ^SQLite makes a copy of the 1706 ** the interface to a custom page cache implementation.)^
1631 ** object and uses it for page cache memory allocations.</dd> 1707 ** ^SQLite makes a copy of the [sqlite3_pcache_methods2] object.</dd>
1632 ** 1708 **
1633 ** [[SQLITE_CONFIG_GETPCACHE2]] <dt>SQLITE_CONFIG_GETPCACHE2</dt> 1709 ** [[SQLITE_CONFIG_GETPCACHE2]] <dt>SQLITE_CONFIG_GETPCACHE2</dt>
1634 ** <dd> ^(This option takes a single argument which is a pointer to an 1710 ** <dd> ^(The SQLITE_CONFIG_GETPCACHE2 option takes a single argument which
1635 ** [sqlite3_pcache_methods2] object. SQLite copies of the current 1711 ** is a pointer to an [sqlite3_pcache_methods2] object. SQLite copies of
1636 ** page cache implementation into that object.)^ </dd> 1712 ** the current page cache implementation into that object.)^ </dd>
1637 ** 1713 **
1638 ** [[SQLITE_CONFIG_LOG]] <dt>SQLITE_CONFIG_LOG</dt> 1714 ** [[SQLITE_CONFIG_LOG]] <dt>SQLITE_CONFIG_LOG</dt>
1639 ** <dd> The SQLITE_CONFIG_LOG option is used to configure the SQLite 1715 ** <dd> The SQLITE_CONFIG_LOG option is used to configure the SQLite
1640 ** global [error log]. 1716 ** global [error log].
1641 ** (^The SQLITE_CONFIG_LOG option takes two arguments: a pointer to a 1717 ** (^The SQLITE_CONFIG_LOG option takes two arguments: a pointer to a
1642 ** function with a call signature of void(*)(void*,int,const char*), 1718 ** function with a call signature of void(*)(void*,int,const char*),
1643 ** and a pointer to void. ^If the function pointer is not NULL, it is 1719 ** and a pointer to void. ^If the function pointer is not NULL, it is
1644 ** invoked by [sqlite3_log()] to process each logging event. ^If the 1720 ** invoked by [sqlite3_log()] to process each logging event. ^If the
1645 ** function pointer is NULL, the [sqlite3_log()] interface becomes a no-op. 1721 ** function pointer is NULL, the [sqlite3_log()] interface becomes a no-op.
1646 ** ^The void pointer that is the second argument to SQLITE_CONFIG_LOG is 1722 ** ^The void pointer that is the second argument to SQLITE_CONFIG_LOG is
1647 ** passed through as the first parameter to the application-defined logger 1723 ** passed through as the first parameter to the application-defined logger
1648 ** function whenever that function is invoked. ^The second parameter to 1724 ** function whenever that function is invoked. ^The second parameter to
1649 ** the logger function is a copy of the first parameter to the corresponding 1725 ** the logger function is a copy of the first parameter to the corresponding
1650 ** [sqlite3_log()] call and is intended to be a [result code] or an 1726 ** [sqlite3_log()] call and is intended to be a [result code] or an
1651 ** [extended result code]. ^The third parameter passed to the logger is 1727 ** [extended result code]. ^The third parameter passed to the logger is
1652 ** log message after formatting via [sqlite3_snprintf()]. 1728 ** log message after formatting via [sqlite3_snprintf()].
1653 ** The SQLite logging interface is not reentrant; the logger function 1729 ** The SQLite logging interface is not reentrant; the logger function
1654 ** supplied by the application must not invoke any SQLite interface. 1730 ** supplied by the application must not invoke any SQLite interface.
1655 ** In a multi-threaded application, the application-defined logger 1731 ** In a multi-threaded application, the application-defined logger
1656 ** function must be threadsafe. </dd> 1732 ** function must be threadsafe. </dd>
1657 ** 1733 **
1658 ** [[SQLITE_CONFIG_URI]] <dt>SQLITE_CONFIG_URI 1734 ** [[SQLITE_CONFIG_URI]] <dt>SQLITE_CONFIG_URI
1659 ** <dd>^(This option takes a single argument of type int. If non-zero, then 1735 ** <dd>^(The SQLITE_CONFIG_URI option takes a single argument of type int.
1660 ** URI handling is globally enabled. If the parameter is zero, then URI handling 1736 ** If non-zero, then URI handling is globally enabled. If the parameter is zero,
1661 ** is globally disabled.)^ ^If URI handling is globally enabled, all filenames 1737 ** then URI handling is globally disabled.)^ ^If URI handling is globally
1662 ** passed to [sqlite3_open()], [sqlite3_open_v2()], [sqlite3_open16()] or 1738 ** enabled, all filenames passed to [sqlite3_open()], [sqlite3_open_v2()],
1739 ** [sqlite3_open16()] or
1663 ** specified as part of [ATTACH] commands are interpreted as URIs, regardless 1740 ** specified as part of [ATTACH] commands are interpreted as URIs, regardless
1664 ** of whether or not the [SQLITE_OPEN_URI] flag is set when the database 1741 ** of whether or not the [SQLITE_OPEN_URI] flag is set when the database
1665 ** connection is opened. ^If it is globally disabled, filenames are 1742 ** connection is opened. ^If it is globally disabled, filenames are
1666 ** only interpreted as URIs if the SQLITE_OPEN_URI flag is set when the 1743 ** only interpreted as URIs if the SQLITE_OPEN_URI flag is set when the
1667 ** database connection is opened. ^(By default, URI handling is globally 1744 ** database connection is opened. ^(By default, URI handling is globally
1668 ** disabled. The default value may be changed by compiling with the 1745 ** disabled. The default value may be changed by compiling with the
1669 ** [SQLITE_USE_URI] symbol defined.)^ 1746 ** [SQLITE_USE_URI] symbol defined.)^
1670 ** 1747 **
1671 ** [[SQLITE_CONFIG_COVERING_INDEX_SCAN]] <dt>SQLITE_CONFIG_COVERING_INDEX_SCAN 1748 ** [[SQLITE_CONFIG_COVERING_INDEX_SCAN]] <dt>SQLITE_CONFIG_COVERING_INDEX_SCAN
1672 ** <dd>^This option takes a single integer argument which is interpreted as 1749 ** <dd>^The SQLITE_CONFIG_COVERING_INDEX_SCAN option takes a single integer
1673 ** a boolean in order to enable or disable the use of covering indices for 1750 ** argument which is interpreted as a boolean in order to enable or disable
1674 ** full table scans in the query optimizer. ^The default setting is determined 1751 ** the use of covering indices for full table scans in the query optimizer.
1752 ** ^The default setting is determined
1675 ** by the [SQLITE_ALLOW_COVERING_INDEX_SCAN] compile-time option, or is "on" 1753 ** by the [SQLITE_ALLOW_COVERING_INDEX_SCAN] compile-time option, or is "on"
1676 ** if that compile-time option is omitted. 1754 ** if that compile-time option is omitted.
1677 ** The ability to disable the use of covering indices for full table scans 1755 ** The ability to disable the use of covering indices for full table scans
1678 ** is because some incorrectly coded legacy applications might malfunction 1756 ** is because some incorrectly coded legacy applications might malfunction
1679 ** when the optimization is enabled. Providing the ability to 1757 ** when the optimization is enabled. Providing the ability to
1680 ** disable the optimization allows the older, buggy application code to work 1758 ** disable the optimization allows the older, buggy application code to work
1681 ** without change even with newer versions of SQLite. 1759 ** without change even with newer versions of SQLite.
1682 ** 1760 **
1683 ** [[SQLITE_CONFIG_PCACHE]] [[SQLITE_CONFIG_GETPCACHE]] 1761 ** [[SQLITE_CONFIG_PCACHE]] [[SQLITE_CONFIG_GETPCACHE]]
1684 ** <dt>SQLITE_CONFIG_PCACHE and SQLITE_CONFIG_GETPCACHE 1762 ** <dt>SQLITE_CONFIG_PCACHE and SQLITE_CONFIG_GETPCACHE
(...skipping 19 matching lines...) Expand all
1704 ** the canonical SQLite source tree.</dd> 1782 ** the canonical SQLite source tree.</dd>
1705 ** 1783 **
1706 ** [[SQLITE_CONFIG_MMAP_SIZE]] 1784 ** [[SQLITE_CONFIG_MMAP_SIZE]]
1707 ** <dt>SQLITE_CONFIG_MMAP_SIZE 1785 ** <dt>SQLITE_CONFIG_MMAP_SIZE
1708 ** <dd>^SQLITE_CONFIG_MMAP_SIZE takes two 64-bit integer (sqlite3_int64) values 1786 ** <dd>^SQLITE_CONFIG_MMAP_SIZE takes two 64-bit integer (sqlite3_int64) values
1709 ** that are the default mmap size limit (the default setting for 1787 ** that are the default mmap size limit (the default setting for
1710 ** [PRAGMA mmap_size]) and the maximum allowed mmap size limit. 1788 ** [PRAGMA mmap_size]) and the maximum allowed mmap size limit.
1711 ** ^The default setting can be overridden by each database connection using 1789 ** ^The default setting can be overridden by each database connection using
1712 ** either the [PRAGMA mmap_size] command, or by using the 1790 ** either the [PRAGMA mmap_size] command, or by using the
1713 ** [SQLITE_FCNTL_MMAP_SIZE] file control. ^(The maximum allowed mmap size 1791 ** [SQLITE_FCNTL_MMAP_SIZE] file control. ^(The maximum allowed mmap size
1714 ** cannot be changed at run-time. Nor may the maximum allowed mmap size 1792 ** will be silently truncated if necessary so that it does not exceed the
1715 ** exceed the compile-time maximum mmap size set by the 1793 ** compile-time maximum mmap size set by the
1716 ** [SQLITE_MAX_MMAP_SIZE] compile-time option.)^ 1794 ** [SQLITE_MAX_MMAP_SIZE] compile-time option.)^
1717 ** ^If either argument to this option is negative, then that argument is 1795 ** ^If either argument to this option is negative, then that argument is
1718 ** changed to its compile-time default. 1796 ** changed to its compile-time default.
1719 ** 1797 **
1720 ** [[SQLITE_CONFIG_WIN32_HEAPSIZE]] 1798 ** [[SQLITE_CONFIG_WIN32_HEAPSIZE]]
1721 ** <dt>SQLITE_CONFIG_WIN32_HEAPSIZE 1799 ** <dt>SQLITE_CONFIG_WIN32_HEAPSIZE
1722 ** <dd>^This option is only available if SQLite is compiled for Windows 1800 ** <dd>^The SQLITE_CONFIG_WIN32_HEAPSIZE option is only available if SQLite is
1723 ** with the [SQLITE_WIN32_MALLOC] pre-processor macro defined. 1801 ** compiled for Windows with the [SQLITE_WIN32_MALLOC] pre-processor macro
1724 ** SQLITE_CONFIG_WIN32_HEAPSIZE takes a 32-bit unsigned integer value 1802 ** defined. ^SQLITE_CONFIG_WIN32_HEAPSIZE takes a 32-bit unsigned integer value
1725 ** that specifies the maximum size of the created heap. 1803 ** that specifies the maximum size of the created heap.
1804 **
1805 ** [[SQLITE_CONFIG_PCACHE_HDRSZ]]
1806 ** <dt>SQLITE_CONFIG_PCACHE_HDRSZ
1807 ** <dd>^The SQLITE_CONFIG_PCACHE_HDRSZ option takes a single parameter which
1808 ** is a pointer to an integer and writes into that integer the number of extra
1809 ** bytes per page required for each page in [SQLITE_CONFIG_PAGECACHE].
1810 ** The amount of extra space required can change depending on the compiler,
1811 ** target platform, and SQLite version.
1812 **
1813 ** [[SQLITE_CONFIG_PMASZ]]
1814 ** <dt>SQLITE_CONFIG_PMASZ
1815 ** <dd>^The SQLITE_CONFIG_PMASZ option takes a single parameter which
1816 ** is an unsigned integer and sets the "Minimum PMA Size" for the multithreaded
1817 ** sorter to that integer. The default minimum PMA Size is set by the
1818 ** [SQLITE_SORTER_PMASZ] compile-time option. New threads are launched
1819 ** to help with sort operations when multithreaded sorting
1820 ** is enabled (using the [PRAGMA threads] command) and the amount of content
1821 ** to be sorted exceeds the page size times the minimum of the
1822 ** [PRAGMA cache_size] setting and this value.
1726 ** </dl> 1823 ** </dl>
1727 */ 1824 */
1728 #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */ 1825 #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
1729 #define SQLITE_CONFIG_MULTITHREAD 2 /* nil */ 1826 #define SQLITE_CONFIG_MULTITHREAD 2 /* nil */
1730 #define SQLITE_CONFIG_SERIALIZED 3 /* nil */ 1827 #define SQLITE_CONFIG_SERIALIZED 3 /* nil */
1731 #define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */ 1828 #define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */
1732 #define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */ 1829 #define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */
1733 #define SQLITE_CONFIG_SCRATCH 6 /* void*, int sz, int N */ 1830 #define SQLITE_CONFIG_SCRATCH 6 /* void*, int sz, int N */
1734 #define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */ 1831 #define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */
1735 #define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */ 1832 #define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */
1736 #define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */ 1833 #define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */
1737 #define SQLITE_CONFIG_MUTEX 10 /* sqlite3_mutex_methods* */ 1834 #define SQLITE_CONFIG_MUTEX 10 /* sqlite3_mutex_methods* */
1738 #define SQLITE_CONFIG_GETMUTEX 11 /* sqlite3_mutex_methods* */ 1835 #define SQLITE_CONFIG_GETMUTEX 11 /* sqlite3_mutex_methods* */
1739 /* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */ 1836 /* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */
1740 #define SQLITE_CONFIG_LOOKASIDE 13 /* int int */ 1837 #define SQLITE_CONFIG_LOOKASIDE 13 /* int int */
1741 #define SQLITE_CONFIG_PCACHE 14 /* no-op */ 1838 #define SQLITE_CONFIG_PCACHE 14 /* no-op */
1742 #define SQLITE_CONFIG_GETPCACHE 15 /* no-op */ 1839 #define SQLITE_CONFIG_GETPCACHE 15 /* no-op */
1743 #define SQLITE_CONFIG_LOG 16 /* xFunc, void* */ 1840 #define SQLITE_CONFIG_LOG 16 /* xFunc, void* */
1744 #define SQLITE_CONFIG_URI 17 /* int */ 1841 #define SQLITE_CONFIG_URI 17 /* int */
1745 #define SQLITE_CONFIG_PCACHE2 18 /* sqlite3_pcache_methods2* */ 1842 #define SQLITE_CONFIG_PCACHE2 18 /* sqlite3_pcache_methods2* */
1746 #define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */ 1843 #define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */
1747 #define SQLITE_CONFIG_COVERING_INDEX_SCAN 20 /* int */ 1844 #define SQLITE_CONFIG_COVERING_INDEX_SCAN 20 /* int */
1748 #define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */ 1845 #define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */
1749 #define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */ 1846 #define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */
1750 #define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */ 1847 #define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */
1848 #define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */
1849 #define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */
1751 1850
1752 /* 1851 /*
1753 ** CAPI3REF: Database Connection Configuration Options 1852 ** CAPI3REF: Database Connection Configuration Options
1754 ** 1853 **
1755 ** These constants are the available integer configuration options that 1854 ** These constants are the available integer configuration options that
1756 ** can be passed as the second argument to the [sqlite3_db_config()] interface. 1855 ** can be passed as the second argument to the [sqlite3_db_config()] interface.
1757 ** 1856 **
1758 ** New configuration options may be added in future releases of SQLite. 1857 ** New configuration options may be added in future releases of SQLite.
1759 ** Existing configuration options might be discontinued. Applications 1858 ** Existing configuration options might be discontinued. Applications
1760 ** should check the return code from [sqlite3_db_config()] to make sure that 1859 ** should check the return code from [sqlite3_db_config()] to make sure that
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1807 ** 1906 **
1808 ** </dl> 1907 ** </dl>
1809 */ 1908 */
1810 #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */ 1909 #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */
1811 #define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */ 1910 #define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */
1812 #define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */ 1911 #define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */
1813 1912
1814 1913
1815 /* 1914 /*
1816 ** CAPI3REF: Enable Or Disable Extended Result Codes 1915 ** CAPI3REF: Enable Or Disable Extended Result Codes
1916 ** METHOD: sqlite3
1817 ** 1917 **
1818 ** ^The sqlite3_extended_result_codes() routine enables or disables the 1918 ** ^The sqlite3_extended_result_codes() routine enables or disables the
1819 ** [extended result codes] feature of SQLite. ^The extended result 1919 ** [extended result codes] feature of SQLite. ^The extended result
1820 ** codes are disabled by default for historical compatibility. 1920 ** codes are disabled by default for historical compatibility.
1821 */ 1921 */
1822 SQLITE_API int sqlite3_extended_result_codes(sqlite3*, int onoff); 1922 SQLITE_API int SQLITE_STDCALL sqlite3_extended_result_codes(sqlite3*, int onoff) ;
1823 1923
1824 /* 1924 /*
1825 ** CAPI3REF: Last Insert Rowid 1925 ** CAPI3REF: Last Insert Rowid
1926 ** METHOD: sqlite3
1826 ** 1927 **
1827 ** ^Each entry in most SQLite tables (except for [WITHOUT ROWID] tables) 1928 ** ^Each entry in most SQLite tables (except for [WITHOUT ROWID] tables)
1828 ** has a unique 64-bit signed 1929 ** has a unique 64-bit signed
1829 ** integer key called the [ROWID | "rowid"]. ^The rowid is always available 1930 ** integer key called the [ROWID | "rowid"]. ^The rowid is always available
1830 ** as an undeclared column named ROWID, OID, or _ROWID_ as long as those 1931 ** as an undeclared column named ROWID, OID, or _ROWID_ as long as those
1831 ** names are not also used by explicitly declared columns. ^If 1932 ** names are not also used by explicitly declared columns. ^If
1832 ** the table has a column of type [INTEGER PRIMARY KEY] then that column 1933 ** the table has a column of type [INTEGER PRIMARY KEY] then that column
1833 ** is another alias for the rowid. 1934 ** is another alias for the rowid.
1834 ** 1935 **
1835 ** ^The sqlite3_last_insert_rowid(D) interface returns the [rowid] of the 1936 ** ^The sqlite3_last_insert_rowid(D) interface returns the [rowid] of the
(...skipping 27 matching lines...) Expand all
1863 ** This function is accessible to SQL statements via the 1964 ** This function is accessible to SQL statements via the
1864 ** [last_insert_rowid() SQL function]. 1965 ** [last_insert_rowid() SQL function].
1865 ** 1966 **
1866 ** If a separate thread performs a new [INSERT] on the same 1967 ** If a separate thread performs a new [INSERT] on the same
1867 ** database connection while the [sqlite3_last_insert_rowid()] 1968 ** database connection while the [sqlite3_last_insert_rowid()]
1868 ** function is running and thus changes the last insert [rowid], 1969 ** function is running and thus changes the last insert [rowid],
1869 ** then the value returned by [sqlite3_last_insert_rowid()] is 1970 ** then the value returned by [sqlite3_last_insert_rowid()] is
1870 ** unpredictable and might not equal either the old or the new 1971 ** unpredictable and might not equal either the old or the new
1871 ** last insert [rowid]. 1972 ** last insert [rowid].
1872 */ 1973 */
1873 SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*); 1974 SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_last_insert_rowid(sqlite3*);
1874 1975
1875 /* 1976 /*
1876 ** CAPI3REF: Count The Number Of Rows Modified 1977 ** CAPI3REF: Count The Number Of Rows Modified
1978 ** METHOD: sqlite3
1877 ** 1979 **
1878 ** ^This function returns the number of database rows that were changed 1980 ** ^This function returns the number of rows modified, inserted or
1879 ** or inserted or deleted by the most recently completed SQL statement 1981 ** deleted by the most recently completed INSERT, UPDATE or DELETE
1880 ** on the [database connection] specified by the first parameter. 1982 ** statement on the database connection specified by the only parameter.
1881 ** ^(Only changes that are directly specified by the [INSERT], [UPDATE], 1983 ** ^Executing any other type of SQL statement does not modify the value
1882 ** or [DELETE] statement are counted. Auxiliary changes caused by 1984 ** returned by this function.
1883 ** triggers or [foreign key actions] are not counted.)^ Use the
1884 ** [sqlite3_total_changes()] function to find the total number of changes
1885 ** including changes caused by triggers and foreign key actions.
1886 ** 1985 **
1887 ** ^Changes to a view that are simulated by an [INSTEAD OF trigger] 1986 ** ^Only changes made directly by the INSERT, UPDATE or DELETE statement are
1888 ** are not counted. Only real table changes are counted. 1987 ** considered - auxiliary changes caused by [CREATE TRIGGER | triggers],
1988 ** [foreign key actions] or [REPLACE] constraint resolution are not counted.
1989 **
1990 ** Changes to a view that are intercepted by
1991 ** [INSTEAD OF trigger | INSTEAD OF triggers] are not counted. ^The value
1992 ** returned by sqlite3_changes() immediately after an INSERT, UPDATE or
1993 ** DELETE statement run on a view is always zero. Only changes made to real
1994 ** tables are counted.
1889 ** 1995 **
1890 ** ^(A "row change" is a change to a single row of a single table 1996 ** Things are more complicated if the sqlite3_changes() function is
1891 ** caused by an INSERT, DELETE, or UPDATE statement. Rows that 1997 ** executed while a trigger program is running. This may happen if the
1892 ** are changed as side effects of [REPLACE] constraint resolution, 1998 ** program uses the [changes() SQL function], or if some other callback
1893 ** rollback, ABORT processing, [DROP TABLE], or by any other 1999 ** function invokes sqlite3_changes() directly. Essentially:
1894 ** mechanisms do not count as direct row changes.)^ 2000 **
1895 ** 2001 ** <ul>
1896 ** A "trigger context" is a scope of execution that begins and 2002 ** <li> ^(Before entering a trigger program the value returned by
1897 ** ends with the script of a [CREATE TRIGGER | trigger]. 2003 ** sqlite3_changes() function is saved. After the trigger program
1898 ** Most SQL statements are 2004 ** has finished, the original value is restored.)^
1899 ** evaluated outside of any trigger. This is the "top level" 2005 **
1900 ** trigger context. If a trigger fires from the top level, a 2006 ** <li> ^(Within a trigger program each INSERT, UPDATE and DELETE
1901 ** new trigger context is entered for the duration of that one 2007 ** statement sets the value returned by sqlite3_changes()
1902 ** trigger. Subtriggers create subcontexts for their duration. 2008 ** upon completion as normal. Of course, this value will not include
1903 ** 2009 ** any changes performed by sub-triggers, as the sqlite3_changes()
1904 ** ^Calling [sqlite3_exec()] or [sqlite3_step()] recursively does 2010 ** value will be saved and restored after each sub-trigger has run.)^
1905 ** not create a new trigger context. 2011 ** </ul>
1906 ** 2012 **
1907 ** ^This function returns the number of direct row changes in the 2013 ** ^This means that if the changes() SQL function (or similar) is used
1908 ** most recent INSERT, UPDATE, or DELETE statement within the same 2014 ** by the first INSERT, UPDATE or DELETE statement within a trigger, it
1909 ** trigger context. 2015 ** returns the value as set when the calling statement began executing.
1910 ** 2016 ** ^If it is used by the second or subsequent such statement within a trigger
1911 ** ^Thus, when called from the top level, this function returns the 2017 ** program, the value returned reflects the number of rows modified by the
1912 ** number of changes in the most recent INSERT, UPDATE, or DELETE 2018 ** previous INSERT, UPDATE or DELETE statement within the same trigger.
1913 ** that also occurred at the top level. ^(Within the body of a trigger,
1914 ** the sqlite3_changes() interface can be called to find the number of
1915 ** changes in the most recently completed INSERT, UPDATE, or DELETE
1916 ** statement within the body of the same trigger.
1917 ** However, the number returned does not include changes
1918 ** caused by subtriggers since those have their own context.)^
1919 ** 2019 **
1920 ** See also the [sqlite3_total_changes()] interface, the 2020 ** See also the [sqlite3_total_changes()] interface, the
1921 ** [count_changes pragma], and the [changes() SQL function]. 2021 ** [count_changes pragma], and the [changes() SQL function].
1922 ** 2022 **
1923 ** If a separate thread makes changes on the same database connection 2023 ** If a separate thread makes changes on the same database connection
1924 ** while [sqlite3_changes()] is running then the value returned 2024 ** while [sqlite3_changes()] is running then the value returned
1925 ** is unpredictable and not meaningful. 2025 ** is unpredictable and not meaningful.
1926 */ 2026 */
1927 SQLITE_API int sqlite3_changes(sqlite3*); 2027 SQLITE_API int SQLITE_STDCALL sqlite3_changes(sqlite3*);
1928 2028
1929 /* 2029 /*
1930 ** CAPI3REF: Total Number Of Rows Modified 2030 ** CAPI3REF: Total Number Of Rows Modified
2031 ** METHOD: sqlite3
1931 ** 2032 **
1932 ** ^This function returns the number of row changes caused by [INSERT], 2033 ** ^This function returns the total number of rows inserted, modified or
1933 ** [UPDATE] or [DELETE] statements since the [database connection] was opened. 2034 ** deleted by all [INSERT], [UPDATE] or [DELETE] statements completed
1934 ** ^(The count returned by sqlite3_total_changes() includes all changes 2035 ** since the database connection was opened, including those executed as
1935 ** from all [CREATE TRIGGER | trigger] contexts and changes made by 2036 ** part of trigger programs. ^Executing any other type of SQL statement
1936 ** [foreign key actions]. However, 2037 ** does not affect the value returned by sqlite3_total_changes().
1937 ** the count does not include changes used to implement [REPLACE] constraints, 2038 **
1938 ** do rollbacks or ABORT processing, or [DROP TABLE] processing. The 2039 ** ^Changes made as part of [foreign key actions] are included in the
1939 ** count does not include rows of views that fire an [INSTEAD OF trigger], 2040 ** count, but those made as part of REPLACE constraint resolution are
1940 ** though if the INSTEAD OF trigger makes changes of its own, those changes 2041 ** not. ^Changes to a view that are intercepted by INSTEAD OF triggers
1941 ** are counted.)^ 2042 ** are not counted.
1942 ** ^The sqlite3_total_changes() function counts the changes as soon as 2043 **
1943 ** the statement that makes them is completed (when the statement handle
1944 ** is passed to [sqlite3_reset()] or [sqlite3_finalize()]).
1945 **
1946 ** See also the [sqlite3_changes()] interface, the 2044 ** See also the [sqlite3_changes()] interface, the
1947 ** [count_changes pragma], and the [total_changes() SQL function]. 2045 ** [count_changes pragma], and the [total_changes() SQL function].
1948 ** 2046 **
1949 ** If a separate thread makes changes on the same database connection 2047 ** If a separate thread makes changes on the same database connection
1950 ** while [sqlite3_total_changes()] is running then the value 2048 ** while [sqlite3_total_changes()] is running then the value
1951 ** returned is unpredictable and not meaningful. 2049 ** returned is unpredictable and not meaningful.
1952 */ 2050 */
1953 SQLITE_API int sqlite3_total_changes(sqlite3*); 2051 SQLITE_API int SQLITE_STDCALL sqlite3_total_changes(sqlite3*);
1954 2052
1955 /* 2053 /*
1956 ** CAPI3REF: Interrupt A Long-Running Query 2054 ** CAPI3REF: Interrupt A Long-Running Query
2055 ** METHOD: sqlite3
1957 ** 2056 **
1958 ** ^This function causes any pending database operation to abort and 2057 ** ^This function causes any pending database operation to abort and
1959 ** return at its earliest opportunity. This routine is typically 2058 ** return at its earliest opportunity. This routine is typically
1960 ** called in response to a user action such as pressing "Cancel" 2059 ** called in response to a user action such as pressing "Cancel"
1961 ** or Ctrl-C where the user wants a long query operation to halt 2060 ** or Ctrl-C where the user wants a long query operation to halt
1962 ** immediately. 2061 ** immediately.
1963 ** 2062 **
1964 ** ^It is safe to call this routine from a thread different from the 2063 ** ^It is safe to call this routine from a thread different from the
1965 ** thread that is currently running the database operation. But it 2064 ** thread that is currently running the database operation. But it
1966 ** is not safe to call this routine with a [database connection] that 2065 ** is not safe to call this routine with a [database connection] that
(...skipping 15 matching lines...) Expand all
1982 ** running prior to the sqlite3_interrupt() call. ^New SQL statements 2081 ** running prior to the sqlite3_interrupt() call. ^New SQL statements
1983 ** that are started after the running statement count reaches zero are 2082 ** that are started after the running statement count reaches zero are
1984 ** not effected by the sqlite3_interrupt(). 2083 ** not effected by the sqlite3_interrupt().
1985 ** ^A call to sqlite3_interrupt(D) that occurs when there are no running 2084 ** ^A call to sqlite3_interrupt(D) that occurs when there are no running
1986 ** SQL statements is a no-op and has no effect on SQL statements 2085 ** SQL statements is a no-op and has no effect on SQL statements
1987 ** that are started after the sqlite3_interrupt() call returns. 2086 ** that are started after the sqlite3_interrupt() call returns.
1988 ** 2087 **
1989 ** If the database connection closes while [sqlite3_interrupt()] 2088 ** If the database connection closes while [sqlite3_interrupt()]
1990 ** is running then bad things will likely happen. 2089 ** is running then bad things will likely happen.
1991 */ 2090 */
1992 SQLITE_API void sqlite3_interrupt(sqlite3*); 2091 SQLITE_API void SQLITE_STDCALL sqlite3_interrupt(sqlite3*);
1993 2092
1994 /* 2093 /*
1995 ** CAPI3REF: Determine If An SQL Statement Is Complete 2094 ** CAPI3REF: Determine If An SQL Statement Is Complete
1996 ** 2095 **
1997 ** These routines are useful during command-line input to determine if the 2096 ** These routines are useful during command-line input to determine if the
1998 ** currently entered text seems to form a complete SQL statement or 2097 ** currently entered text seems to form a complete SQL statement or
1999 ** if additional input is needed before sending the text into 2098 ** if additional input is needed before sending the text into
2000 ** SQLite for parsing. ^These routines return 1 if the input string 2099 ** SQLite for parsing. ^These routines return 1 if the input string
2001 ** appears to be a complete SQL statement. ^A statement is judged to be 2100 ** appears to be a complete SQL statement. ^A statement is judged to be
2002 ** complete if it ends with a semicolon token and is not a prefix of a 2101 ** complete if it ends with a semicolon token and is not a prefix of a
(...skipping 14 matching lines...) Expand all
2017 ** automatically by sqlite3_complete16(). If that initialization fails, 2116 ** automatically by sqlite3_complete16(). If that initialization fails,
2018 ** then the return value from sqlite3_complete16() will be non-zero 2117 ** then the return value from sqlite3_complete16() will be non-zero
2019 ** regardless of whether or not the input SQL is complete.)^ 2118 ** regardless of whether or not the input SQL is complete.)^
2020 ** 2119 **
2021 ** The input to [sqlite3_complete()] must be a zero-terminated 2120 ** The input to [sqlite3_complete()] must be a zero-terminated
2022 ** UTF-8 string. 2121 ** UTF-8 string.
2023 ** 2122 **
2024 ** The input to [sqlite3_complete16()] must be a zero-terminated 2123 ** The input to [sqlite3_complete16()] must be a zero-terminated
2025 ** UTF-16 string in native byte order. 2124 ** UTF-16 string in native byte order.
2026 */ 2125 */
2027 SQLITE_API int sqlite3_complete(const char *sql); 2126 SQLITE_API int SQLITE_STDCALL sqlite3_complete(const char *sql);
2028 SQLITE_API int sqlite3_complete16(const void *sql); 2127 SQLITE_API int SQLITE_STDCALL sqlite3_complete16(const void *sql);
2029 2128
2030 /* 2129 /*
2031 ** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors 2130 ** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors
2131 ** KEYWORDS: {busy-handler callback} {busy handler}
2132 ** METHOD: sqlite3
2032 ** 2133 **
2033 ** ^The sqlite3_busy_handler(D,X,P) routine sets a callback function X 2134 ** ^The sqlite3_busy_handler(D,X,P) routine sets a callback function X
2034 ** that might be invoked with argument P whenever 2135 ** that might be invoked with argument P whenever
2035 ** an attempt is made to access a database table associated with 2136 ** an attempt is made to access a database table associated with
2036 ** [database connection] D when another thread 2137 ** [database connection] D when another thread
2037 ** or process has the table locked. 2138 ** or process has the table locked.
2038 ** The sqlite3_busy_handler() interface is used to implement 2139 ** The sqlite3_busy_handler() interface is used to implement
2039 ** [sqlite3_busy_timeout()] and [PRAGMA busy_timeout]. 2140 ** [sqlite3_busy_timeout()] and [PRAGMA busy_timeout].
2040 ** 2141 **
2041 ** ^If the busy callback is NULL, then [SQLITE_BUSY] 2142 ** ^If the busy callback is NULL, then [SQLITE_BUSY]
2042 ** is returned immediately upon encountering the lock. ^If the busy callback 2143 ** is returned immediately upon encountering the lock. ^If the busy callback
2043 ** is not NULL, then the callback might be invoked with two arguments. 2144 ** is not NULL, then the callback might be invoked with two arguments.
2044 ** 2145 **
2045 ** ^The first argument to the busy handler is a copy of the void* pointer which 2146 ** ^The first argument to the busy handler is a copy of the void* pointer which
2046 ** is the third argument to sqlite3_busy_handler(). ^The second argument to 2147 ** is the third argument to sqlite3_busy_handler(). ^The second argument to
2047 ** the busy handler callback is the number of times that the busy handler has 2148 ** the busy handler callback is the number of times that the busy handler has
2048 ** been invoked for the same locking event. ^If the 2149 ** been invoked previously for the same locking event. ^If the
2049 ** busy callback returns 0, then no additional attempts are made to 2150 ** busy callback returns 0, then no additional attempts are made to
2050 ** access the database and [SQLITE_BUSY] is returned 2151 ** access the database and [SQLITE_BUSY] is returned
2051 ** to the application. 2152 ** to the application.
2052 ** ^If the callback returns non-zero, then another attempt 2153 ** ^If the callback returns non-zero, then another attempt
2053 ** is made to access the database and the cycle repeats. 2154 ** is made to access the database and the cycle repeats.
2054 ** 2155 **
2055 ** The presence of a busy handler does not guarantee that it will be invoked 2156 ** The presence of a busy handler does not guarantee that it will be invoked
2056 ** when there is lock contention. ^If SQLite determines that invoking the busy 2157 ** when there is lock contention. ^If SQLite determines that invoking the busy
2057 ** handler could result in a deadlock, it will go ahead and return [SQLITE_BUSY] 2158 ** handler could result in a deadlock, it will go ahead and return [SQLITE_BUSY]
2058 ** to the application instead of invoking the 2159 ** to the application instead of invoking the
(...skipping 18 matching lines...) Expand all
2077 ** busy handler and thus clear any previously set busy handler. 2178 ** busy handler and thus clear any previously set busy handler.
2078 ** 2179 **
2079 ** The busy callback should not take any actions which modify the 2180 ** The busy callback should not take any actions which modify the
2080 ** database connection that invoked the busy handler. In other words, 2181 ** database connection that invoked the busy handler. In other words,
2081 ** the busy handler is not reentrant. Any such actions 2182 ** the busy handler is not reentrant. Any such actions
2082 ** result in undefined behavior. 2183 ** result in undefined behavior.
2083 ** 2184 **
2084 ** A busy handler must not close the database connection 2185 ** A busy handler must not close the database connection
2085 ** or [prepared statement] that invoked the busy handler. 2186 ** or [prepared statement] that invoked the busy handler.
2086 */ 2187 */
2087 SQLITE_API int sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*); 2188 SQLITE_API int SQLITE_STDCALL sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*);
2088 2189
2089 /* 2190 /*
2090 ** CAPI3REF: Set A Busy Timeout 2191 ** CAPI3REF: Set A Busy Timeout
2192 ** METHOD: sqlite3
2091 ** 2193 **
2092 ** ^This routine sets a [sqlite3_busy_handler | busy handler] that sleeps 2194 ** ^This routine sets a [sqlite3_busy_handler | busy handler] that sleeps
2093 ** for a specified amount of time when a table is locked. ^The handler 2195 ** for a specified amount of time when a table is locked. ^The handler
2094 ** will sleep multiple times until at least "ms" milliseconds of sleeping 2196 ** will sleep multiple times until at least "ms" milliseconds of sleeping
2095 ** have accumulated. ^After at least "ms" milliseconds of sleeping, 2197 ** have accumulated. ^After at least "ms" milliseconds of sleeping,
2096 ** the handler returns 0 which causes [sqlite3_step()] to return 2198 ** the handler returns 0 which causes [sqlite3_step()] to return
2097 ** [SQLITE_BUSY]. 2199 ** [SQLITE_BUSY].
2098 ** 2200 **
2099 ** ^Calling this routine with an argument less than or equal to zero 2201 ** ^Calling this routine with an argument less than or equal to zero
2100 ** turns off all busy handlers. 2202 ** turns off all busy handlers.
2101 ** 2203 **
2102 ** ^(There can only be a single busy handler for a particular 2204 ** ^(There can only be a single busy handler for a particular
2103 ** [database connection] at any given moment. If another busy handler 2205 ** [database connection] at any given moment. If another busy handler
2104 ** was defined (using [sqlite3_busy_handler()]) prior to calling 2206 ** was defined (using [sqlite3_busy_handler()]) prior to calling
2105 ** this routine, that other busy handler is cleared.)^ 2207 ** this routine, that other busy handler is cleared.)^
2106 ** 2208 **
2107 ** See also: [PRAGMA busy_timeout] 2209 ** See also: [PRAGMA busy_timeout]
2108 */ 2210 */
2109 SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms); 2211 SQLITE_API int SQLITE_STDCALL sqlite3_busy_timeout(sqlite3*, int ms);
2110 2212
2111 /* 2213 /*
2112 ** CAPI3REF: Convenience Routines For Running Queries 2214 ** CAPI3REF: Convenience Routines For Running Queries
2215 ** METHOD: sqlite3
2113 ** 2216 **
2114 ** This is a legacy interface that is preserved for backwards compatibility. 2217 ** This is a legacy interface that is preserved for backwards compatibility.
2115 ** Use of this interface is not recommended. 2218 ** Use of this interface is not recommended.
2116 ** 2219 **
2117 ** Definition: A <b>result table</b> is memory data structure created by the 2220 ** Definition: A <b>result table</b> is memory data structure created by the
2118 ** [sqlite3_get_table()] interface. A result table records the 2221 ** [sqlite3_get_table()] interface. A result table records the
2119 ** complete query results from one or more queries. 2222 ** complete query results from one or more queries.
2120 ** 2223 **
2121 ** The table conceptually has a number of rows and columns. But 2224 ** The table conceptually has a number of rows and columns. But
2122 ** these numbers are not part of the result table itself. These 2225 ** these numbers are not part of the result table itself. These
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
2173 ** [sqlite3_free_table()] is able to release the memory properly and safely. 2276 ** [sqlite3_free_table()] is able to release the memory properly and safely.
2174 ** 2277 **
2175 ** The sqlite3_get_table() interface is implemented as a wrapper around 2278 ** The sqlite3_get_table() interface is implemented as a wrapper around
2176 ** [sqlite3_exec()]. The sqlite3_get_table() routine does not have access 2279 ** [sqlite3_exec()]. The sqlite3_get_table() routine does not have access
2177 ** to any internal data structures of SQLite. It uses only the public 2280 ** to any internal data structures of SQLite. It uses only the public
2178 ** interface defined here. As a consequence, errors that occur in the 2281 ** interface defined here. As a consequence, errors that occur in the
2179 ** wrapper layer outside of the internal [sqlite3_exec()] call are not 2282 ** wrapper layer outside of the internal [sqlite3_exec()] call are not
2180 ** reflected in subsequent calls to [sqlite3_errcode()] or 2283 ** reflected in subsequent calls to [sqlite3_errcode()] or
2181 ** [sqlite3_errmsg()]. 2284 ** [sqlite3_errmsg()].
2182 */ 2285 */
2183 SQLITE_API int sqlite3_get_table( 2286 SQLITE_API int SQLITE_STDCALL sqlite3_get_table(
2184 sqlite3 *db, /* An open database */ 2287 sqlite3 *db, /* An open database */
2185 const char *zSql, /* SQL to be evaluated */ 2288 const char *zSql, /* SQL to be evaluated */
2186 char ***pazResult, /* Results of the query */ 2289 char ***pazResult, /* Results of the query */
2187 int *pnRow, /* Number of result rows written here */ 2290 int *pnRow, /* Number of result rows written here */
2188 int *pnColumn, /* Number of result columns written here */ 2291 int *pnColumn, /* Number of result columns written here */
2189 char **pzErrmsg /* Error msg written here */ 2292 char **pzErrmsg /* Error msg written here */
2190 ); 2293 );
2191 SQLITE_API void sqlite3_free_table(char **result); 2294 SQLITE_API void SQLITE_STDCALL sqlite3_free_table(char **result);
2192 2295
2193 /* 2296 /*
2194 ** CAPI3REF: Formatted String Printing Functions 2297 ** CAPI3REF: Formatted String Printing Functions
2195 ** 2298 **
2196 ** These routines are work-alikes of the "printf()" family of functions 2299 ** These routines are work-alikes of the "printf()" family of functions
2197 ** from the standard C library. 2300 ** from the standard C library.
2301 ** These routines understand most of the common K&R formatting options,
2302 ** plus some additional non-standard formats, detailed below.
2303 ** Note that some of the more obscure formatting options from recent
2304 ** C-library standards are omitted from this implementation.
2198 ** 2305 **
2199 ** ^The sqlite3_mprintf() and sqlite3_vmprintf() routines write their 2306 ** ^The sqlite3_mprintf() and sqlite3_vmprintf() routines write their
2200 ** results into memory obtained from [sqlite3_malloc()]. 2307 ** results into memory obtained from [sqlite3_malloc()].
2201 ** The strings returned by these two routines should be 2308 ** The strings returned by these two routines should be
2202 ** released by [sqlite3_free()]. ^Both routines return a 2309 ** released by [sqlite3_free()]. ^Both routines return a
2203 ** NULL pointer if [sqlite3_malloc()] is unable to allocate enough 2310 ** NULL pointer if [sqlite3_malloc()] is unable to allocate enough
2204 ** memory to hold the resulting string. 2311 ** memory to hold the resulting string.
2205 ** 2312 **
2206 ** ^(The sqlite3_snprintf() routine is similar to "snprintf()" from 2313 ** ^(The sqlite3_snprintf() routine is similar to "snprintf()" from
2207 ** the standard C library. The result is written into the 2314 ** the standard C library. The result is written into the
(...skipping 12 matching lines...) Expand all
2220 ** guarantees that the buffer is always zero-terminated. ^The first 2327 ** guarantees that the buffer is always zero-terminated. ^The first
2221 ** parameter "n" is the total size of the buffer, including space for 2328 ** parameter "n" is the total size of the buffer, including space for
2222 ** the zero terminator. So the longest string that can be completely 2329 ** the zero terminator. So the longest string that can be completely
2223 ** written will be n-1 characters. 2330 ** written will be n-1 characters.
2224 ** 2331 **
2225 ** ^The sqlite3_vsnprintf() routine is a varargs version of sqlite3_snprintf(). 2332 ** ^The sqlite3_vsnprintf() routine is a varargs version of sqlite3_snprintf().
2226 ** 2333 **
2227 ** These routines all implement some additional formatting 2334 ** These routines all implement some additional formatting
2228 ** options that are useful for constructing SQL statements. 2335 ** options that are useful for constructing SQL statements.
2229 ** All of the usual printf() formatting options apply. In addition, there 2336 ** All of the usual printf() formatting options apply. In addition, there
2230 ** is are "%q", "%Q", and "%z" options. 2337 ** is are "%q", "%Q", "%w" and "%z" options.
2231 ** 2338 **
2232 ** ^(The %q option works like %s in that it substitutes a nul-terminated 2339 ** ^(The %q option works like %s in that it substitutes a nul-terminated
2233 ** string from the argument list. But %q also doubles every '\'' character. 2340 ** string from the argument list. But %q also doubles every '\'' character.
2234 ** %q is designed for use inside a string literal.)^ By doubling each '\'' 2341 ** %q is designed for use inside a string literal.)^ By doubling each '\''
2235 ** character it escapes that character and allows it to be inserted into 2342 ** character it escapes that character and allows it to be inserted into
2236 ** the string. 2343 ** the string.
2237 ** 2344 **
2238 ** For example, assume the string variable zText contains text as follows: 2345 ** For example, assume the string variable zText contains text as follows:
2239 ** 2346 **
2240 ** <blockquote><pre> 2347 ** <blockquote><pre>
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2273 ** 2380 **
2274 ** <blockquote><pre> 2381 ** <blockquote><pre>
2275 ** char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES(%Q)", zText); 2382 ** char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES(%Q)", zText);
2276 ** sqlite3_exec(db, zSQL, 0, 0, 0); 2383 ** sqlite3_exec(db, zSQL, 0, 0, 0);
2277 ** sqlite3_free(zSQL); 2384 ** sqlite3_free(zSQL);
2278 ** </pre></blockquote> 2385 ** </pre></blockquote>
2279 ** 2386 **
2280 ** The code above will render a correct SQL statement in the zSQL 2387 ** The code above will render a correct SQL statement in the zSQL
2281 ** variable even if the zText variable is a NULL pointer. 2388 ** variable even if the zText variable is a NULL pointer.
2282 ** 2389 **
2390 ** ^(The "%w" formatting option is like "%q" except that it expects to
2391 ** be contained within double-quotes instead of single quotes, and it
2392 ** escapes the double-quote character instead of the single-quote
2393 ** character.)^ The "%w" formatting option is intended for safely inserting
2394 ** table and column names into a constructed SQL statement.
2395 **
2283 ** ^(The "%z" formatting option works like "%s" but with the 2396 ** ^(The "%z" formatting option works like "%s" but with the
2284 ** addition that after the string has been read and copied into 2397 ** addition that after the string has been read and copied into
2285 ** the result, [sqlite3_free()] is called on the input string.)^ 2398 ** the result, [sqlite3_free()] is called on the input string.)^
2286 */ 2399 */
2287 SQLITE_API char *sqlite3_mprintf(const char*,...); 2400 SQLITE_API char *SQLITE_CDECL sqlite3_mprintf(const char*,...);
2288 SQLITE_API char *sqlite3_vmprintf(const char*, va_list); 2401 SQLITE_API char *SQLITE_STDCALL sqlite3_vmprintf(const char*, va_list);
2289 SQLITE_API char *sqlite3_snprintf(int,char*,const char*, ...); 2402 SQLITE_API char *SQLITE_CDECL sqlite3_snprintf(int,char*,const char*, ...);
2290 SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list); 2403 SQLITE_API char *SQLITE_STDCALL sqlite3_vsnprintf(int,char*,const char*, va_list );
2291 2404
2292 /* 2405 /*
2293 ** CAPI3REF: Memory Allocation Subsystem 2406 ** CAPI3REF: Memory Allocation Subsystem
2294 ** 2407 **
2295 ** The SQLite core uses these three routines for all of its own 2408 ** The SQLite core uses these three routines for all of its own
2296 ** internal memory allocation needs. "Core" in the previous sentence 2409 ** internal memory allocation needs. "Core" in the previous sentence
2297 ** does not include operating-system specific VFS implementation. The 2410 ** does not include operating-system specific VFS implementation. The
2298 ** Windows VFS uses native malloc() and free() for some operations. 2411 ** Windows VFS uses native malloc() and free() for some operations.
2299 ** 2412 **
2300 ** ^The sqlite3_malloc() routine returns a pointer to a block 2413 ** ^The sqlite3_malloc() routine returns a pointer to a block
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
2370 ** 2483 **
2371 ** The pointer arguments to [sqlite3_free()] and [sqlite3_realloc()] 2484 ** The pointer arguments to [sqlite3_free()] and [sqlite3_realloc()]
2372 ** must be either NULL or else pointers obtained from a prior 2485 ** must be either NULL or else pointers obtained from a prior
2373 ** invocation of [sqlite3_malloc()] or [sqlite3_realloc()] that have 2486 ** invocation of [sqlite3_malloc()] or [sqlite3_realloc()] that have
2374 ** not yet been released. 2487 ** not yet been released.
2375 ** 2488 **
2376 ** The application must not read or write any part of 2489 ** The application must not read or write any part of
2377 ** a block of memory after it has been released using 2490 ** a block of memory after it has been released using
2378 ** [sqlite3_free()] or [sqlite3_realloc()]. 2491 ** [sqlite3_free()] or [sqlite3_realloc()].
2379 */ 2492 */
2380 SQLITE_API void *sqlite3_malloc(int); 2493 SQLITE_API void *SQLITE_STDCALL sqlite3_malloc(int);
2381 SQLITE_API void *sqlite3_malloc64(sqlite3_uint64); 2494 SQLITE_API void *SQLITE_STDCALL sqlite3_malloc64(sqlite3_uint64);
2382 SQLITE_API void *sqlite3_realloc(void*, int); 2495 SQLITE_API void *SQLITE_STDCALL sqlite3_realloc(void*, int);
2383 SQLITE_API void *sqlite3_realloc64(void*, sqlite3_uint64); 2496 SQLITE_API void *SQLITE_STDCALL sqlite3_realloc64(void*, sqlite3_uint64);
2384 SQLITE_API void sqlite3_free(void*); 2497 SQLITE_API void SQLITE_STDCALL sqlite3_free(void*);
2385 SQLITE_API sqlite3_uint64 sqlite3_msize(void*); 2498 SQLITE_API sqlite3_uint64 SQLITE_STDCALL sqlite3_msize(void*);
2386 2499
2387 /* 2500 /*
2388 ** CAPI3REF: Memory Allocator Statistics 2501 ** CAPI3REF: Memory Allocator Statistics
2389 ** 2502 **
2390 ** SQLite provides these two interfaces for reporting on the status 2503 ** SQLite provides these two interfaces for reporting on the status
2391 ** of the [sqlite3_malloc()], [sqlite3_free()], and [sqlite3_realloc()] 2504 ** of the [sqlite3_malloc()], [sqlite3_free()], and [sqlite3_realloc()]
2392 ** routines, which form the built-in memory allocation subsystem. 2505 ** routines, which form the built-in memory allocation subsystem.
2393 ** 2506 **
2394 ** ^The [sqlite3_memory_used()] routine returns the number of bytes 2507 ** ^The [sqlite3_memory_used()] routine returns the number of bytes
2395 ** of memory currently outstanding (malloced but not freed). 2508 ** of memory currently outstanding (malloced but not freed).
2396 ** ^The [sqlite3_memory_highwater()] routine returns the maximum 2509 ** ^The [sqlite3_memory_highwater()] routine returns the maximum
2397 ** value of [sqlite3_memory_used()] since the high-water mark 2510 ** value of [sqlite3_memory_used()] since the high-water mark
2398 ** was last reset. ^The values returned by [sqlite3_memory_used()] and 2511 ** was last reset. ^The values returned by [sqlite3_memory_used()] and
2399 ** [sqlite3_memory_highwater()] include any overhead 2512 ** [sqlite3_memory_highwater()] include any overhead
2400 ** added by SQLite in its implementation of [sqlite3_malloc()], 2513 ** added by SQLite in its implementation of [sqlite3_malloc()],
2401 ** but not overhead added by the any underlying system library 2514 ** but not overhead added by the any underlying system library
2402 ** routines that [sqlite3_malloc()] may call. 2515 ** routines that [sqlite3_malloc()] may call.
2403 ** 2516 **
2404 ** ^The memory high-water mark is reset to the current value of 2517 ** ^The memory high-water mark is reset to the current value of
2405 ** [sqlite3_memory_used()] if and only if the parameter to 2518 ** [sqlite3_memory_used()] if and only if the parameter to
2406 ** [sqlite3_memory_highwater()] is true. ^The value returned 2519 ** [sqlite3_memory_highwater()] is true. ^The value returned
2407 ** by [sqlite3_memory_highwater(1)] is the high-water mark 2520 ** by [sqlite3_memory_highwater(1)] is the high-water mark
2408 ** prior to the reset. 2521 ** prior to the reset.
2409 */ 2522 */
2410 SQLITE_API sqlite3_int64 sqlite3_memory_used(void); 2523 SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_memory_used(void);
2411 SQLITE_API sqlite3_int64 sqlite3_memory_highwater(int resetFlag); 2524 SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_memory_highwater(int resetFlag);
2412 2525
2413 /* 2526 /*
2414 ** CAPI3REF: Pseudo-Random Number Generator 2527 ** CAPI3REF: Pseudo-Random Number Generator
2415 ** 2528 **
2416 ** SQLite contains a high-quality pseudo-random number generator (PRNG) used to 2529 ** SQLite contains a high-quality pseudo-random number generator (PRNG) used to
2417 ** select random [ROWID | ROWIDs] when inserting new records into a table that 2530 ** select random [ROWID | ROWIDs] when inserting new records into a table that
2418 ** already uses the largest possible [ROWID]. The PRNG is also used for 2531 ** already uses the largest possible [ROWID]. The PRNG is also used for
2419 ** the build-in random() and randomblob() SQL functions. This interface allows 2532 ** the build-in random() and randomblob() SQL functions. This interface allows
2420 ** applications to access the same PRNG for other purposes. 2533 ** applications to access the same PRNG for other purposes.
2421 ** 2534 **
2422 ** ^A call to this routine stores N bytes of randomness into buffer P. 2535 ** ^A call to this routine stores N bytes of randomness into buffer P.
2423 ** ^If N is less than one, then P can be a NULL pointer. 2536 ** ^The P parameter can be a NULL pointer.
2424 ** 2537 **
2425 ** ^If this routine has not been previously called or if the previous 2538 ** ^If this routine has not been previously called or if the previous
2426 ** call had N less than one, then the PRNG is seeded using randomness 2539 ** call had N less than one or a NULL pointer for P, then the PRNG is
2427 ** obtained from the xRandomness method of the default [sqlite3_vfs] object. 2540 ** seeded using randomness obtained from the xRandomness method of
2428 ** ^If the previous call to this routine had an N of 1 or more then 2541 ** the default [sqlite3_vfs] object.
2429 ** the pseudo-randomness is generated 2542 ** ^If the previous call to this routine had an N of 1 or more and a
2543 ** non-NULL P then the pseudo-randomness is generated
2430 ** internally and without recourse to the [sqlite3_vfs] xRandomness 2544 ** internally and without recourse to the [sqlite3_vfs] xRandomness
2431 ** method. 2545 ** method.
2432 */ 2546 */
2433 SQLITE_API void sqlite3_randomness(int N, void *P); 2547 SQLITE_API void SQLITE_STDCALL sqlite3_randomness(int N, void *P);
2434 2548
2435 /* 2549 /*
2436 ** CAPI3REF: Compile-Time Authorization Callbacks 2550 ** CAPI3REF: Compile-Time Authorization Callbacks
2551 ** METHOD: sqlite3
2437 ** 2552 **
2438 ** ^This routine registers an authorizer callback with a particular 2553 ** ^This routine registers an authorizer callback with a particular
2439 ** [database connection], supplied in the first argument. 2554 ** [database connection], supplied in the first argument.
2440 ** ^The authorizer callback is invoked as SQL statements are being compiled 2555 ** ^The authorizer callback is invoked as SQL statements are being compiled
2441 ** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()], 2556 ** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()],
2442 ** [sqlite3_prepare16()] and [sqlite3_prepare16_v2()]. ^At various 2557 ** [sqlite3_prepare16()] and [sqlite3_prepare16_v2()]. ^At various
2443 ** points during the compilation process, as logic is being created 2558 ** points during the compilation process, as logic is being created
2444 ** to perform various actions, the authorizer callback is invoked to 2559 ** to perform various actions, the authorizer callback is invoked to
2445 ** see if those actions are allowed. ^The authorizer callback should 2560 ** see if those actions are allowed. ^The authorizer callback should
2446 ** return [SQLITE_OK] to allow the action, [SQLITE_IGNORE] to disallow the 2561 ** return [SQLITE_OK] to allow the action, [SQLITE_IGNORE] to disallow the
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
2505 ** statement might be re-prepared during [sqlite3_step()] due to a 2620 ** statement might be re-prepared during [sqlite3_step()] due to a
2506 ** schema change. Hence, the application should ensure that the 2621 ** schema change. Hence, the application should ensure that the
2507 ** correct authorizer callback remains in place during the [sqlite3_step()]. 2622 ** correct authorizer callback remains in place during the [sqlite3_step()].
2508 ** 2623 **
2509 ** ^Note that the authorizer callback is invoked only during 2624 ** ^Note that the authorizer callback is invoked only during
2510 ** [sqlite3_prepare()] or its variants. Authorization is not 2625 ** [sqlite3_prepare()] or its variants. Authorization is not
2511 ** performed during statement evaluation in [sqlite3_step()], unless 2626 ** performed during statement evaluation in [sqlite3_step()], unless
2512 ** as stated in the previous paragraph, sqlite3_step() invokes 2627 ** as stated in the previous paragraph, sqlite3_step() invokes
2513 ** sqlite3_prepare_v2() to reprepare a statement after a schema change. 2628 ** sqlite3_prepare_v2() to reprepare a statement after a schema change.
2514 */ 2629 */
2515 SQLITE_API int sqlite3_set_authorizer( 2630 SQLITE_API int SQLITE_STDCALL sqlite3_set_authorizer(
2516 sqlite3*, 2631 sqlite3*,
2517 int (*xAuth)(void*,int,const char*,const char*,const char*,const char*), 2632 int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),
2518 void *pUserData 2633 void *pUserData
2519 ); 2634 );
2520 2635
2521 /* 2636 /*
2522 ** CAPI3REF: Authorizer Return Codes 2637 ** CAPI3REF: Authorizer Return Codes
2523 ** 2638 **
2524 ** The [sqlite3_set_authorizer | authorizer callback function] must 2639 ** The [sqlite3_set_authorizer | authorizer callback function] must
2525 ** return either [SQLITE_OK] or one of these two constants in order 2640 ** return either [SQLITE_OK] or one of these two constants in order
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
2583 #define SQLITE_ANALYZE 28 /* Table Name NULL */ 2698 #define SQLITE_ANALYZE 28 /* Table Name NULL */
2584 #define SQLITE_CREATE_VTABLE 29 /* Table Name Module Name */ 2699 #define SQLITE_CREATE_VTABLE 29 /* Table Name Module Name */
2585 #define SQLITE_DROP_VTABLE 30 /* Table Name Module Name */ 2700 #define SQLITE_DROP_VTABLE 30 /* Table Name Module Name */
2586 #define SQLITE_FUNCTION 31 /* NULL Function Name */ 2701 #define SQLITE_FUNCTION 31 /* NULL Function Name */
2587 #define SQLITE_SAVEPOINT 32 /* Operation Savepoint Name */ 2702 #define SQLITE_SAVEPOINT 32 /* Operation Savepoint Name */
2588 #define SQLITE_COPY 0 /* No longer used */ 2703 #define SQLITE_COPY 0 /* No longer used */
2589 #define SQLITE_RECURSIVE 33 /* NULL NULL */ 2704 #define SQLITE_RECURSIVE 33 /* NULL NULL */
2590 2705
2591 /* 2706 /*
2592 ** CAPI3REF: Tracing And Profiling Functions 2707 ** CAPI3REF: Tracing And Profiling Functions
2708 ** METHOD: sqlite3
2593 ** 2709 **
2594 ** These routines register callback functions that can be used for 2710 ** These routines register callback functions that can be used for
2595 ** tracing and profiling the execution of SQL statements. 2711 ** tracing and profiling the execution of SQL statements.
2596 ** 2712 **
2597 ** ^The callback function registered by sqlite3_trace() is invoked at 2713 ** ^The callback function registered by sqlite3_trace() is invoked at
2598 ** various times when an SQL statement is being run by [sqlite3_step()]. 2714 ** various times when an SQL statement is being run by [sqlite3_step()].
2599 ** ^The sqlite3_trace() callback is invoked with a UTF-8 rendering of the 2715 ** ^The sqlite3_trace() callback is invoked with a UTF-8 rendering of the
2600 ** SQL statement text as the statement first begins executing. 2716 ** SQL statement text as the statement first begins executing.
2601 ** ^(Additional sqlite3_trace() callbacks might occur 2717 ** ^(Additional sqlite3_trace() callbacks might occur
2602 ** as each triggered subprogram is entered. The callbacks for triggers 2718 ** as each triggered subprogram is entered. The callbacks for triggers
2603 ** contain a UTF-8 SQL comment that identifies the trigger.)^ 2719 ** contain a UTF-8 SQL comment that identifies the trigger.)^
2604 ** 2720 **
2605 ** The [SQLITE_TRACE_SIZE_LIMIT] compile-time option can be used to limit 2721 ** The [SQLITE_TRACE_SIZE_LIMIT] compile-time option can be used to limit
2606 ** the length of [bound parameter] expansion in the output of sqlite3_trace(). 2722 ** the length of [bound parameter] expansion in the output of sqlite3_trace().
2607 ** 2723 **
2608 ** ^The callback function registered by sqlite3_profile() is invoked 2724 ** ^The callback function registered by sqlite3_profile() is invoked
2609 ** as each SQL statement finishes. ^The profile callback contains 2725 ** as each SQL statement finishes. ^The profile callback contains
2610 ** the original statement text and an estimate of wall-clock time 2726 ** the original statement text and an estimate of wall-clock time
2611 ** of how long that statement took to run. ^The profile callback 2727 ** of how long that statement took to run. ^The profile callback
2612 ** time is in units of nanoseconds, however the current implementation 2728 ** time is in units of nanoseconds, however the current implementation
2613 ** is only capable of millisecond resolution so the six least significant 2729 ** is only capable of millisecond resolution so the six least significant
2614 ** digits in the time are meaningless. Future versions of SQLite 2730 ** digits in the time are meaningless. Future versions of SQLite
2615 ** might provide greater resolution on the profiler callback. The 2731 ** might provide greater resolution on the profiler callback. The
2616 ** sqlite3_profile() function is considered experimental and is 2732 ** sqlite3_profile() function is considered experimental and is
2617 ** subject to change in future versions of SQLite. 2733 ** subject to change in future versions of SQLite.
2618 */ 2734 */
2619 SQLITE_API void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void* ); 2735 SQLITE_API void *SQLITE_STDCALL sqlite3_trace(sqlite3*, void(*xTrace)(void*,cons t char*), void*);
2620 SQLITE_API SQLITE_EXPERIMENTAL void *sqlite3_profile(sqlite3*, 2736 SQLITE_API SQLITE_EXPERIMENTAL void *SQLITE_STDCALL sqlite3_profile(sqlite3*,
2621 void(*xProfile)(void*,const char*,sqlite3_uint64), void*); 2737 void(*xProfile)(void*,const char*,sqlite3_uint64), void*);
2622 2738
2623 /* 2739 /*
2624 ** CAPI3REF: Query Progress Callbacks 2740 ** CAPI3REF: Query Progress Callbacks
2741 ** METHOD: sqlite3
2625 ** 2742 **
2626 ** ^The sqlite3_progress_handler(D,N,X,P) interface causes the callback 2743 ** ^The sqlite3_progress_handler(D,N,X,P) interface causes the callback
2627 ** function X to be invoked periodically during long running calls to 2744 ** function X to be invoked periodically during long running calls to
2628 ** [sqlite3_exec()], [sqlite3_step()] and [sqlite3_get_table()] for 2745 ** [sqlite3_exec()], [sqlite3_step()] and [sqlite3_get_table()] for
2629 ** database connection D. An example use for this 2746 ** database connection D. An example use for this
2630 ** interface is to keep a GUI updated during a large query. 2747 ** interface is to keep a GUI updated during a large query.
2631 ** 2748 **
2632 ** ^The parameter P is passed through as the only parameter to the 2749 ** ^The parameter P is passed through as the only parameter to the
2633 ** callback function X. ^The parameter N is the approximate number of 2750 ** callback function X. ^The parameter N is the approximate number of
2634 ** [virtual machine instructions] that are evaluated between successive 2751 ** [virtual machine instructions] that are evaluated between successive
2635 ** invocations of the callback X. ^If N is less than one then the progress 2752 ** invocations of the callback X. ^If N is less than one then the progress
2636 ** handler is disabled. 2753 ** handler is disabled.
2637 ** 2754 **
2638 ** ^Only a single progress handler may be defined at one time per 2755 ** ^Only a single progress handler may be defined at one time per
2639 ** [database connection]; setting a new progress handler cancels the 2756 ** [database connection]; setting a new progress handler cancels the
2640 ** old one. ^Setting parameter X to NULL disables the progress handler. 2757 ** old one. ^Setting parameter X to NULL disables the progress handler.
2641 ** ^The progress handler is also disabled by setting N to a value less 2758 ** ^The progress handler is also disabled by setting N to a value less
2642 ** than 1. 2759 ** than 1.
2643 ** 2760 **
2644 ** ^If the progress callback returns non-zero, the operation is 2761 ** ^If the progress callback returns non-zero, the operation is
2645 ** interrupted. This feature can be used to implement a 2762 ** interrupted. This feature can be used to implement a
2646 ** "Cancel" button on a GUI progress dialog box. 2763 ** "Cancel" button on a GUI progress dialog box.
2647 ** 2764 **
2648 ** The progress handler callback must not do anything that will modify 2765 ** The progress handler callback must not do anything that will modify
2649 ** the database connection that invoked the progress handler. 2766 ** the database connection that invoked the progress handler.
2650 ** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their 2767 ** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
2651 ** database connections for the meaning of "modify" in this paragraph. 2768 ** database connections for the meaning of "modify" in this paragraph.
2652 ** 2769 **
2653 */ 2770 */
2654 SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); 2771 SQLITE_API void SQLITE_STDCALL sqlite3_progress_handler(sqlite3*, int, int(*)(vo id*), void*);
2655 2772
2656 /* 2773 /*
2657 ** CAPI3REF: Opening A New Database Connection 2774 ** CAPI3REF: Opening A New Database Connection
2775 ** CONSTRUCTOR: sqlite3
2658 ** 2776 **
2659 ** ^These routines open an SQLite database file as specified by the 2777 ** ^These routines open an SQLite database file as specified by the
2660 ** filename argument. ^The filename argument is interpreted as UTF-8 for 2778 ** filename argument. ^The filename argument is interpreted as UTF-8 for
2661 ** sqlite3_open() and sqlite3_open_v2() and as UTF-16 in the native byte 2779 ** sqlite3_open() and sqlite3_open_v2() and as UTF-16 in the native byte
2662 ** order for sqlite3_open16(). ^(A [database connection] handle is usually 2780 ** order for sqlite3_open16(). ^(A [database connection] handle is usually
2663 ** returned in *ppDb, even if an error occurs. The only exception is that 2781 ** returned in *ppDb, even if an error occurs. The only exception is that
2664 ** if SQLite is unable to allocate memory to hold the [sqlite3] object, 2782 ** if SQLite is unable to allocate memory to hold the [sqlite3] object,
2665 ** a NULL will be written into *ppDb instead of a pointer to the [sqlite3] 2783 ** a NULL will be written into *ppDb instead of a pointer to the [sqlite3]
2666 ** object.)^ ^(If the database is opened (and/or created) successfully, then 2784 ** object.)^ ^(If the database is opened (and/or created) successfully, then
2667 ** [SQLITE_OK] is returned. Otherwise an [error code] is returned.)^ ^The 2785 ** [SQLITE_OK] is returned. Otherwise an [error code] is returned.)^ ^The
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
2872 ** codepage is currently defined. Filenames containing international 2990 ** codepage is currently defined. Filenames containing international
2873 ** characters must be converted to UTF-8 prior to passing them into 2991 ** characters must be converted to UTF-8 prior to passing them into
2874 ** sqlite3_open() or sqlite3_open_v2(). 2992 ** sqlite3_open() or sqlite3_open_v2().
2875 ** 2993 **
2876 ** <b>Note to Windows Runtime users:</b> The temporary directory must be set 2994 ** <b>Note to Windows Runtime users:</b> The temporary directory must be set
2877 ** prior to calling sqlite3_open() or sqlite3_open_v2(). Otherwise, various 2995 ** prior to calling sqlite3_open() or sqlite3_open_v2(). Otherwise, various
2878 ** features that require the use of temporary files may fail. 2996 ** features that require the use of temporary files may fail.
2879 ** 2997 **
2880 ** See also: [sqlite3_temp_directory] 2998 ** See also: [sqlite3_temp_directory]
2881 */ 2999 */
2882 SQLITE_API int sqlite3_open( 3000 SQLITE_API int SQLITE_STDCALL sqlite3_open(
2883 const char *filename, /* Database filename (UTF-8) */ 3001 const char *filename, /* Database filename (UTF-8) */
2884 sqlite3 **ppDb /* OUT: SQLite db handle */ 3002 sqlite3 **ppDb /* OUT: SQLite db handle */
2885 ); 3003 );
2886 SQLITE_API int sqlite3_open16( 3004 SQLITE_API int SQLITE_STDCALL sqlite3_open16(
2887 const void *filename, /* Database filename (UTF-16) */ 3005 const void *filename, /* Database filename (UTF-16) */
2888 sqlite3 **ppDb /* OUT: SQLite db handle */ 3006 sqlite3 **ppDb /* OUT: SQLite db handle */
2889 ); 3007 );
2890 SQLITE_API int sqlite3_open_v2( 3008 SQLITE_API int SQLITE_STDCALL sqlite3_open_v2(
2891 const char *filename, /* Database filename (UTF-8) */ 3009 const char *filename, /* Database filename (UTF-8) */
2892 sqlite3 **ppDb, /* OUT: SQLite db handle */ 3010 sqlite3 **ppDb, /* OUT: SQLite db handle */
2893 int flags, /* Flags */ 3011 int flags, /* Flags */
2894 const char *zVfs /* Name of VFS module to use */ 3012 const char *zVfs /* Name of VFS module to use */
2895 ); 3013 );
2896 3014
2897 /* 3015 /*
2898 ** CAPI3REF: Obtain Values For URI Parameters 3016 ** CAPI3REF: Obtain Values For URI Parameters
2899 ** 3017 **
2900 ** These are utility routines, useful to VFS implementations, that check 3018 ** These are utility routines, useful to VFS implementations, that check
(...skipping 25 matching lines...) Expand all
2926 ** 64-bit signed integer and returns that integer, or D if P does not 3044 ** 64-bit signed integer and returns that integer, or D if P does not
2927 ** exist. If the value of P is something other than an integer, then 3045 ** exist. If the value of P is something other than an integer, then
2928 ** zero is returned. 3046 ** zero is returned.
2929 ** 3047 **
2930 ** If F is a NULL pointer, then sqlite3_uri_parameter(F,P) returns NULL and 3048 ** If F is a NULL pointer, then sqlite3_uri_parameter(F,P) returns NULL and
2931 ** sqlite3_uri_boolean(F,P,B) returns B. If F is not a NULL pointer and 3049 ** sqlite3_uri_boolean(F,P,B) returns B. If F is not a NULL pointer and
2932 ** is not a database file pathname pointer that SQLite passed into the xOpen 3050 ** is not a database file pathname pointer that SQLite passed into the xOpen
2933 ** VFS method, then the behavior of this routine is undefined and probably 3051 ** VFS method, then the behavior of this routine is undefined and probably
2934 ** undesirable. 3052 ** undesirable.
2935 */ 3053 */
2936 SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char * zParam); 3054 SQLITE_API const char *SQLITE_STDCALL sqlite3_uri_parameter(const char *zFilenam e, const char *zParam);
2937 SQLITE_API int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bD efault); 3055 SQLITE_API int SQLITE_STDCALL sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault);
2938 SQLITE_API sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int 64); 3056 SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_uri_int64(const char*, const cha r*, sqlite3_int64);
2939 3057
2940 3058
2941 /* 3059 /*
2942 ** CAPI3REF: Error Codes And Messages 3060 ** CAPI3REF: Error Codes And Messages
3061 ** METHOD: sqlite3
2943 ** 3062 **
2944 ** ^The sqlite3_errcode() interface returns the numeric [result code] or 3063 ** ^If the most recent sqlite3_* API call associated with
2945 ** [extended result code] for the most recent failed sqlite3_* API call 3064 ** [database connection] D failed, then the sqlite3_errcode(D) interface
2946 ** associated with a [database connection]. If a prior API call failed 3065 ** returns the numeric [result code] or [extended result code] for that
2947 ** but the most recent API call succeeded, the return value from 3066 ** API call.
2948 ** sqlite3_errcode() is undefined. ^The sqlite3_extended_errcode() 3067 ** If the most recent API call was successful,
3068 ** then the return value from sqlite3_errcode() is undefined.
3069 ** ^The sqlite3_extended_errcode()
2949 ** interface is the same except that it always returns the 3070 ** interface is the same except that it always returns the
2950 ** [extended result code] even when extended result codes are 3071 ** [extended result code] even when extended result codes are
2951 ** disabled. 3072 ** disabled.
2952 ** 3073 **
2953 ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language 3074 ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
2954 ** text that describes the error, as either UTF-8 or UTF-16 respectively. 3075 ** text that describes the error, as either UTF-8 or UTF-16 respectively.
2955 ** ^(Memory to hold the error message string is managed internally. 3076 ** ^(Memory to hold the error message string is managed internally.
2956 ** The application does not need to worry about freeing the result. 3077 ** The application does not need to worry about freeing the result.
2957 ** However, the error string might be overwritten or deallocated by 3078 ** However, the error string might be overwritten or deallocated by
2958 ** subsequent calls to other SQLite interface functions.)^ 3079 ** subsequent calls to other SQLite interface functions.)^
(...skipping 10 matching lines...) Expand all
2969 ** interfaces always report the most recent result. To avoid 3090 ** interfaces always report the most recent result. To avoid
2970 ** this, each thread can obtain exclusive use of the [database connection] D 3091 ** this, each thread can obtain exclusive use of the [database connection] D
2971 ** by invoking [sqlite3_mutex_enter]([sqlite3_db_mutex](D)) before beginning 3092 ** by invoking [sqlite3_mutex_enter]([sqlite3_db_mutex](D)) before beginning
2972 ** to use D and invoking [sqlite3_mutex_leave]([sqlite3_db_mutex](D)) after 3093 ** to use D and invoking [sqlite3_mutex_leave]([sqlite3_db_mutex](D)) after
2973 ** all calls to the interfaces listed here are completed. 3094 ** all calls to the interfaces listed here are completed.
2974 ** 3095 **
2975 ** If an interface fails with SQLITE_MISUSE, that means the interface 3096 ** If an interface fails with SQLITE_MISUSE, that means the interface
2976 ** was invoked incorrectly by the application. In that case, the 3097 ** was invoked incorrectly by the application. In that case, the
2977 ** error code and message may or may not be set. 3098 ** error code and message may or may not be set.
2978 */ 3099 */
2979 SQLITE_API int sqlite3_errcode(sqlite3 *db); 3100 SQLITE_API int SQLITE_STDCALL sqlite3_errcode(sqlite3 *db);
2980 SQLITE_API int sqlite3_extended_errcode(sqlite3 *db); 3101 SQLITE_API int SQLITE_STDCALL sqlite3_extended_errcode(sqlite3 *db);
2981 SQLITE_API const char *sqlite3_errmsg(sqlite3*); 3102 SQLITE_API const char *SQLITE_STDCALL sqlite3_errmsg(sqlite3*);
2982 SQLITE_API const void *sqlite3_errmsg16(sqlite3*); 3103 SQLITE_API const void *SQLITE_STDCALL sqlite3_errmsg16(sqlite3*);
2983 SQLITE_API const char *sqlite3_errstr(int); 3104 SQLITE_API const char *SQLITE_STDCALL sqlite3_errstr(int);
2984 3105
2985 /* 3106 /*
2986 ** CAPI3REF: SQL Statement Object 3107 ** CAPI3REF: Prepared Statement Object
2987 ** KEYWORDS: {prepared statement} {prepared statements} 3108 ** KEYWORDS: {prepared statement} {prepared statements}
2988 ** 3109 **
2989 ** An instance of this object represents a single SQL statement. 3110 ** An instance of this object represents a single SQL statement that
2990 ** This object is variously known as a "prepared statement" or a 3111 ** has been compiled into binary form and is ready to be evaluated.
2991 ** "compiled SQL statement" or simply as a "statement".
2992 ** 3112 **
2993 ** The life of a statement object goes something like this: 3113 ** Think of each SQL statement as a separate computer program. The
3114 ** original SQL text is source code. A prepared statement object
3115 ** is the compiled object code. All SQL must be converted into a
3116 ** prepared statement before it can be run.
3117 **
3118 ** The life-cycle of a prepared statement object usually goes like this:
2994 ** 3119 **
2995 ** <ol> 3120 ** <ol>
2996 ** <li> Create the object using [sqlite3_prepare_v2()] or a related 3121 ** <li> Create the prepared statement object using [sqlite3_prepare_v2()].
2997 ** function. 3122 ** <li> Bind values to [parameters] using the sqlite3_bind_*()
2998 ** <li> Bind values to [host parameters] using the sqlite3_bind_*()
2999 ** interfaces. 3123 ** interfaces.
3000 ** <li> Run the SQL by calling [sqlite3_step()] one or more times. 3124 ** <li> Run the SQL by calling [sqlite3_step()] one or more times.
3001 ** <li> Reset the statement using [sqlite3_reset()] then go back 3125 ** <li> Reset the prepared statement using [sqlite3_reset()] then go back
3002 ** to step 2. Do this zero or more times. 3126 ** to step 2. Do this zero or more times.
3003 ** <li> Destroy the object using [sqlite3_finalize()]. 3127 ** <li> Destroy the object using [sqlite3_finalize()].
3004 ** </ol> 3128 ** </ol>
3005 **
3006 ** Refer to documentation on individual methods above for additional
3007 ** information.
3008 */ 3129 */
3009 typedef struct sqlite3_stmt sqlite3_stmt; 3130 typedef struct sqlite3_stmt sqlite3_stmt;
3010 3131
3011 /* 3132 /*
3012 ** CAPI3REF: Run-time Limits 3133 ** CAPI3REF: Run-time Limits
3134 ** METHOD: sqlite3
3013 ** 3135 **
3014 ** ^(This interface allows the size of various constructs to be limited 3136 ** ^(This interface allows the size of various constructs to be limited
3015 ** on a connection by connection basis. The first parameter is the 3137 ** on a connection by connection basis. The first parameter is the
3016 ** [database connection] whose limit is to be set or queried. The 3138 ** [database connection] whose limit is to be set or queried. The
3017 ** second parameter is one of the [limit categories] that define a 3139 ** second parameter is one of the [limit categories] that define a
3018 ** class of constructs to be size limited. The third parameter is the 3140 ** class of constructs to be size limited. The third parameter is the
3019 ** new limit for that construct.)^ 3141 ** new limit for that construct.)^
3020 ** 3142 **
3021 ** ^If the new limit is a negative number, the limit is unchanged. 3143 ** ^If the new limit is a negative number, the limit is unchanged.
3022 ** ^(For each limit category SQLITE_LIMIT_<i>NAME</i> there is a 3144 ** ^(For each limit category SQLITE_LIMIT_<i>NAME</i> there is a
(...skipping 17 matching lines...) Expand all
3040 ** off the Internet. The internal databases can be given the 3162 ** off the Internet. The internal databases can be given the
3041 ** large, default limits. Databases managed by external sources can 3163 ** large, default limits. Databases managed by external sources can
3042 ** be given much smaller limits designed to prevent a denial of service 3164 ** be given much smaller limits designed to prevent a denial of service
3043 ** attack. Developers might also want to use the [sqlite3_set_authorizer()] 3165 ** attack. Developers might also want to use the [sqlite3_set_authorizer()]
3044 ** interface to further control untrusted SQL. The size of the database 3166 ** interface to further control untrusted SQL. The size of the database
3045 ** created by an untrusted script can be contained using the 3167 ** created by an untrusted script can be contained using the
3046 ** [max_page_count] [PRAGMA]. 3168 ** [max_page_count] [PRAGMA].
3047 ** 3169 **
3048 ** New run-time limit categories may be added in future releases. 3170 ** New run-time limit categories may be added in future releases.
3049 */ 3171 */
3050 SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal); 3172 SQLITE_API int SQLITE_STDCALL sqlite3_limit(sqlite3*, int id, int newVal);
3051 3173
3052 /* 3174 /*
3053 ** CAPI3REF: Run-Time Limit Categories 3175 ** CAPI3REF: Run-Time Limit Categories
3054 ** KEYWORDS: {limit category} {*limit categories} 3176 ** KEYWORDS: {limit category} {*limit categories}
3055 ** 3177 **
3056 ** These constants define various performance limits 3178 ** These constants define various performance limits
3057 ** that can be lowered at run-time using [sqlite3_limit()]. 3179 ** that can be lowered at run-time using [sqlite3_limit()].
3058 ** The synopsis of the meanings of the various limits is shown below. 3180 ** The synopsis of the meanings of the various limits is shown below.
3059 ** Additional information is available at [limits | Limits in SQLite]. 3181 ** Additional information is available at [limits | Limits in SQLite].
3060 ** 3182 **
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
3114 #define SQLITE_LIMIT_FUNCTION_ARG 6 3236 #define SQLITE_LIMIT_FUNCTION_ARG 6
3115 #define SQLITE_LIMIT_ATTACHED 7 3237 #define SQLITE_LIMIT_ATTACHED 7
3116 #define SQLITE_LIMIT_LIKE_PATTERN_LENGTH 8 3238 #define SQLITE_LIMIT_LIKE_PATTERN_LENGTH 8
3117 #define SQLITE_LIMIT_VARIABLE_NUMBER 9 3239 #define SQLITE_LIMIT_VARIABLE_NUMBER 9
3118 #define SQLITE_LIMIT_TRIGGER_DEPTH 10 3240 #define SQLITE_LIMIT_TRIGGER_DEPTH 10
3119 #define SQLITE_LIMIT_WORKER_THREADS 11 3241 #define SQLITE_LIMIT_WORKER_THREADS 11
3120 3242
3121 /* 3243 /*
3122 ** CAPI3REF: Compiling An SQL Statement 3244 ** CAPI3REF: Compiling An SQL Statement
3123 ** KEYWORDS: {SQL statement compiler} 3245 ** KEYWORDS: {SQL statement compiler}
3246 ** METHOD: sqlite3
3247 ** CONSTRUCTOR: sqlite3_stmt
3124 ** 3248 **
3125 ** To execute an SQL query, it must first be compiled into a byte-code 3249 ** To execute an SQL query, it must first be compiled into a byte-code
3126 ** program using one of these routines. 3250 ** program using one of these routines.
3127 ** 3251 **
3128 ** The first argument, "db", is a [database connection] obtained from a 3252 ** The first argument, "db", is a [database connection] obtained from a
3129 ** prior successful call to [sqlite3_open()], [sqlite3_open_v2()] or 3253 ** prior successful call to [sqlite3_open()], [sqlite3_open_v2()] or
3130 ** [sqlite3_open16()]. The database connection must not have been closed. 3254 ** [sqlite3_open16()]. The database connection must not have been closed.
3131 ** 3255 **
3132 ** The second argument, "zSql", is the statement to be compiled, encoded 3256 ** The second argument, "zSql", is the statement to be compiled, encoded
3133 ** as either UTF-8 or UTF-16. The sqlite3_prepare() and sqlite3_prepare_v2() 3257 ** as either UTF-8 or UTF-16. The sqlite3_prepare() and sqlite3_prepare_v2()
3134 ** interfaces use UTF-8, and sqlite3_prepare16() and sqlite3_prepare16_v2() 3258 ** interfaces use UTF-8, and sqlite3_prepare16() and sqlite3_prepare16_v2()
3135 ** use UTF-16. 3259 ** use UTF-16.
3136 ** 3260 **
3137 ** ^If the nByte argument is less than zero, then zSql is read up to the 3261 ** ^If the nByte argument is negative, then zSql is read up to the
3138 ** first zero terminator. ^If nByte is non-negative, then it is the maximum 3262 ** first zero terminator. ^If nByte is positive, then it is the
3139 ** number of bytes read from zSql. ^When nByte is non-negative, the 3263 ** number of bytes read from zSql. ^If nByte is zero, then no prepared
3140 ** zSql string ends at either the first '\000' or '\u0000' character or 3264 ** statement is generated.
3141 ** the nByte-th byte, whichever comes first. If the caller knows 3265 ** If the caller knows that the supplied string is nul-terminated, then
3142 ** that the supplied string is nul-terminated, then there is a small 3266 ** there is a small performance advantage to passing an nByte parameter that
3143 ** performance advantage to be gained by passing an nByte parameter that 3267 ** is the number of bytes in the input string <i>including</i>
3144 ** is equal to the number of bytes in the input string <i>including</i> 3268 ** the nul-terminator.
3145 ** the nul-terminator bytes as this saves SQLite from having to
3146 ** make a copy of the input string.
3147 ** 3269 **
3148 ** ^If pzTail is not NULL then *pzTail is made to point to the first byte 3270 ** ^If pzTail is not NULL then *pzTail is made to point to the first byte
3149 ** past the end of the first SQL statement in zSql. These routines only 3271 ** past the end of the first SQL statement in zSql. These routines only
3150 ** compile the first statement in zSql, so *pzTail is left pointing to 3272 ** compile the first statement in zSql, so *pzTail is left pointing to
3151 ** what remains uncompiled. 3273 ** what remains uncompiled.
3152 ** 3274 **
3153 ** ^*ppStmt is left pointing to a compiled [prepared statement] that can be 3275 ** ^*ppStmt is left pointing to a compiled [prepared statement] that can be
3154 ** executed using [sqlite3_step()]. ^If there is an error, *ppStmt is set 3276 ** executed using [sqlite3_step()]. ^If there is an error, *ppStmt is set
3155 ** to NULL. ^If the input text contains no SQL (if the input is an empty 3277 ** to NULL. ^If the input text contains no SQL (if the input is an empty
3156 ** string or a comment) then *ppStmt is set to NULL. 3278 ** string or a comment) then *ppStmt is set to NULL.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
3192 ** then the statement will be automatically recompiled, as if there had been 3314 ** then the statement will be automatically recompiled, as if there had been
3193 ** a schema change, on the first [sqlite3_step()] call following any change 3315 ** a schema change, on the first [sqlite3_step()] call following any change
3194 ** to the [sqlite3_bind_text | bindings] of that [parameter]. 3316 ** to the [sqlite3_bind_text | bindings] of that [parameter].
3195 ** ^The specific value of WHERE-clause [parameter] might influence the 3317 ** ^The specific value of WHERE-clause [parameter] might influence the
3196 ** choice of query plan if the parameter is the left-hand side of a [LIKE] 3318 ** choice of query plan if the parameter is the left-hand side of a [LIKE]
3197 ** or [GLOB] operator or if the parameter is compared to an indexed column 3319 ** or [GLOB] operator or if the parameter is compared to an indexed column
3198 ** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled. 3320 ** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled.
3199 ** </li> 3321 ** </li>
3200 ** </ol> 3322 ** </ol>
3201 */ 3323 */
3202 SQLITE_API int sqlite3_prepare( 3324 SQLITE_API int SQLITE_STDCALL sqlite3_prepare(
3203 sqlite3 *db, /* Database handle */ 3325 sqlite3 *db, /* Database handle */
3204 const char *zSql, /* SQL statement, UTF-8 encoded */ 3326 const char *zSql, /* SQL statement, UTF-8 encoded */
3205 int nByte, /* Maximum length of zSql in bytes. */ 3327 int nByte, /* Maximum length of zSql in bytes. */
3206 sqlite3_stmt **ppStmt, /* OUT: Statement handle */ 3328 sqlite3_stmt **ppStmt, /* OUT: Statement handle */
3207 const char **pzTail /* OUT: Pointer to unused portion of zSql */ 3329 const char **pzTail /* OUT: Pointer to unused portion of zSql */
3208 ); 3330 );
3209 SQLITE_API int sqlite3_prepare_v2( 3331 SQLITE_API int SQLITE_STDCALL sqlite3_prepare_v2(
3210 sqlite3 *db, /* Database handle */ 3332 sqlite3 *db, /* Database handle */
3211 const char *zSql, /* SQL statement, UTF-8 encoded */ 3333 const char *zSql, /* SQL statement, UTF-8 encoded */
3212 int nByte, /* Maximum length of zSql in bytes. */ 3334 int nByte, /* Maximum length of zSql in bytes. */
3213 sqlite3_stmt **ppStmt, /* OUT: Statement handle */ 3335 sqlite3_stmt **ppStmt, /* OUT: Statement handle */
3214 const char **pzTail /* OUT: Pointer to unused portion of zSql */ 3336 const char **pzTail /* OUT: Pointer to unused portion of zSql */
3215 ); 3337 );
3216 SQLITE_API int sqlite3_prepare16( 3338 SQLITE_API int SQLITE_STDCALL sqlite3_prepare16(
3217 sqlite3 *db, /* Database handle */ 3339 sqlite3 *db, /* Database handle */
3218 const void *zSql, /* SQL statement, UTF-16 encoded */ 3340 const void *zSql, /* SQL statement, UTF-16 encoded */
3219 int nByte, /* Maximum length of zSql in bytes. */ 3341 int nByte, /* Maximum length of zSql in bytes. */
3220 sqlite3_stmt **ppStmt, /* OUT: Statement handle */ 3342 sqlite3_stmt **ppStmt, /* OUT: Statement handle */
3221 const void **pzTail /* OUT: Pointer to unused portion of zSql */ 3343 const void **pzTail /* OUT: Pointer to unused portion of zSql */
3222 ); 3344 );
3223 SQLITE_API int sqlite3_prepare16_v2( 3345 SQLITE_API int SQLITE_STDCALL sqlite3_prepare16_v2(
3224 sqlite3 *db, /* Database handle */ 3346 sqlite3 *db, /* Database handle */
3225 const void *zSql, /* SQL statement, UTF-16 encoded */ 3347 const void *zSql, /* SQL statement, UTF-16 encoded */
3226 int nByte, /* Maximum length of zSql in bytes. */ 3348 int nByte, /* Maximum length of zSql in bytes. */
3227 sqlite3_stmt **ppStmt, /* OUT: Statement handle */ 3349 sqlite3_stmt **ppStmt, /* OUT: Statement handle */
3228 const void **pzTail /* OUT: Pointer to unused portion of zSql */ 3350 const void **pzTail /* OUT: Pointer to unused portion of zSql */
3229 ); 3351 );
3230 3352
3231 /* 3353 /*
3232 ** CAPI3REF: Retrieving Statement SQL 3354 ** CAPI3REF: Retrieving Statement SQL
3355 ** METHOD: sqlite3_stmt
3233 ** 3356 **
3234 ** ^This interface can be used to retrieve a saved copy of the original 3357 ** ^This interface can be used to retrieve a saved copy of the original
3235 ** SQL text used to create a [prepared statement] if that statement was 3358 ** SQL text used to create a [prepared statement] if that statement was
3236 ** compiled using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()]. 3359 ** compiled using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()].
3237 */ 3360 */
3238 SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt); 3361 SQLITE_API const char *SQLITE_STDCALL sqlite3_sql(sqlite3_stmt *pStmt);
3239 3362
3240 /* 3363 /*
3241 ** CAPI3REF: Determine If An SQL Statement Writes The Database 3364 ** CAPI3REF: Determine If An SQL Statement Writes The Database
3365 ** METHOD: sqlite3_stmt
3242 ** 3366 **
3243 ** ^The sqlite3_stmt_readonly(X) interface returns true (non-zero) if 3367 ** ^The sqlite3_stmt_readonly(X) interface returns true (non-zero) if
3244 ** and only if the [prepared statement] X makes no direct changes to 3368 ** and only if the [prepared statement] X makes no direct changes to
3245 ** the content of the database file. 3369 ** the content of the database file.
3246 ** 3370 **
3247 ** Note that [application-defined SQL functions] or 3371 ** Note that [application-defined SQL functions] or
3248 ** [virtual tables] might change the database indirectly as a side effect. 3372 ** [virtual tables] might change the database indirectly as a side effect.
3249 ** ^(For example, if an application defines a function "eval()" that 3373 ** ^(For example, if an application defines a function "eval()" that
3250 ** calls [sqlite3_exec()], then the following SQL statement would 3374 ** calls [sqlite3_exec()], then the following SQL statement would
3251 ** change the database file through side-effects: 3375 ** change the database file through side-effects:
3252 ** 3376 **
3253 ** <blockquote><pre> 3377 ** <blockquote><pre>
3254 ** SELECT eval('DELETE FROM t1') FROM t2; 3378 ** SELECT eval('DELETE FROM t1') FROM t2;
3255 ** </pre></blockquote> 3379 ** </pre></blockquote>
3256 ** 3380 **
3257 ** But because the [SELECT] statement does not change the database file 3381 ** But because the [SELECT] statement does not change the database file
3258 ** directly, sqlite3_stmt_readonly() would still return true.)^ 3382 ** directly, sqlite3_stmt_readonly() would still return true.)^
3259 ** 3383 **
3260 ** ^Transaction control statements such as [BEGIN], [COMMIT], [ROLLBACK], 3384 ** ^Transaction control statements such as [BEGIN], [COMMIT], [ROLLBACK],
3261 ** [SAVEPOINT], and [RELEASE] cause sqlite3_stmt_readonly() to return true, 3385 ** [SAVEPOINT], and [RELEASE] cause sqlite3_stmt_readonly() to return true,
3262 ** since the statements themselves do not actually modify the database but 3386 ** since the statements themselves do not actually modify the database but
3263 ** rather they control the timing of when other statements modify the 3387 ** rather they control the timing of when other statements modify the
3264 ** database. ^The [ATTACH] and [DETACH] statements also cause 3388 ** database. ^The [ATTACH] and [DETACH] statements also cause
3265 ** sqlite3_stmt_readonly() to return true since, while those statements 3389 ** sqlite3_stmt_readonly() to return true since, while those statements
3266 ** change the configuration of a database connection, they do not make 3390 ** change the configuration of a database connection, they do not make
3267 ** changes to the content of the database files on disk. 3391 ** changes to the content of the database files on disk.
3268 */ 3392 */
3269 SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt); 3393 SQLITE_API int SQLITE_STDCALL sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
3270 3394
3271 /* 3395 /*
3272 ** CAPI3REF: Determine If A Prepared Statement Has Been Reset 3396 ** CAPI3REF: Determine If A Prepared Statement Has Been Reset
3397 ** METHOD: sqlite3_stmt
3273 ** 3398 **
3274 ** ^The sqlite3_stmt_busy(S) interface returns true (non-zero) if the 3399 ** ^The sqlite3_stmt_busy(S) interface returns true (non-zero) if the
3275 ** [prepared statement] S has been stepped at least once using 3400 ** [prepared statement] S has been stepped at least once using
3276 ** [sqlite3_step(S)] but has not run to completion and/or has not 3401 ** [sqlite3_step(S)] but has neither run to completion (returned
3402 ** [SQLITE_DONE] from [sqlite3_step(S)]) nor
3277 ** been reset using [sqlite3_reset(S)]. ^The sqlite3_stmt_busy(S) 3403 ** been reset using [sqlite3_reset(S)]. ^The sqlite3_stmt_busy(S)
3278 ** interface returns false if S is a NULL pointer. If S is not a 3404 ** interface returns false if S is a NULL pointer. If S is not a
3279 ** NULL pointer and is not a pointer to a valid [prepared statement] 3405 ** NULL pointer and is not a pointer to a valid [prepared statement]
3280 ** object, then the behavior is undefined and probably undesirable. 3406 ** object, then the behavior is undefined and probably undesirable.
3281 ** 3407 **
3282 ** This interface can be used in combination [sqlite3_next_stmt()] 3408 ** This interface can be used in combination [sqlite3_next_stmt()]
3283 ** to locate all prepared statements associated with a database 3409 ** to locate all prepared statements associated with a database
3284 ** connection that are in need of being reset. This can be used, 3410 ** connection that are in need of being reset. This can be used,
3285 ** for example, in diagnostic routines to search for prepared 3411 ** for example, in diagnostic routines to search for prepared
3286 ** statements that are holding a transaction open. 3412 ** statements that are holding a transaction open.
3287 */ 3413 */
3288 SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*); 3414 SQLITE_API int SQLITE_STDCALL sqlite3_stmt_busy(sqlite3_stmt*);
3289 3415
3290 /* 3416 /*
3291 ** CAPI3REF: Dynamically Typed Value Object 3417 ** CAPI3REF: Dynamically Typed Value Object
3292 ** KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value} 3418 ** KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value}
3293 ** 3419 **
3294 ** SQLite uses the sqlite3_value object to represent all values 3420 ** SQLite uses the sqlite3_value object to represent all values
3295 ** that can be stored in a database table. SQLite uses dynamic typing 3421 ** that can be stored in a database table. SQLite uses dynamic typing
3296 ** for the values it stores. ^Values stored in sqlite3_value objects 3422 ** for the values it stores. ^Values stored in sqlite3_value objects
3297 ** can be integers, floating point values, strings, BLOBs, or NULL. 3423 ** can be integers, floating point values, strings, BLOBs, or NULL.
3298 ** 3424 **
3299 ** An sqlite3_value object may be either "protected" or "unprotected". 3425 ** An sqlite3_value object may be either "protected" or "unprotected".
3300 ** Some interfaces require a protected sqlite3_value. Other interfaces 3426 ** Some interfaces require a protected sqlite3_value. Other interfaces
3301 ** will accept either a protected or an unprotected sqlite3_value. 3427 ** will accept either a protected or an unprotected sqlite3_value.
3302 ** Every interface that accepts sqlite3_value arguments specifies 3428 ** Every interface that accepts sqlite3_value arguments specifies
3303 ** whether or not it requires a protected sqlite3_value. 3429 ** whether or not it requires a protected sqlite3_value. The
3430 ** [sqlite3_value_dup()] interface can be used to construct a new
3431 ** protected sqlite3_value from an unprotected sqlite3_value.
3304 ** 3432 **
3305 ** The terms "protected" and "unprotected" refer to whether or not 3433 ** The terms "protected" and "unprotected" refer to whether or not
3306 ** a mutex is held. An internal mutex is held for a protected 3434 ** a mutex is held. An internal mutex is held for a protected
3307 ** sqlite3_value object but no mutex is held for an unprotected 3435 ** sqlite3_value object but no mutex is held for an unprotected
3308 ** sqlite3_value object. If SQLite is compiled to be single-threaded 3436 ** sqlite3_value object. If SQLite is compiled to be single-threaded
3309 ** (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0) 3437 ** (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0)
3310 ** or if SQLite is run in one of reduced mutex modes 3438 ** or if SQLite is run in one of reduced mutex modes
3311 ** [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD] 3439 ** [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD]
3312 ** then there is no distinction between protected and unprotected 3440 ** then there is no distinction between protected and unprotected
3313 ** sqlite3_value objects and they can be used interchangeably. However, 3441 ** sqlite3_value objects and they can be used interchangeably. However,
(...skipping 23 matching lines...) Expand all
3337 ** [sqlite3_aggregate_context()], [sqlite3_user_data()], 3465 ** [sqlite3_aggregate_context()], [sqlite3_user_data()],
3338 ** [sqlite3_context_db_handle()], [sqlite3_get_auxdata()], 3466 ** [sqlite3_context_db_handle()], [sqlite3_get_auxdata()],
3339 ** and/or [sqlite3_set_auxdata()]. 3467 ** and/or [sqlite3_set_auxdata()].
3340 */ 3468 */
3341 typedef struct sqlite3_context sqlite3_context; 3469 typedef struct sqlite3_context sqlite3_context;
3342 3470
3343 /* 3471 /*
3344 ** CAPI3REF: Binding Values To Prepared Statements 3472 ** CAPI3REF: Binding Values To Prepared Statements
3345 ** KEYWORDS: {host parameter} {host parameters} {host parameter name} 3473 ** KEYWORDS: {host parameter} {host parameters} {host parameter name}
3346 ** KEYWORDS: {SQL parameter} {SQL parameters} {parameter binding} 3474 ** KEYWORDS: {SQL parameter} {SQL parameters} {parameter binding}
3475 ** METHOD: sqlite3_stmt
3347 ** 3476 **
3348 ** ^(In the SQL statement text input to [sqlite3_prepare_v2()] and its variants, 3477 ** ^(In the SQL statement text input to [sqlite3_prepare_v2()] and its variants,
3349 ** literals may be replaced by a [parameter] that matches one of following 3478 ** literals may be replaced by a [parameter] that matches one of following
3350 ** templates: 3479 ** templates:
3351 ** 3480 **
3352 ** <ul> 3481 ** <ul>
3353 ** <li> ? 3482 ** <li> ?
3354 ** <li> ?NNN 3483 ** <li> ?NNN
3355 ** <li> :VVV 3484 ** <li> :VVV
3356 ** <li> @VVV 3485 ** <li> @VVV
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
3439 ** [error code] if anything goes wrong. 3568 ** [error code] if anything goes wrong.
3440 ** ^[SQLITE_TOOBIG] might be returned if the size of a string or BLOB 3569 ** ^[SQLITE_TOOBIG] might be returned if the size of a string or BLOB
3441 ** exceeds limits imposed by [sqlite3_limit]([SQLITE_LIMIT_LENGTH]) or 3570 ** exceeds limits imposed by [sqlite3_limit]([SQLITE_LIMIT_LENGTH]) or
3442 ** [SQLITE_MAX_LENGTH]. 3571 ** [SQLITE_MAX_LENGTH].
3443 ** ^[SQLITE_RANGE] is returned if the parameter 3572 ** ^[SQLITE_RANGE] is returned if the parameter
3444 ** index is out of range. ^[SQLITE_NOMEM] is returned if malloc() fails. 3573 ** index is out of range. ^[SQLITE_NOMEM] is returned if malloc() fails.
3445 ** 3574 **
3446 ** See also: [sqlite3_bind_parameter_count()], 3575 ** See also: [sqlite3_bind_parameter_count()],
3447 ** [sqlite3_bind_parameter_name()], and [sqlite3_bind_parameter_index()]. 3576 ** [sqlite3_bind_parameter_name()], and [sqlite3_bind_parameter_index()].
3448 */ 3577 */
3449 SQLITE_API int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*) (void*)); 3578 SQLITE_API int SQLITE_STDCALL sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));
3450 SQLITE_API int sqlite3_bind_blob64(sqlite3_stmt*, int, const void*, sqlite3_uint 64, 3579 SQLITE_API int SQLITE_STDCALL sqlite3_bind_blob64(sqlite3_stmt*, int, const void *, sqlite3_uint64,
3451 void(*)(void*)); 3580 void(*)(void*));
3452 SQLITE_API int sqlite3_bind_double(sqlite3_stmt*, int, double); 3581 SQLITE_API int SQLITE_STDCALL sqlite3_bind_double(sqlite3_stmt*, int, double);
3453 SQLITE_API int sqlite3_bind_int(sqlite3_stmt*, int, int); 3582 SQLITE_API int SQLITE_STDCALL sqlite3_bind_int(sqlite3_stmt*, int, int);
3454 SQLITE_API int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64); 3583 SQLITE_API int SQLITE_STDCALL sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int 64);
3455 SQLITE_API int sqlite3_bind_null(sqlite3_stmt*, int); 3584 SQLITE_API int SQLITE_STDCALL sqlite3_bind_null(sqlite3_stmt*, int);
3456 SQLITE_API int sqlite3_bind_text(sqlite3_stmt*,int,const char*,int,void(*)(void* )); 3585 SQLITE_API int SQLITE_STDCALL sqlite3_bind_text(sqlite3_stmt*,int,const char*,in t,void(*)(void*));
3457 SQLITE_API int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*) (void*)); 3586 SQLITE_API int SQLITE_STDCALL sqlite3_bind_text16(sqlite3_stmt*, int, const void *, int, void(*)(void*));
3458 SQLITE_API int sqlite3_bind_text64(sqlite3_stmt*, int, const char*, sqlite3_uint 64, 3587 SQLITE_API int SQLITE_STDCALL sqlite3_bind_text64(sqlite3_stmt*, int, const char *, sqlite3_uint64,
3459 void(*)(void*), unsigned char encoding); 3588 void(*)(void*), unsigned char encoding);
3460 SQLITE_API int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*); 3589 SQLITE_API int SQLITE_STDCALL sqlite3_bind_value(sqlite3_stmt*, int, const sqlit e3_value*);
3461 SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n); 3590 SQLITE_API int SQLITE_STDCALL sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
3591 SQLITE_API int SQLITE_STDCALL sqlite3_bind_zeroblob64(sqlite3_stmt*, int, sqlite 3_uint64);
3462 3592
3463 /* 3593 /*
3464 ** CAPI3REF: Number Of SQL Parameters 3594 ** CAPI3REF: Number Of SQL Parameters
3595 ** METHOD: sqlite3_stmt
3465 ** 3596 **
3466 ** ^This routine can be used to find the number of [SQL parameters] 3597 ** ^This routine can be used to find the number of [SQL parameters]
3467 ** in a [prepared statement]. SQL parameters are tokens of the 3598 ** in a [prepared statement]. SQL parameters are tokens of the
3468 ** form "?", "?NNN", ":AAA", "$AAA", or "@AAA" that serve as 3599 ** form "?", "?NNN", ":AAA", "$AAA", or "@AAA" that serve as
3469 ** placeholders for values that are [sqlite3_bind_blob | bound] 3600 ** placeholders for values that are [sqlite3_bind_blob | bound]
3470 ** to the parameters at a later time. 3601 ** to the parameters at a later time.
3471 ** 3602 **
3472 ** ^(This routine actually returns the index of the largest (rightmost) 3603 ** ^(This routine actually returns the index of the largest (rightmost)
3473 ** parameter. For all forms except ?NNN, this will correspond to the 3604 ** parameter. For all forms except ?NNN, this will correspond to the
3474 ** number of unique parameters. If parameters of the ?NNN form are used, 3605 ** number of unique parameters. If parameters of the ?NNN form are used,
3475 ** there may be gaps in the list.)^ 3606 ** there may be gaps in the list.)^
3476 ** 3607 **
3477 ** See also: [sqlite3_bind_blob|sqlite3_bind()], 3608 ** See also: [sqlite3_bind_blob|sqlite3_bind()],
3478 ** [sqlite3_bind_parameter_name()], and 3609 ** [sqlite3_bind_parameter_name()], and
3479 ** [sqlite3_bind_parameter_index()]. 3610 ** [sqlite3_bind_parameter_index()].
3480 */ 3611 */
3481 SQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt*); 3612 SQLITE_API int SQLITE_STDCALL sqlite3_bind_parameter_count(sqlite3_stmt*);
3482 3613
3483 /* 3614 /*
3484 ** CAPI3REF: Name Of A Host Parameter 3615 ** CAPI3REF: Name Of A Host Parameter
3616 ** METHOD: sqlite3_stmt
3485 ** 3617 **
3486 ** ^The sqlite3_bind_parameter_name(P,N) interface returns 3618 ** ^The sqlite3_bind_parameter_name(P,N) interface returns
3487 ** the name of the N-th [SQL parameter] in the [prepared statement] P. 3619 ** the name of the N-th [SQL parameter] in the [prepared statement] P.
3488 ** ^(SQL parameters of the form "?NNN" or ":AAA" or "@AAA" or "$AAA" 3620 ** ^(SQL parameters of the form "?NNN" or ":AAA" or "@AAA" or "$AAA"
3489 ** have a name which is the string "?NNN" or ":AAA" or "@AAA" or "$AAA" 3621 ** have a name which is the string "?NNN" or ":AAA" or "@AAA" or "$AAA"
3490 ** respectively. 3622 ** respectively.
3491 ** In other words, the initial ":" or "$" or "@" or "?" 3623 ** In other words, the initial ":" or "$" or "@" or "?"
3492 ** is included as part of the name.)^ 3624 ** is included as part of the name.)^
3493 ** ^Parameters of the form "?" without a following integer have no name 3625 ** ^Parameters of the form "?" without a following integer have no name
3494 ** and are referred to as "nameless" or "anonymous parameters". 3626 ** and are referred to as "nameless" or "anonymous parameters".
3495 ** 3627 **
3496 ** ^The first host parameter has an index of 1, not 0. 3628 ** ^The first host parameter has an index of 1, not 0.
3497 ** 3629 **
3498 ** ^If the value N is out of range or if the N-th parameter is 3630 ** ^If the value N is out of range or if the N-th parameter is
3499 ** nameless, then NULL is returned. ^The returned string is 3631 ** nameless, then NULL is returned. ^The returned string is
3500 ** always in UTF-8 encoding even if the named parameter was 3632 ** always in UTF-8 encoding even if the named parameter was
3501 ** originally specified as UTF-16 in [sqlite3_prepare16()] or 3633 ** originally specified as UTF-16 in [sqlite3_prepare16()] or
3502 ** [sqlite3_prepare16_v2()]. 3634 ** [sqlite3_prepare16_v2()].
3503 ** 3635 **
3504 ** See also: [sqlite3_bind_blob|sqlite3_bind()], 3636 ** See also: [sqlite3_bind_blob|sqlite3_bind()],
3505 ** [sqlite3_bind_parameter_count()], and 3637 ** [sqlite3_bind_parameter_count()], and
3506 ** [sqlite3_bind_parameter_index()]. 3638 ** [sqlite3_bind_parameter_index()].
3507 */ 3639 */
3508 SQLITE_API const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int); 3640 SQLITE_API const char *SQLITE_STDCALL sqlite3_bind_parameter_name(sqlite3_stmt*, int);
3509 3641
3510 /* 3642 /*
3511 ** CAPI3REF: Index Of A Parameter With A Given Name 3643 ** CAPI3REF: Index Of A Parameter With A Given Name
3644 ** METHOD: sqlite3_stmt
3512 ** 3645 **
3513 ** ^Return the index of an SQL parameter given its name. ^The 3646 ** ^Return the index of an SQL parameter given its name. ^The
3514 ** index value returned is suitable for use as the second 3647 ** index value returned is suitable for use as the second
3515 ** parameter to [sqlite3_bind_blob|sqlite3_bind()]. ^A zero 3648 ** parameter to [sqlite3_bind_blob|sqlite3_bind()]. ^A zero
3516 ** is returned if no matching parameter is found. ^The parameter 3649 ** is returned if no matching parameter is found. ^The parameter
3517 ** name must be given in UTF-8 even if the original statement 3650 ** name must be given in UTF-8 even if the original statement
3518 ** was prepared from UTF-16 text using [sqlite3_prepare16_v2()]. 3651 ** was prepared from UTF-16 text using [sqlite3_prepare16_v2()].
3519 ** 3652 **
3520 ** See also: [sqlite3_bind_blob|sqlite3_bind()], 3653 ** See also: [sqlite3_bind_blob|sqlite3_bind()],
3521 ** [sqlite3_bind_parameter_count()], and 3654 ** [sqlite3_bind_parameter_count()], and
3522 ** [sqlite3_bind_parameter_index()]. 3655 ** [sqlite3_bind_parameter_name()].
3523 */ 3656 */
3524 SQLITE_API int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName); 3657 SQLITE_API int SQLITE_STDCALL sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName);
3525 3658
3526 /* 3659 /*
3527 ** CAPI3REF: Reset All Bindings On A Prepared Statement 3660 ** CAPI3REF: Reset All Bindings On A Prepared Statement
3661 ** METHOD: sqlite3_stmt
3528 ** 3662 **
3529 ** ^Contrary to the intuition of many, [sqlite3_reset()] does not reset 3663 ** ^Contrary to the intuition of many, [sqlite3_reset()] does not reset
3530 ** the [sqlite3_bind_blob | bindings] on a [prepared statement]. 3664 ** the [sqlite3_bind_blob | bindings] on a [prepared statement].
3531 ** ^Use this routine to reset all host parameters to NULL. 3665 ** ^Use this routine to reset all host parameters to NULL.
3532 */ 3666 */
3533 SQLITE_API int sqlite3_clear_bindings(sqlite3_stmt*); 3667 SQLITE_API int SQLITE_STDCALL sqlite3_clear_bindings(sqlite3_stmt*);
3534 3668
3535 /* 3669 /*
3536 ** CAPI3REF: Number Of Columns In A Result Set 3670 ** CAPI3REF: Number Of Columns In A Result Set
3671 ** METHOD: sqlite3_stmt
3537 ** 3672 **
3538 ** ^Return the number of columns in the result set returned by the 3673 ** ^Return the number of columns in the result set returned by the
3539 ** [prepared statement]. ^This routine returns 0 if pStmt is an SQL 3674 ** [prepared statement]. ^This routine returns 0 if pStmt is an SQL
3540 ** statement that does not return data (for example an [UPDATE]). 3675 ** statement that does not return data (for example an [UPDATE]).
3541 ** 3676 **
3542 ** See also: [sqlite3_data_count()] 3677 ** See also: [sqlite3_data_count()]
3543 */ 3678 */
3544 SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt); 3679 SQLITE_API int SQLITE_STDCALL sqlite3_column_count(sqlite3_stmt *pStmt);
3545 3680
3546 /* 3681 /*
3547 ** CAPI3REF: Column Names In A Result Set 3682 ** CAPI3REF: Column Names In A Result Set
3683 ** METHOD: sqlite3_stmt
3548 ** 3684 **
3549 ** ^These routines return the name assigned to a particular column 3685 ** ^These routines return the name assigned to a particular column
3550 ** in the result set of a [SELECT] statement. ^The sqlite3_column_name() 3686 ** in the result set of a [SELECT] statement. ^The sqlite3_column_name()
3551 ** interface returns a pointer to a zero-terminated UTF-8 string 3687 ** interface returns a pointer to a zero-terminated UTF-8 string
3552 ** and sqlite3_column_name16() returns a pointer to a zero-terminated 3688 ** and sqlite3_column_name16() returns a pointer to a zero-terminated
3553 ** UTF-16 string. ^The first parameter is the [prepared statement] 3689 ** UTF-16 string. ^The first parameter is the [prepared statement]
3554 ** that implements the [SELECT] statement. ^The second parameter is the 3690 ** that implements the [SELECT] statement. ^The second parameter is the
3555 ** column number. ^The leftmost column is number 0. 3691 ** column number. ^The leftmost column is number 0.
3556 ** 3692 **
3557 ** ^The returned string pointer is valid until either the [prepared statement] 3693 ** ^The returned string pointer is valid until either the [prepared statement]
3558 ** is destroyed by [sqlite3_finalize()] or until the statement is automatically 3694 ** is destroyed by [sqlite3_finalize()] or until the statement is automatically
3559 ** reprepared by the first call to [sqlite3_step()] for a particular run 3695 ** reprepared by the first call to [sqlite3_step()] for a particular run
3560 ** or until the next call to 3696 ** or until the next call to
3561 ** sqlite3_column_name() or sqlite3_column_name16() on the same column. 3697 ** sqlite3_column_name() or sqlite3_column_name16() on the same column.
3562 ** 3698 **
3563 ** ^If sqlite3_malloc() fails during the processing of either routine 3699 ** ^If sqlite3_malloc() fails during the processing of either routine
3564 ** (for example during a conversion from UTF-8 to UTF-16) then a 3700 ** (for example during a conversion from UTF-8 to UTF-16) then a
3565 ** NULL pointer is returned. 3701 ** NULL pointer is returned.
3566 ** 3702 **
3567 ** ^The name of a result column is the value of the "AS" clause for 3703 ** ^The name of a result column is the value of the "AS" clause for
3568 ** that column, if there is an AS clause. If there is no AS clause 3704 ** that column, if there is an AS clause. If there is no AS clause
3569 ** then the name of the column is unspecified and may change from 3705 ** then the name of the column is unspecified and may change from
3570 ** one release of SQLite to the next. 3706 ** one release of SQLite to the next.
3571 */ 3707 */
3572 SQLITE_API const char *sqlite3_column_name(sqlite3_stmt*, int N); 3708 SQLITE_API const char *SQLITE_STDCALL sqlite3_column_name(sqlite3_stmt*, int N);
3573 SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt*, int N); 3709 SQLITE_API const void *SQLITE_STDCALL sqlite3_column_name16(sqlite3_stmt*, int N );
3574 3710
3575 /* 3711 /*
3576 ** CAPI3REF: Source Of Data In A Query Result 3712 ** CAPI3REF: Source Of Data In A Query Result
3713 ** METHOD: sqlite3_stmt
3577 ** 3714 **
3578 ** ^These routines provide a means to determine the database, table, and 3715 ** ^These routines provide a means to determine the database, table, and
3579 ** table column that is the origin of a particular result column in 3716 ** table column that is the origin of a particular result column in
3580 ** [SELECT] statement. 3717 ** [SELECT] statement.
3581 ** ^The name of the database or table or column can be returned as 3718 ** ^The name of the database or table or column can be returned as
3582 ** either a UTF-8 or UTF-16 string. ^The _database_ routines return 3719 ** either a UTF-8 or UTF-16 string. ^The _database_ routines return
3583 ** the database name, the _table_ routines return the table name, and 3720 ** the database name, the _table_ routines return the table name, and
3584 ** the origin_ routines return the column name. 3721 ** the origin_ routines return the column name.
3585 ** ^The returned string is valid until the [prepared statement] is destroyed 3722 ** ^The returned string is valid until the [prepared statement] is destroyed
3586 ** using [sqlite3_finalize()] or until the statement is automatically 3723 ** using [sqlite3_finalize()] or until the statement is automatically
(...skipping 23 matching lines...) Expand all
3610 ** 3747 **
3611 ** If two or more threads call one or more of these routines against the same 3748 ** If two or more threads call one or more of these routines against the same
3612 ** prepared statement and column at the same time then the results are 3749 ** prepared statement and column at the same time then the results are
3613 ** undefined. 3750 ** undefined.
3614 ** 3751 **
3615 ** If two or more threads call one or more 3752 ** If two or more threads call one or more
3616 ** [sqlite3_column_database_name | column metadata interfaces] 3753 ** [sqlite3_column_database_name | column metadata interfaces]
3617 ** for the same [prepared statement] and result column 3754 ** for the same [prepared statement] and result column
3618 ** at the same time then the results are undefined. 3755 ** at the same time then the results are undefined.
3619 */ 3756 */
3620 SQLITE_API const char *sqlite3_column_database_name(sqlite3_stmt*,int); 3757 SQLITE_API const char *SQLITE_STDCALL sqlite3_column_database_name(sqlite3_stmt* ,int);
3621 SQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt*,int); 3758 SQLITE_API const void *SQLITE_STDCALL sqlite3_column_database_name16(sqlite3_stm t*,int);
3622 SQLITE_API const char *sqlite3_column_table_name(sqlite3_stmt*,int); 3759 SQLITE_API const char *SQLITE_STDCALL sqlite3_column_table_name(sqlite3_stmt*,in t);
3623 SQLITE_API const void *sqlite3_column_table_name16(sqlite3_stmt*,int); 3760 SQLITE_API const void *SQLITE_STDCALL sqlite3_column_table_name16(sqlite3_stmt*, int);
3624 SQLITE_API const char *sqlite3_column_origin_name(sqlite3_stmt*,int); 3761 SQLITE_API const char *SQLITE_STDCALL sqlite3_column_origin_name(sqlite3_stmt*,i nt);
3625 SQLITE_API const void *sqlite3_column_origin_name16(sqlite3_stmt*,int); 3762 SQLITE_API const void *SQLITE_STDCALL sqlite3_column_origin_name16(sqlite3_stmt* ,int);
3626 3763
3627 /* 3764 /*
3628 ** CAPI3REF: Declared Datatype Of A Query Result 3765 ** CAPI3REF: Declared Datatype Of A Query Result
3766 ** METHOD: sqlite3_stmt
3629 ** 3767 **
3630 ** ^(The first parameter is a [prepared statement]. 3768 ** ^(The first parameter is a [prepared statement].
3631 ** If this statement is a [SELECT] statement and the Nth column of the 3769 ** If this statement is a [SELECT] statement and the Nth column of the
3632 ** returned result set of that [SELECT] is a table column (not an 3770 ** returned result set of that [SELECT] is a table column (not an
3633 ** expression or subquery) then the declared type of the table 3771 ** expression or subquery) then the declared type of the table
3634 ** column is returned.)^ ^If the Nth column of the result set is an 3772 ** column is returned.)^ ^If the Nth column of the result set is an
3635 ** expression or subquery, then a NULL pointer is returned. 3773 ** expression or subquery, then a NULL pointer is returned.
3636 ** ^The returned string is always UTF-8 encoded. 3774 ** ^The returned string is always UTF-8 encoded.
3637 ** 3775 **
3638 ** ^(For example, given the database schema: 3776 ** ^(For example, given the database schema:
3639 ** 3777 **
3640 ** CREATE TABLE t1(c1 VARIANT); 3778 ** CREATE TABLE t1(c1 VARIANT);
3641 ** 3779 **
3642 ** and the following statement to be compiled: 3780 ** and the following statement to be compiled:
3643 ** 3781 **
3644 ** SELECT c1 + 1, c1 FROM t1; 3782 ** SELECT c1 + 1, c1 FROM t1;
3645 ** 3783 **
3646 ** this routine would return the string "VARIANT" for the second result 3784 ** this routine would return the string "VARIANT" for the second result
3647 ** column (i==1), and a NULL pointer for the first result column (i==0).)^ 3785 ** column (i==1), and a NULL pointer for the first result column (i==0).)^
3648 ** 3786 **
3649 ** ^SQLite uses dynamic run-time typing. ^So just because a column 3787 ** ^SQLite uses dynamic run-time typing. ^So just because a column
3650 ** is declared to contain a particular type does not mean that the 3788 ** is declared to contain a particular type does not mean that the
3651 ** data stored in that column is of the declared type. SQLite is 3789 ** data stored in that column is of the declared type. SQLite is
3652 ** strongly typed, but the typing is dynamic not static. ^Type 3790 ** strongly typed, but the typing is dynamic not static. ^Type
3653 ** is associated with individual values, not with the containers 3791 ** is associated with individual values, not with the containers
3654 ** used to hold those values. 3792 ** used to hold those values.
3655 */ 3793 */
3656 SQLITE_API const char *sqlite3_column_decltype(sqlite3_stmt*,int); 3794 SQLITE_API const char *SQLITE_STDCALL sqlite3_column_decltype(sqlite3_stmt*,int) ;
3657 SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int); 3795 SQLITE_API const void *SQLITE_STDCALL sqlite3_column_decltype16(sqlite3_stmt*,in t);
3658 3796
3659 /* 3797 /*
3660 ** CAPI3REF: Evaluate An SQL Statement 3798 ** CAPI3REF: Evaluate An SQL Statement
3799 ** METHOD: sqlite3_stmt
3661 ** 3800 **
3662 ** After a [prepared statement] has been prepared using either 3801 ** After a [prepared statement] has been prepared using either
3663 ** [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] or one of the legacy 3802 ** [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] or one of the legacy
3664 ** interfaces [sqlite3_prepare()] or [sqlite3_prepare16()], this function 3803 ** interfaces [sqlite3_prepare()] or [sqlite3_prepare16()], this function
3665 ** must be called one or more times to evaluate the statement. 3804 ** must be called one or more times to evaluate the statement.
3666 ** 3805 **
3667 ** The details of the behavior of the sqlite3_step() interface depend 3806 ** The details of the behavior of the sqlite3_step() interface depend
3668 ** on whether the statement was prepared using the newer "v2" interface 3807 ** on whether the statement was prepared using the newer "v2" interface
3669 ** [sqlite3_prepare_v2()] and [sqlite3_prepare16_v2()] or the older legacy 3808 ** [sqlite3_prepare_v2()] and [sqlite3_prepare16_v2()] or the older legacy
3670 ** interface [sqlite3_prepare()] and [sqlite3_prepare16()]. The use of the 3809 ** interface [sqlite3_prepare()] and [sqlite3_prepare16()]. The use of the
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
3726 ** error other than [SQLITE_BUSY] and [SQLITE_MISUSE]. You must call 3865 ** error other than [SQLITE_BUSY] and [SQLITE_MISUSE]. You must call
3727 ** [sqlite3_reset()] or [sqlite3_finalize()] in order to find one of the 3866 ** [sqlite3_reset()] or [sqlite3_finalize()] in order to find one of the
3728 ** specific [error codes] that better describes the error. 3867 ** specific [error codes] that better describes the error.
3729 ** We admit that this is a goofy design. The problem has been fixed 3868 ** We admit that this is a goofy design. The problem has been fixed
3730 ** with the "v2" interface. If you prepare all of your SQL statements 3869 ** with the "v2" interface. If you prepare all of your SQL statements
3731 ** using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] instead 3870 ** using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] instead
3732 ** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces, 3871 ** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces,
3733 ** then the more specific [error codes] are returned directly 3872 ** then the more specific [error codes] are returned directly
3734 ** by sqlite3_step(). The use of the "v2" interface is recommended. 3873 ** by sqlite3_step(). The use of the "v2" interface is recommended.
3735 */ 3874 */
3736 SQLITE_API int sqlite3_step(sqlite3_stmt*); 3875 SQLITE_API int SQLITE_STDCALL sqlite3_step(sqlite3_stmt*);
3737 3876
3738 /* 3877 /*
3739 ** CAPI3REF: Number of columns in a result set 3878 ** CAPI3REF: Number of columns in a result set
3879 ** METHOD: sqlite3_stmt
3740 ** 3880 **
3741 ** ^The sqlite3_data_count(P) interface returns the number of columns in the 3881 ** ^The sqlite3_data_count(P) interface returns the number of columns in the
3742 ** current row of the result set of [prepared statement] P. 3882 ** current row of the result set of [prepared statement] P.
3743 ** ^If prepared statement P does not have results ready to return 3883 ** ^If prepared statement P does not have results ready to return
3744 ** (via calls to the [sqlite3_column_int | sqlite3_column_*()] of 3884 ** (via calls to the [sqlite3_column_int | sqlite3_column_*()] of
3745 ** interfaces) then sqlite3_data_count(P) returns 0. 3885 ** interfaces) then sqlite3_data_count(P) returns 0.
3746 ** ^The sqlite3_data_count(P) routine also returns 0 if P is a NULL pointer. 3886 ** ^The sqlite3_data_count(P) routine also returns 0 if P is a NULL pointer.
3747 ** ^The sqlite3_data_count(P) routine returns 0 if the previous call to 3887 ** ^The sqlite3_data_count(P) routine returns 0 if the previous call to
3748 ** [sqlite3_step](P) returned [SQLITE_DONE]. ^The sqlite3_data_count(P) 3888 ** [sqlite3_step](P) returned [SQLITE_DONE]. ^The sqlite3_data_count(P)
3749 ** will return non-zero if previous call to [sqlite3_step](P) returned 3889 ** will return non-zero if previous call to [sqlite3_step](P) returned
3750 ** [SQLITE_ROW], except in the case of the [PRAGMA incremental_vacuum] 3890 ** [SQLITE_ROW], except in the case of the [PRAGMA incremental_vacuum]
3751 ** where it always returns zero since each step of that multi-step 3891 ** where it always returns zero since each step of that multi-step
3752 ** pragma returns 0 columns of data. 3892 ** pragma returns 0 columns of data.
3753 ** 3893 **
3754 ** See also: [sqlite3_column_count()] 3894 ** See also: [sqlite3_column_count()]
3755 */ 3895 */
3756 SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt); 3896 SQLITE_API int SQLITE_STDCALL sqlite3_data_count(sqlite3_stmt *pStmt);
3757 3897
3758 /* 3898 /*
3759 ** CAPI3REF: Fundamental Datatypes 3899 ** CAPI3REF: Fundamental Datatypes
3760 ** KEYWORDS: SQLITE_TEXT 3900 ** KEYWORDS: SQLITE_TEXT
3761 ** 3901 **
3762 ** ^(Every value in SQLite has one of five fundamental datatypes: 3902 ** ^(Every value in SQLite has one of five fundamental datatypes:
3763 ** 3903 **
3764 ** <ul> 3904 ** <ul>
3765 ** <li> 64-bit signed integer 3905 ** <li> 64-bit signed integer
3766 ** <li> 64-bit IEEE floating point number 3906 ** <li> 64-bit IEEE floating point number
(...skipping 16 matching lines...) Expand all
3783 #ifdef SQLITE_TEXT 3923 #ifdef SQLITE_TEXT
3784 # undef SQLITE_TEXT 3924 # undef SQLITE_TEXT
3785 #else 3925 #else
3786 # define SQLITE_TEXT 3 3926 # define SQLITE_TEXT 3
3787 #endif 3927 #endif
3788 #define SQLITE3_TEXT 3 3928 #define SQLITE3_TEXT 3
3789 3929
3790 /* 3930 /*
3791 ** CAPI3REF: Result Values From A Query 3931 ** CAPI3REF: Result Values From A Query
3792 ** KEYWORDS: {column access functions} 3932 ** KEYWORDS: {column access functions}
3793 ** 3933 ** METHOD: sqlite3_stmt
3794 ** These routines form the "result set" interface.
3795 ** 3934 **
3796 ** ^These routines return information about a single column of the current 3935 ** ^These routines return information about a single column of the current
3797 ** result row of a query. ^In every case the first argument is a pointer 3936 ** result row of a query. ^In every case the first argument is a pointer
3798 ** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*] 3937 ** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*]
3799 ** that was returned from [sqlite3_prepare_v2()] or one of its variants) 3938 ** that was returned from [sqlite3_prepare_v2()] or one of its variants)
3800 ** and the second argument is the index of the column for which information 3939 ** and the second argument is the index of the column for which information
3801 ** should be returned. ^The leftmost column of the result set has the index 0. 3940 ** should be returned. ^The leftmost column of the result set has the index 0.
3802 ** ^The number of columns in the result can be determined using 3941 ** ^The number of columns in the result can be determined using
3803 ** [sqlite3_column_count()]. 3942 ** [sqlite3_column_count()].
3804 ** 3943 **
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
3845 ** ^The values returned by [sqlite3_column_bytes()] and 3984 ** ^The values returned by [sqlite3_column_bytes()] and
3846 ** [sqlite3_column_bytes16()] do not include the zero terminators at the end 3985 ** [sqlite3_column_bytes16()] do not include the zero terminators at the end
3847 ** of the string. ^For clarity: the values returned by 3986 ** of the string. ^For clarity: the values returned by
3848 ** [sqlite3_column_bytes()] and [sqlite3_column_bytes16()] are the number of 3987 ** [sqlite3_column_bytes()] and [sqlite3_column_bytes16()] are the number of
3849 ** bytes in the string, not the number of characters. 3988 ** bytes in the string, not the number of characters.
3850 ** 3989 **
3851 ** ^Strings returned by sqlite3_column_text() and sqlite3_column_text16(), 3990 ** ^Strings returned by sqlite3_column_text() and sqlite3_column_text16(),
3852 ** even empty strings, are always zero-terminated. ^The return 3991 ** even empty strings, are always zero-terminated. ^The return
3853 ** value from sqlite3_column_blob() for a zero-length BLOB is a NULL pointer. 3992 ** value from sqlite3_column_blob() for a zero-length BLOB is a NULL pointer.
3854 ** 3993 **
3855 ** ^The object returned by [sqlite3_column_value()] is an 3994 ** <b>Warning:</b> ^The object returned by [sqlite3_column_value()] is an
3856 ** [unprotected sqlite3_value] object. An unprotected sqlite3_value object 3995 ** [unprotected sqlite3_value] object. In a multithreaded environment,
3857 ** may only be used with [sqlite3_bind_value()] and [sqlite3_result_value()]. 3996 ** an unprotected sqlite3_value object may only be used safely with
3997 ** [sqlite3_bind_value()] and [sqlite3_result_value()].
3858 ** If the [unprotected sqlite3_value] object returned by 3998 ** If the [unprotected sqlite3_value] object returned by
3859 ** [sqlite3_column_value()] is used in any other way, including calls 3999 ** [sqlite3_column_value()] is used in any other way, including calls
3860 ** to routines like [sqlite3_value_int()], [sqlite3_value_text()], 4000 ** to routines like [sqlite3_value_int()], [sqlite3_value_text()],
3861 ** or [sqlite3_value_bytes()], then the behavior is undefined. 4001 ** or [sqlite3_value_bytes()], the behavior is not threadsafe.
3862 ** 4002 **
3863 ** These routines attempt to convert the value where appropriate. ^For 4003 ** These routines attempt to convert the value where appropriate. ^For
3864 ** example, if the internal representation is FLOAT and a text result 4004 ** example, if the internal representation is FLOAT and a text result
3865 ** is requested, [sqlite3_snprintf()] is used internally to perform the 4005 ** is requested, [sqlite3_snprintf()] is used internally to perform the
3866 ** conversion automatically. ^(The following table details the conversions 4006 ** conversion automatically. ^(The following table details the conversions
3867 ** that are applied: 4007 ** that are applied:
3868 ** 4008 **
3869 ** <blockquote> 4009 ** <blockquote>
3870 ** <table border="1"> 4010 ** <table border="1">
3871 ** <tr><th> Internal<br>Type <th> Requested<br>Type <th> Conversion 4011 ** <tr><th> Internal<br>Type <th> Requested<br>Type <th> Conversion
(...skipping 10 matching lines...) Expand all
3882 ** <tr><td> FLOAT <td> BLOB <td> [CAST] to BLOB 4022 ** <tr><td> FLOAT <td> BLOB <td> [CAST] to BLOB
3883 ** <tr><td> TEXT <td> INTEGER <td> [CAST] to INTEGER 4023 ** <tr><td> TEXT <td> INTEGER <td> [CAST] to INTEGER
3884 ** <tr><td> TEXT <td> FLOAT <td> [CAST] to REAL 4024 ** <tr><td> TEXT <td> FLOAT <td> [CAST] to REAL
3885 ** <tr><td> TEXT <td> BLOB <td> No change 4025 ** <tr><td> TEXT <td> BLOB <td> No change
3886 ** <tr><td> BLOB <td> INTEGER <td> [CAST] to INTEGER 4026 ** <tr><td> BLOB <td> INTEGER <td> [CAST] to INTEGER
3887 ** <tr><td> BLOB <td> FLOAT <td> [CAST] to REAL 4027 ** <tr><td> BLOB <td> FLOAT <td> [CAST] to REAL
3888 ** <tr><td> BLOB <td> TEXT <td> Add a zero terminator if needed 4028 ** <tr><td> BLOB <td> TEXT <td> Add a zero terminator if needed
3889 ** </table> 4029 ** </table>
3890 ** </blockquote>)^ 4030 ** </blockquote>)^
3891 ** 4031 **
3892 ** The table above makes reference to standard C library functions atoi()
3893 ** and atof(). SQLite does not really use these functions. It has its
3894 ** own equivalent internal routines. The atoi() and atof() names are
3895 ** used in the table for brevity and because they are familiar to most
3896 ** C programmers.
3897 **
3898 ** Note that when type conversions occur, pointers returned by prior 4032 ** Note that when type conversions occur, pointers returned by prior
3899 ** calls to sqlite3_column_blob(), sqlite3_column_text(), and/or 4033 ** calls to sqlite3_column_blob(), sqlite3_column_text(), and/or
3900 ** sqlite3_column_text16() may be invalidated. 4034 ** sqlite3_column_text16() may be invalidated.
3901 ** Type conversions and pointer invalidations might occur 4035 ** Type conversions and pointer invalidations might occur
3902 ** in the following cases: 4036 ** in the following cases:
3903 ** 4037 **
3904 ** <ul> 4038 ** <ul>
3905 ** <li> The initial content is a BLOB and sqlite3_column_text() or 4039 ** <li> The initial content is a BLOB and sqlite3_column_text() or
3906 ** sqlite3_column_text16() is called. A zero-terminator might 4040 ** sqlite3_column_text16() is called. A zero-terminator might
3907 ** need to be added to the string.</li> 4041 ** need to be added to the string.</li>
3908 ** <li> The initial content is UTF-8 text and sqlite3_column_bytes16() or 4042 ** <li> The initial content is UTF-8 text and sqlite3_column_bytes16() or
3909 ** sqlite3_column_text16() is called. The content must be converted 4043 ** sqlite3_column_text16() is called. The content must be converted
3910 ** to UTF-16.</li> 4044 ** to UTF-16.</li>
3911 ** <li> The initial content is UTF-16 text and sqlite3_column_bytes() or 4045 ** <li> The initial content is UTF-16 text and sqlite3_column_bytes() or
3912 ** sqlite3_column_text() is called. The content must be converted 4046 ** sqlite3_column_text() is called. The content must be converted
3913 ** to UTF-8.</li> 4047 ** to UTF-8.</li>
3914 ** </ul> 4048 ** </ul>
3915 ** 4049 **
3916 ** ^Conversions between UTF-16be and UTF-16le are always done in place and do 4050 ** ^Conversions between UTF-16be and UTF-16le are always done in place and do
3917 ** not invalidate a prior pointer, though of course the content of the buffer 4051 ** not invalidate a prior pointer, though of course the content of the buffer
3918 ** that the prior pointer references will have been modified. Other kinds 4052 ** that the prior pointer references will have been modified. Other kinds
3919 ** of conversion are done in place when it is possible, but sometimes they 4053 ** of conversion are done in place when it is possible, but sometimes they
3920 ** are not possible and in those cases prior pointers are invalidated. 4054 ** are not possible and in those cases prior pointers are invalidated.
3921 ** 4055 **
3922 ** The safest and easiest to remember policy is to invoke these routines 4056 ** The safest policy is to invoke these routines
3923 ** in one of the following ways: 4057 ** in one of the following ways:
3924 ** 4058 **
3925 ** <ul> 4059 ** <ul>
3926 ** <li>sqlite3_column_text() followed by sqlite3_column_bytes()</li> 4060 ** <li>sqlite3_column_text() followed by sqlite3_column_bytes()</li>
3927 ** <li>sqlite3_column_blob() followed by sqlite3_column_bytes()</li> 4061 ** <li>sqlite3_column_blob() followed by sqlite3_column_bytes()</li>
3928 ** <li>sqlite3_column_text16() followed by sqlite3_column_bytes16()</li> 4062 ** <li>sqlite3_column_text16() followed by sqlite3_column_bytes16()</li>
3929 ** </ul> 4063 ** </ul>
3930 ** 4064 **
3931 ** In other words, you should call sqlite3_column_text(), 4065 ** In other words, you should call sqlite3_column_text(),
3932 ** sqlite3_column_blob(), or sqlite3_column_text16() first to force the result 4066 ** sqlite3_column_blob(), or sqlite3_column_text16() first to force the result
3933 ** into the desired format, then invoke sqlite3_column_bytes() or 4067 ** into the desired format, then invoke sqlite3_column_bytes() or
3934 ** sqlite3_column_bytes16() to find the size of the result. Do not mix calls 4068 ** sqlite3_column_bytes16() to find the size of the result. Do not mix calls
3935 ** to sqlite3_column_text() or sqlite3_column_blob() with calls to 4069 ** to sqlite3_column_text() or sqlite3_column_blob() with calls to
3936 ** sqlite3_column_bytes16(), and do not mix calls to sqlite3_column_text16() 4070 ** sqlite3_column_bytes16(), and do not mix calls to sqlite3_column_text16()
3937 ** with calls to sqlite3_column_bytes(). 4071 ** with calls to sqlite3_column_bytes().
3938 ** 4072 **
3939 ** ^The pointers returned are valid until a type conversion occurs as 4073 ** ^The pointers returned are valid until a type conversion occurs as
3940 ** described above, or until [sqlite3_step()] or [sqlite3_reset()] or 4074 ** described above, or until [sqlite3_step()] or [sqlite3_reset()] or
3941 ** [sqlite3_finalize()] is called. ^The memory space used to hold strings 4075 ** [sqlite3_finalize()] is called. ^The memory space used to hold strings
3942 ** and BLOBs is freed automatically. Do <b>not</b> pass the pointers returned 4076 ** and BLOBs is freed automatically. Do <em>not</em> pass the pointers returned
3943 ** from [sqlite3_column_blob()], [sqlite3_column_text()], etc. into 4077 ** from [sqlite3_column_blob()], [sqlite3_column_text()], etc. into
3944 ** [sqlite3_free()]. 4078 ** [sqlite3_free()].
3945 ** 4079 **
3946 ** ^(If a memory allocation error occurs during the evaluation of any 4080 ** ^(If a memory allocation error occurs during the evaluation of any
3947 ** of these routines, a default value is returned. The default value 4081 ** of these routines, a default value is returned. The default value
3948 ** is either the integer 0, the floating point number 0.0, or a NULL 4082 ** is either the integer 0, the floating point number 0.0, or a NULL
3949 ** pointer. Subsequent calls to [sqlite3_errcode()] will return 4083 ** pointer. Subsequent calls to [sqlite3_errcode()] will return
3950 ** [SQLITE_NOMEM].)^ 4084 ** [SQLITE_NOMEM].)^
3951 */ 4085 */
3952 SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol); 4086 SQLITE_API const void *SQLITE_STDCALL sqlite3_column_blob(sqlite3_stmt*, int iCo l);
3953 SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol); 4087 SQLITE_API int SQLITE_STDCALL sqlite3_column_bytes(sqlite3_stmt*, int iCol);
3954 SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol); 4088 SQLITE_API int SQLITE_STDCALL sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
3955 SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol); 4089 SQLITE_API double SQLITE_STDCALL sqlite3_column_double(sqlite3_stmt*, int iCol);
3956 SQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol); 4090 SQLITE_API int SQLITE_STDCALL sqlite3_column_int(sqlite3_stmt*, int iCol);
3957 SQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol); 4091 SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_column_int64(sqlite3_stmt*, int iCol);
3958 SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol); 4092 SQLITE_API const unsigned char *SQLITE_STDCALL sqlite3_column_text(sqlite3_stmt* , int iCol);
3959 SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt*, int iCol); 4093 SQLITE_API const void *SQLITE_STDCALL sqlite3_column_text16(sqlite3_stmt*, int i Col);
3960 SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol); 4094 SQLITE_API int SQLITE_STDCALL sqlite3_column_type(sqlite3_stmt*, int iCol);
3961 SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol); 4095 SQLITE_API sqlite3_value *SQLITE_STDCALL sqlite3_column_value(sqlite3_stmt*, int iCol);
3962 4096
3963 /* 4097 /*
3964 ** CAPI3REF: Destroy A Prepared Statement Object 4098 ** CAPI3REF: Destroy A Prepared Statement Object
4099 ** DESTRUCTOR: sqlite3_stmt
3965 ** 4100 **
3966 ** ^The sqlite3_finalize() function is called to delete a [prepared statement]. 4101 ** ^The sqlite3_finalize() function is called to delete a [prepared statement].
3967 ** ^If the most recent evaluation of the statement encountered no errors 4102 ** ^If the most recent evaluation of the statement encountered no errors
3968 ** or if the statement is never been evaluated, then sqlite3_finalize() returns 4103 ** or if the statement is never been evaluated, then sqlite3_finalize() returns
3969 ** SQLITE_OK. ^If the most recent evaluation of statement S failed, then 4104 ** SQLITE_OK. ^If the most recent evaluation of statement S failed, then
3970 ** sqlite3_finalize(S) returns the appropriate [error code] or 4105 ** sqlite3_finalize(S) returns the appropriate [error code] or
3971 ** [extended error code]. 4106 ** [extended error code].
3972 ** 4107 **
3973 ** ^The sqlite3_finalize(S) routine can be called at any point during 4108 ** ^The sqlite3_finalize(S) routine can be called at any point during
3974 ** the life cycle of [prepared statement] S: 4109 ** the life cycle of [prepared statement] S:
3975 ** before statement S is ever evaluated, after 4110 ** before statement S is ever evaluated, after
3976 ** one or more calls to [sqlite3_reset()], or after any call 4111 ** one or more calls to [sqlite3_reset()], or after any call
3977 ** to [sqlite3_step()] regardless of whether or not the statement has 4112 ** to [sqlite3_step()] regardless of whether or not the statement has
3978 ** completed execution. 4113 ** completed execution.
3979 ** 4114 **
3980 ** ^Invoking sqlite3_finalize() on a NULL pointer is a harmless no-op. 4115 ** ^Invoking sqlite3_finalize() on a NULL pointer is a harmless no-op.
3981 ** 4116 **
3982 ** The application must finalize every [prepared statement] in order to avoid 4117 ** The application must finalize every [prepared statement] in order to avoid
3983 ** resource leaks. It is a grievous error for the application to try to use 4118 ** resource leaks. It is a grievous error for the application to try to use
3984 ** a prepared statement after it has been finalized. Any use of a prepared 4119 ** a prepared statement after it has been finalized. Any use of a prepared
3985 ** statement after it has been finalized can result in undefined and 4120 ** statement after it has been finalized can result in undefined and
3986 ** undesirable behavior such as segfaults and heap corruption. 4121 ** undesirable behavior such as segfaults and heap corruption.
3987 */ 4122 */
3988 SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt); 4123 SQLITE_API int SQLITE_STDCALL sqlite3_finalize(sqlite3_stmt *pStmt);
3989 4124
3990 /* 4125 /*
3991 ** CAPI3REF: Reset A Prepared Statement Object 4126 ** CAPI3REF: Reset A Prepared Statement Object
4127 ** METHOD: sqlite3_stmt
3992 ** 4128 **
3993 ** The sqlite3_reset() function is called to reset a [prepared statement] 4129 ** The sqlite3_reset() function is called to reset a [prepared statement]
3994 ** object back to its initial state, ready to be re-executed. 4130 ** object back to its initial state, ready to be re-executed.
3995 ** ^Any SQL statement variables that had values bound to them using 4131 ** ^Any SQL statement variables that had values bound to them using
3996 ** the [sqlite3_bind_blob | sqlite3_bind_*() API] retain their values. 4132 ** the [sqlite3_bind_blob | sqlite3_bind_*() API] retain their values.
3997 ** Use [sqlite3_clear_bindings()] to reset the bindings. 4133 ** Use [sqlite3_clear_bindings()] to reset the bindings.
3998 ** 4134 **
3999 ** ^The [sqlite3_reset(S)] interface resets the [prepared statement] S 4135 ** ^The [sqlite3_reset(S)] interface resets the [prepared statement] S
4000 ** back to the beginning of its program. 4136 ** back to the beginning of its program.
4001 ** 4137 **
4002 ** ^If the most recent call to [sqlite3_step(S)] for the 4138 ** ^If the most recent call to [sqlite3_step(S)] for the
4003 ** [prepared statement] S returned [SQLITE_ROW] or [SQLITE_DONE], 4139 ** [prepared statement] S returned [SQLITE_ROW] or [SQLITE_DONE],
4004 ** or if [sqlite3_step(S)] has never before been called on S, 4140 ** or if [sqlite3_step(S)] has never before been called on S,
4005 ** then [sqlite3_reset(S)] returns [SQLITE_OK]. 4141 ** then [sqlite3_reset(S)] returns [SQLITE_OK].
4006 ** 4142 **
4007 ** ^If the most recent call to [sqlite3_step(S)] for the 4143 ** ^If the most recent call to [sqlite3_step(S)] for the
4008 ** [prepared statement] S indicated an error, then 4144 ** [prepared statement] S indicated an error, then
4009 ** [sqlite3_reset(S)] returns an appropriate [error code]. 4145 ** [sqlite3_reset(S)] returns an appropriate [error code].
4010 ** 4146 **
4011 ** ^The [sqlite3_reset(S)] interface does not change the values 4147 ** ^The [sqlite3_reset(S)] interface does not change the values
4012 ** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S. 4148 ** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S.
4013 */ 4149 */
4014 SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt); 4150 SQLITE_API int SQLITE_STDCALL sqlite3_reset(sqlite3_stmt *pStmt);
4015 4151
4016 /* 4152 /*
4017 ** CAPI3REF: Create Or Redefine SQL Functions 4153 ** CAPI3REF: Create Or Redefine SQL Functions
4018 ** KEYWORDS: {function creation routines} 4154 ** KEYWORDS: {function creation routines}
4019 ** KEYWORDS: {application-defined SQL function} 4155 ** KEYWORDS: {application-defined SQL function}
4020 ** KEYWORDS: {application-defined SQL functions} 4156 ** KEYWORDS: {application-defined SQL functions}
4157 ** METHOD: sqlite3
4021 ** 4158 **
4022 ** ^These functions (collectively known as "function creation routines") 4159 ** ^These functions (collectively known as "function creation routines")
4023 ** are used to add SQL functions or aggregates or to redefine the behavior 4160 ** are used to add SQL functions or aggregates or to redefine the behavior
4024 ** of existing SQL functions or aggregates. The only differences between 4161 ** of existing SQL functions or aggregates. The only differences between
4025 ** these routines are the text encoding expected for 4162 ** these routines are the text encoding expected for
4026 ** the second parameter (the name of the function being created) 4163 ** the second parameter (the name of the function being created)
4027 ** and the presence or absence of a destructor callback for 4164 ** and the presence or absence of a destructor callback for
4028 ** the application data pointer. 4165 ** the application data pointer.
4029 ** 4166 **
4030 ** ^The first parameter is the [database connection] to which the SQL 4167 ** ^The first parameter is the [database connection] to which the SQL
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
4103 ** is a closer match than a function where the encoding difference is 4240 ** is a closer match than a function where the encoding difference is
4104 ** between UTF8 and UTF16. 4241 ** between UTF8 and UTF16.
4105 ** 4242 **
4106 ** ^Built-in functions may be overloaded by new application-defined functions. 4243 ** ^Built-in functions may be overloaded by new application-defined functions.
4107 ** 4244 **
4108 ** ^An application-defined function is permitted to call other 4245 ** ^An application-defined function is permitted to call other
4109 ** SQLite interfaces. However, such calls must not 4246 ** SQLite interfaces. However, such calls must not
4110 ** close the database connection nor finalize or reset the prepared 4247 ** close the database connection nor finalize or reset the prepared
4111 ** statement in which the function is running. 4248 ** statement in which the function is running.
4112 */ 4249 */
4113 SQLITE_API int sqlite3_create_function( 4250 SQLITE_API int SQLITE_STDCALL sqlite3_create_function(
4114 sqlite3 *db, 4251 sqlite3 *db,
4115 const char *zFunctionName, 4252 const char *zFunctionName,
4116 int nArg, 4253 int nArg,
4117 int eTextRep, 4254 int eTextRep,
4118 void *pApp, 4255 void *pApp,
4119 void (*xFunc)(sqlite3_context*,int,sqlite3_value**), 4256 void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
4120 void (*xStep)(sqlite3_context*,int,sqlite3_value**), 4257 void (*xStep)(sqlite3_context*,int,sqlite3_value**),
4121 void (*xFinal)(sqlite3_context*) 4258 void (*xFinal)(sqlite3_context*)
4122 ); 4259 );
4123 SQLITE_API int sqlite3_create_function16( 4260 SQLITE_API int SQLITE_STDCALL sqlite3_create_function16(
4124 sqlite3 *db, 4261 sqlite3 *db,
4125 const void *zFunctionName, 4262 const void *zFunctionName,
4126 int nArg, 4263 int nArg,
4127 int eTextRep, 4264 int eTextRep,
4128 void *pApp, 4265 void *pApp,
4129 void (*xFunc)(sqlite3_context*,int,sqlite3_value**), 4266 void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
4130 void (*xStep)(sqlite3_context*,int,sqlite3_value**), 4267 void (*xStep)(sqlite3_context*,int,sqlite3_value**),
4131 void (*xFinal)(sqlite3_context*) 4268 void (*xFinal)(sqlite3_context*)
4132 ); 4269 );
4133 SQLITE_API int sqlite3_create_function_v2( 4270 SQLITE_API int SQLITE_STDCALL sqlite3_create_function_v2(
4134 sqlite3 *db, 4271 sqlite3 *db,
4135 const char *zFunctionName, 4272 const char *zFunctionName,
4136 int nArg, 4273 int nArg,
4137 int eTextRep, 4274 int eTextRep,
4138 void *pApp, 4275 void *pApp,
4139 void (*xFunc)(sqlite3_context*,int,sqlite3_value**), 4276 void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
4140 void (*xStep)(sqlite3_context*,int,sqlite3_value**), 4277 void (*xStep)(sqlite3_context*,int,sqlite3_value**),
4141 void (*xFinal)(sqlite3_context*), 4278 void (*xFinal)(sqlite3_context*),
4142 void(*xDestroy)(void*) 4279 void(*xDestroy)(void*)
4143 ); 4280 );
4144 4281
4145 /* 4282 /*
4146 ** CAPI3REF: Text Encodings 4283 ** CAPI3REF: Text Encodings
4147 ** 4284 **
4148 ** These constant define integer codes that represent the various 4285 ** These constant define integer codes that represent the various
4149 ** text encodings supported by SQLite. 4286 ** text encodings supported by SQLite.
4150 */ 4287 */
4151 #define SQLITE_UTF8 1 4288 #define SQLITE_UTF8 1 /* IMP: R-37514-35566 */
4152 #define SQLITE_UTF16LE 2 4289 #define SQLITE_UTF16LE 2 /* IMP: R-03371-37637 */
4153 #define SQLITE_UTF16BE 3 4290 #define SQLITE_UTF16BE 3 /* IMP: R-51971-34154 */
4154 #define SQLITE_UTF16 4 /* Use native byte order */ 4291 #define SQLITE_UTF16 4 /* Use native byte order */
4155 #define SQLITE_ANY 5 /* Deprecated */ 4292 #define SQLITE_ANY 5 /* Deprecated */
4156 #define SQLITE_UTF16_ALIGNED 8 /* sqlite3_create_collation only */ 4293 #define SQLITE_UTF16_ALIGNED 8 /* sqlite3_create_collation only */
4157 4294
4158 /* 4295 /*
4159 ** CAPI3REF: Function Flags 4296 ** CAPI3REF: Function Flags
4160 ** 4297 **
4161 ** These constants may be ORed together with the 4298 ** These constants may be ORed together with the
4162 ** [SQLITE_UTF8 | preferred text encoding] as the fourth argument 4299 ** [SQLITE_UTF8 | preferred text encoding] as the fourth argument
4163 ** to [sqlite3_create_function()], [sqlite3_create_function16()], or 4300 ** to [sqlite3_create_function()], [sqlite3_create_function16()], or
4164 ** [sqlite3_create_function_v2()]. 4301 ** [sqlite3_create_function_v2()].
4165 */ 4302 */
4166 #define SQLITE_DETERMINISTIC 0x800 4303 #define SQLITE_DETERMINISTIC 0x800
4167 4304
4168 /* 4305 /*
4169 ** CAPI3REF: Deprecated Functions 4306 ** CAPI3REF: Deprecated Functions
4170 ** DEPRECATED 4307 ** DEPRECATED
4171 ** 4308 **
4172 ** These functions are [deprecated]. In order to maintain 4309 ** These functions are [deprecated]. In order to maintain
4173 ** backwards compatibility with older code, these functions continue 4310 ** backwards compatibility with older code, these functions continue
4174 ** to be supported. However, new applications should avoid 4311 ** to be supported. However, new applications should avoid
4175 ** the use of these functions. To help encourage people to avoid 4312 ** the use of these functions. To encourage programmers to avoid
4176 ** using these functions, we are not going to tell you what they do. 4313 ** these functions, we will not explain what they do.
4177 */ 4314 */
4178 #ifndef SQLITE_OMIT_DEPRECATED 4315 #ifndef SQLITE_OMIT_DEPRECATED
4179 SQLITE_API SQLITE_DEPRECATED int sqlite3_aggregate_count(sqlite3_context*); 4316 SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_aggregate_count(sqlite3_ context*);
4180 SQLITE_API SQLITE_DEPRECATED int sqlite3_expired(sqlite3_stmt*); 4317 SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_expired(sqlite3_stmt*);
4181 SQLITE_API SQLITE_DEPRECATED int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite 3_stmt*); 4318 SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_transfer_bindings(sqlite 3_stmt*, sqlite3_stmt*);
4182 SQLITE_API SQLITE_DEPRECATED int sqlite3_global_recover(void); 4319 SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_global_recover(void);
4183 SQLITE_API SQLITE_DEPRECATED void sqlite3_thread_cleanup(void); 4320 SQLITE_API SQLITE_DEPRECATED void SQLITE_STDCALL sqlite3_thread_cleanup(void);
4184 SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int6 4,int), 4321 SQLITE_API SQLITE_DEPRECATED int SQLITE_STDCALL sqlite3_memory_alarm(void(*)(voi d*,sqlite3_int64,int),
4185 void*,sqlite3_int64); 4322 void*,sqlite3_int64);
4186 #endif 4323 #endif
4187 4324
4188 /* 4325 /*
4189 ** CAPI3REF: Obtaining SQL Function Parameter Values 4326 ** CAPI3REF: Obtaining SQL Values
4327 ** METHOD: sqlite3_value
4190 ** 4328 **
4191 ** The C-language implementation of SQL functions and aggregates uses 4329 ** The C-language implementation of SQL functions and aggregates uses
4192 ** this set of interface routines to access the parameter values on 4330 ** this set of interface routines to access the parameter values on
4193 ** the function or aggregate. 4331 ** the function or aggregate.
4194 ** 4332 **
4195 ** The xFunc (for scalar functions) or xStep (for aggregates) parameters 4333 ** The xFunc (for scalar functions) or xStep (for aggregates) parameters
4196 ** to [sqlite3_create_function()] and [sqlite3_create_function16()] 4334 ** to [sqlite3_create_function()] and [sqlite3_create_function16()]
4197 ** define callbacks that implement the SQL functions and aggregates. 4335 ** define callbacks that implement the SQL functions and aggregates.
4198 ** The 3rd parameter to these callbacks is an array of pointers to 4336 ** The 3rd parameter to these callbacks is an array of pointers to
4199 ** [protected sqlite3_value] objects. There is one [sqlite3_value] object for 4337 ** [protected sqlite3_value] objects. There is one [sqlite3_value] object for
4200 ** each parameter to the SQL function. These routines are used to 4338 ** each parameter to the SQL function. These routines are used to
4201 ** extract values from the [sqlite3_value] objects. 4339 ** extract values from the [sqlite3_value] objects.
4202 ** 4340 **
4203 ** These routines work only with [protected sqlite3_value] objects. 4341 ** These routines work only with [protected sqlite3_value] objects.
(...skipping 19 matching lines...) Expand all
4223 ** 4361 **
4224 ** Please pay particular attention to the fact that the pointer returned 4362 ** Please pay particular attention to the fact that the pointer returned
4225 ** from [sqlite3_value_blob()], [sqlite3_value_text()], or 4363 ** from [sqlite3_value_blob()], [sqlite3_value_text()], or
4226 ** [sqlite3_value_text16()] can be invalidated by a subsequent call to 4364 ** [sqlite3_value_text16()] can be invalidated by a subsequent call to
4227 ** [sqlite3_value_bytes()], [sqlite3_value_bytes16()], [sqlite3_value_text()], 4365 ** [sqlite3_value_bytes()], [sqlite3_value_bytes16()], [sqlite3_value_text()],
4228 ** or [sqlite3_value_text16()]. 4366 ** or [sqlite3_value_text16()].
4229 ** 4367 **
4230 ** These routines must be called from the same thread as 4368 ** These routines must be called from the same thread as
4231 ** the SQL function that supplied the [sqlite3_value*] parameters. 4369 ** the SQL function that supplied the [sqlite3_value*] parameters.
4232 */ 4370 */
4233 SQLITE_API const void *sqlite3_value_blob(sqlite3_value*); 4371 SQLITE_API const void *SQLITE_STDCALL sqlite3_value_blob(sqlite3_value*);
4234 SQLITE_API int sqlite3_value_bytes(sqlite3_value*); 4372 SQLITE_API int SQLITE_STDCALL sqlite3_value_bytes(sqlite3_value*);
4235 SQLITE_API int sqlite3_value_bytes16(sqlite3_value*); 4373 SQLITE_API int SQLITE_STDCALL sqlite3_value_bytes16(sqlite3_value*);
4236 SQLITE_API double sqlite3_value_double(sqlite3_value*); 4374 SQLITE_API double SQLITE_STDCALL sqlite3_value_double(sqlite3_value*);
4237 SQLITE_API int sqlite3_value_int(sqlite3_value*); 4375 SQLITE_API int SQLITE_STDCALL sqlite3_value_int(sqlite3_value*);
4238 SQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*); 4376 SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_value_int64(sqlite3_value*);
4239 SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value*); 4377 SQLITE_API const unsigned char *SQLITE_STDCALL sqlite3_value_text(sqlite3_value* );
4240 SQLITE_API const void *sqlite3_value_text16(sqlite3_value*); 4378 SQLITE_API const void *SQLITE_STDCALL sqlite3_value_text16(sqlite3_value*);
4241 SQLITE_API const void *sqlite3_value_text16le(sqlite3_value*); 4379 SQLITE_API const void *SQLITE_STDCALL sqlite3_value_text16le(sqlite3_value*);
4242 SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*); 4380 SQLITE_API const void *SQLITE_STDCALL sqlite3_value_text16be(sqlite3_value*);
4243 SQLITE_API int sqlite3_value_type(sqlite3_value*); 4381 SQLITE_API int SQLITE_STDCALL sqlite3_value_type(sqlite3_value*);
4244 SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*); 4382 SQLITE_API int SQLITE_STDCALL sqlite3_value_numeric_type(sqlite3_value*);
4383
4384 /*
4385 ** CAPI3REF: Finding The Subtype Of SQL Values
4386 ** METHOD: sqlite3_value
4387 **
4388 ** The sqlite3_value_subtype(V) function returns the subtype for
4389 ** an [application-defined SQL function] argument V. The subtype
4390 ** information can be used to pass a limited amount of context from
4391 ** one SQL function to another. Use the [sqlite3_result_subtype()]
4392 ** routine to set the subtype for the return value of an SQL function.
4393 **
4394 ** SQLite makes no use of subtype itself. It merely passes the subtype
4395 ** from the result of one [application-defined SQL function] into the
4396 ** input of another.
4397 */
4398 SQLITE_API unsigned int SQLITE_STDCALL sqlite3_value_subtype(sqlite3_value*);
4399
4400 /*
4401 ** CAPI3REF: Copy And Free SQL Values
4402 ** METHOD: sqlite3_value
4403 **
4404 ** ^The sqlite3_value_dup(V) interface makes a copy of the [sqlite3_value]
4405 ** object D and returns a pointer to that copy. ^The [sqlite3_value] returned
4406 ** is a [protected sqlite3_value] object even if the input is not.
4407 ** ^The sqlite3_value_dup(V) interface returns NULL if V is NULL or if a
4408 ** memory allocation fails.
4409 **
4410 ** ^The sqlite3_value_free(V) interface frees an [sqlite3_value] object
4411 ** previously obtained from [sqlite3_value_dup()]. ^If V is a NULL pointer
4412 ** then sqlite3_value_free(V) is a harmless no-op.
4413 */
4414 SQLITE_API sqlite3_value *SQLITE_STDCALL sqlite3_value_dup(const sqlite3_value*) ;
4415 SQLITE_API void SQLITE_STDCALL sqlite3_value_free(sqlite3_value*);
4245 4416
4246 /* 4417 /*
4247 ** CAPI3REF: Obtain Aggregate Function Context 4418 ** CAPI3REF: Obtain Aggregate Function Context
4419 ** METHOD: sqlite3_context
4248 ** 4420 **
4249 ** Implementations of aggregate SQL functions use this 4421 ** Implementations of aggregate SQL functions use this
4250 ** routine to allocate memory for storing their state. 4422 ** routine to allocate memory for storing their state.
4251 ** 4423 **
4252 ** ^The first time the sqlite3_aggregate_context(C,N) routine is called 4424 ** ^The first time the sqlite3_aggregate_context(C,N) routine is called
4253 ** for a particular aggregate function, SQLite 4425 ** for a particular aggregate function, SQLite
4254 ** allocates N of memory, zeroes out that memory, and returns a pointer 4426 ** allocates N of memory, zeroes out that memory, and returns a pointer
4255 ** to the new memory. ^On second and subsequent calls to 4427 ** to the new memory. ^On second and subsequent calls to
4256 ** sqlite3_aggregate_context() for the same aggregate function instance, 4428 ** sqlite3_aggregate_context() for the same aggregate function instance,
4257 ** the same buffer is returned. Sqlite3_aggregate_context() is normally 4429 ** the same buffer is returned. Sqlite3_aggregate_context() is normally
(...skipping 20 matching lines...) Expand all
4278 ** sqlite3_aggregate_context() when the aggregate query concludes. 4450 ** sqlite3_aggregate_context() when the aggregate query concludes.
4279 ** 4451 **
4280 ** The first parameter must be a copy of the 4452 ** The first parameter must be a copy of the
4281 ** [sqlite3_context | SQL function context] that is the first parameter 4453 ** [sqlite3_context | SQL function context] that is the first parameter
4282 ** to the xStep or xFinal callback routine that implements the aggregate 4454 ** to the xStep or xFinal callback routine that implements the aggregate
4283 ** function. 4455 ** function.
4284 ** 4456 **
4285 ** This routine must be called from the same thread in which 4457 ** This routine must be called from the same thread in which
4286 ** the aggregate SQL function is running. 4458 ** the aggregate SQL function is running.
4287 */ 4459 */
4288 SQLITE_API void *sqlite3_aggregate_context(sqlite3_context*, int nBytes); 4460 SQLITE_API void *SQLITE_STDCALL sqlite3_aggregate_context(sqlite3_context*, int nBytes);
4289 4461
4290 /* 4462 /*
4291 ** CAPI3REF: User Data For Functions 4463 ** CAPI3REF: User Data For Functions
4464 ** METHOD: sqlite3_context
4292 ** 4465 **
4293 ** ^The sqlite3_user_data() interface returns a copy of 4466 ** ^The sqlite3_user_data() interface returns a copy of
4294 ** the pointer that was the pUserData parameter (the 5th parameter) 4467 ** the pointer that was the pUserData parameter (the 5th parameter)
4295 ** of the [sqlite3_create_function()] 4468 ** of the [sqlite3_create_function()]
4296 ** and [sqlite3_create_function16()] routines that originally 4469 ** and [sqlite3_create_function16()] routines that originally
4297 ** registered the application defined function. 4470 ** registered the application defined function.
4298 ** 4471 **
4299 ** This routine must be called from the same thread in which 4472 ** This routine must be called from the same thread in which
4300 ** the application-defined function is running. 4473 ** the application-defined function is running.
4301 */ 4474 */
4302 SQLITE_API void *sqlite3_user_data(sqlite3_context*); 4475 SQLITE_API void *SQLITE_STDCALL sqlite3_user_data(sqlite3_context*);
4303 4476
4304 /* 4477 /*
4305 ** CAPI3REF: Database Connection For Functions 4478 ** CAPI3REF: Database Connection For Functions
4479 ** METHOD: sqlite3_context
4306 ** 4480 **
4307 ** ^The sqlite3_context_db_handle() interface returns a copy of 4481 ** ^The sqlite3_context_db_handle() interface returns a copy of
4308 ** the pointer to the [database connection] (the 1st parameter) 4482 ** the pointer to the [database connection] (the 1st parameter)
4309 ** of the [sqlite3_create_function()] 4483 ** of the [sqlite3_create_function()]
4310 ** and [sqlite3_create_function16()] routines that originally 4484 ** and [sqlite3_create_function16()] routines that originally
4311 ** registered the application defined function. 4485 ** registered the application defined function.
4312 */ 4486 */
4313 SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*); 4487 SQLITE_API sqlite3 *SQLITE_STDCALL sqlite3_context_db_handle(sqlite3_context*);
4314 4488
4315 /* 4489 /*
4316 ** CAPI3REF: Function Auxiliary Data 4490 ** CAPI3REF: Function Auxiliary Data
4491 ** METHOD: sqlite3_context
4317 ** 4492 **
4318 ** These functions may be used by (non-aggregate) SQL functions to 4493 ** These functions may be used by (non-aggregate) SQL functions to
4319 ** associate metadata with argument values. If the same value is passed to 4494 ** associate metadata with argument values. If the same value is passed to
4320 ** multiple invocations of the same SQL function during query execution, under 4495 ** multiple invocations of the same SQL function during query execution, under
4321 ** some circumstances the associated metadata may be preserved. An example 4496 ** some circumstances the associated metadata may be preserved. An example
4322 ** of where this might be useful is in a regular-expression matching 4497 ** of where this might be useful is in a regular-expression matching
4323 ** function. The compiled version of the regular expression can be stored as 4498 ** function. The compiled version of the regular expression can be stored as
4324 ** metadata associated with the pattern string. 4499 ** metadata associated with the pattern string.
4325 ** Then as long as the pattern string remains the same, 4500 ** Then as long as the pattern string remains the same,
4326 ** the compiled regular expression can be reused on multiple 4501 ** the compiled regular expression can be reused on multiple
(...skipping 28 matching lines...) Expand all
4355 ** function implementation should not make any use of P after 4530 ** function implementation should not make any use of P after
4356 ** sqlite3_set_auxdata() has been called. 4531 ** sqlite3_set_auxdata() has been called.
4357 ** 4532 **
4358 ** ^(In practice, metadata is preserved between function calls for 4533 ** ^(In practice, metadata is preserved between function calls for
4359 ** function parameters that are compile-time constants, including literal 4534 ** function parameters that are compile-time constants, including literal
4360 ** values and [parameters] and expressions composed from the same.)^ 4535 ** values and [parameters] and expressions composed from the same.)^
4361 ** 4536 **
4362 ** These routines must be called from the same thread in which 4537 ** These routines must be called from the same thread in which
4363 ** the SQL function is running. 4538 ** the SQL function is running.
4364 */ 4539 */
4365 SQLITE_API void *sqlite3_get_auxdata(sqlite3_context*, int N); 4540 SQLITE_API void *SQLITE_STDCALL sqlite3_get_auxdata(sqlite3_context*, int N);
4366 SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(voi d*)); 4541 SQLITE_API void SQLITE_STDCALL sqlite3_set_auxdata(sqlite3_context*, int N, void *, void (*)(void*));
4367 4542
4368 4543
4369 /* 4544 /*
4370 ** CAPI3REF: Constants Defining Special Destructor Behavior 4545 ** CAPI3REF: Constants Defining Special Destructor Behavior
4371 ** 4546 **
4372 ** These are special values for the destructor that is passed in as the 4547 ** These are special values for the destructor that is passed in as the
4373 ** final argument to routines like [sqlite3_result_blob()]. ^If the destructor 4548 ** final argument to routines like [sqlite3_result_blob()]. ^If the destructor
4374 ** argument is SQLITE_STATIC, it means that the content pointer is constant 4549 ** argument is SQLITE_STATIC, it means that the content pointer is constant
4375 ** and will never change. It does not need to be destroyed. ^The 4550 ** and will never change. It does not need to be destroyed. ^The
4376 ** SQLITE_TRANSIENT value means that the content will likely change in 4551 ** SQLITE_TRANSIENT value means that the content will likely change in
4377 ** the near future and that SQLite should make its own private copy of 4552 ** the near future and that SQLite should make its own private copy of
4378 ** the content before returning. 4553 ** the content before returning.
4379 ** 4554 **
4380 ** The typedef is necessary to work around problems in certain 4555 ** The typedef is necessary to work around problems in certain
4381 ** C++ compilers. 4556 ** C++ compilers.
4382 */ 4557 */
4383 typedef void (*sqlite3_destructor_type)(void*); 4558 typedef void (*sqlite3_destructor_type)(void*);
4384 #define SQLITE_STATIC ((sqlite3_destructor_type)0) 4559 #define SQLITE_STATIC ((sqlite3_destructor_type)0)
4385 #define SQLITE_TRANSIENT ((sqlite3_destructor_type)-1) 4560 #define SQLITE_TRANSIENT ((sqlite3_destructor_type)-1)
4386 4561
4387 /* 4562 /*
4388 ** CAPI3REF: Setting The Result Of An SQL Function 4563 ** CAPI3REF: Setting The Result Of An SQL Function
4564 ** METHOD: sqlite3_context
4389 ** 4565 **
4390 ** These routines are used by the xFunc or xFinal callbacks that 4566 ** These routines are used by the xFunc or xFinal callbacks that
4391 ** implement SQL functions and aggregates. See 4567 ** implement SQL functions and aggregates. See
4392 ** [sqlite3_create_function()] and [sqlite3_create_function16()] 4568 ** [sqlite3_create_function()] and [sqlite3_create_function16()]
4393 ** for additional information. 4569 ** for additional information.
4394 ** 4570 **
4395 ** These functions work very much like the [parameter binding] family of 4571 ** These functions work very much like the [parameter binding] family of
4396 ** functions used to bind values to host parameters in prepared statements. 4572 ** functions used to bind values to host parameters in prepared statements.
4397 ** Refer to the [SQL parameter] documentation for additional information. 4573 ** Refer to the [SQL parameter] documentation for additional information.
4398 ** 4574 **
4399 ** ^The sqlite3_result_blob() interface sets the result from 4575 ** ^The sqlite3_result_blob() interface sets the result from
4400 ** an application-defined function to be the BLOB whose content is pointed 4576 ** an application-defined function to be the BLOB whose content is pointed
4401 ** to by the second parameter and which is N bytes long where N is the 4577 ** to by the second parameter and which is N bytes long where N is the
4402 ** third parameter. 4578 ** third parameter.
4403 ** 4579 **
4404 ** ^The sqlite3_result_zeroblob() interfaces set the result of 4580 ** ^The sqlite3_result_zeroblob(C,N) and sqlite3_result_zeroblob64(C,N)
4405 ** the application-defined function to be a BLOB containing all zero 4581 ** interfaces set the result of the application-defined function to be
4406 ** bytes and N bytes in size, where N is the value of the 2nd parameter. 4582 ** a BLOB containing all zero bytes and N bytes in size.
4407 ** 4583 **
4408 ** ^The sqlite3_result_double() interface sets the result from 4584 ** ^The sqlite3_result_double() interface sets the result from
4409 ** an application-defined function to be a floating point value specified 4585 ** an application-defined function to be a floating point value specified
4410 ** by its 2nd argument. 4586 ** by its 2nd argument.
4411 ** 4587 **
4412 ** ^The sqlite3_result_error() and sqlite3_result_error16() functions 4588 ** ^The sqlite3_result_error() and sqlite3_result_error16() functions
4413 ** cause the implemented SQL function to throw an exception. 4589 ** cause the implemented SQL function to throw an exception.
4414 ** ^SQLite uses the string pointed to by the 4590 ** ^SQLite uses the string pointed to by the
4415 ** 2nd parameter of sqlite3_result_error() or sqlite3_result_error16() 4591 ** 2nd parameter of sqlite3_result_error() or sqlite3_result_error16()
4416 ** as the text of an error message. ^SQLite interprets the error 4592 ** as the text of an error message. ^SQLite interprets the error
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
4478 ** sqlite3_result_blob is the special constant SQLITE_STATIC, then SQLite 4654 ** sqlite3_result_blob is the special constant SQLITE_STATIC, then SQLite
4479 ** assumes that the text or BLOB result is in constant space and does not 4655 ** assumes that the text or BLOB result is in constant space and does not
4480 ** copy the content of the parameter nor call a destructor on the content 4656 ** copy the content of the parameter nor call a destructor on the content
4481 ** when it has finished using that result. 4657 ** when it has finished using that result.
4482 ** ^If the 4th parameter to the sqlite3_result_text* interfaces 4658 ** ^If the 4th parameter to the sqlite3_result_text* interfaces
4483 ** or sqlite3_result_blob is the special constant SQLITE_TRANSIENT 4659 ** or sqlite3_result_blob is the special constant SQLITE_TRANSIENT
4484 ** then SQLite makes a copy of the result into space obtained from 4660 ** then SQLite makes a copy of the result into space obtained from
4485 ** from [sqlite3_malloc()] before it returns. 4661 ** from [sqlite3_malloc()] before it returns.
4486 ** 4662 **
4487 ** ^The sqlite3_result_value() interface sets the result of 4663 ** ^The sqlite3_result_value() interface sets the result of
4488 ** the application-defined function to be a copy the 4664 ** the application-defined function to be a copy of the
4489 ** [unprotected sqlite3_value] object specified by the 2nd parameter. ^The 4665 ** [unprotected sqlite3_value] object specified by the 2nd parameter. ^The
4490 ** sqlite3_result_value() interface makes a copy of the [sqlite3_value] 4666 ** sqlite3_result_value() interface makes a copy of the [sqlite3_value]
4491 ** so that the [sqlite3_value] specified in the parameter may change or 4667 ** so that the [sqlite3_value] specified in the parameter may change or
4492 ** be deallocated after sqlite3_result_value() returns without harm. 4668 ** be deallocated after sqlite3_result_value() returns without harm.
4493 ** ^A [protected sqlite3_value] object may always be used where an 4669 ** ^A [protected sqlite3_value] object may always be used where an
4494 ** [unprotected sqlite3_value] object is required, so either 4670 ** [unprotected sqlite3_value] object is required, so either
4495 ** kind of [sqlite3_value] object can be used with this interface. 4671 ** kind of [sqlite3_value] object can be used with this interface.
4496 ** 4672 **
4497 ** If these routines are called from within the different thread 4673 ** If these routines are called from within the different thread
4498 ** than the one containing the application-defined function that received 4674 ** than the one containing the application-defined function that received
4499 ** the [sqlite3_context] pointer, the results are undefined. 4675 ** the [sqlite3_context] pointer, the results are undefined.
4500 */ 4676 */
4501 SQLITE_API void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)( void*)); 4677 SQLITE_API void SQLITE_STDCALL sqlite3_result_blob(sqlite3_context*, const void* , int, void(*)(void*));
4502 SQLITE_API void sqlite3_result_blob64(sqlite3_context*,const void*,sqlite3_uint6 4,void(*)(void*)); 4678 SQLITE_API void SQLITE_STDCALL sqlite3_result_blob64(sqlite3_context*,const void *,
4503 SQLITE_API void sqlite3_result_double(sqlite3_context*, double); 4679 sqlite3_uint64,void(*)(void*));
4504 SQLITE_API void sqlite3_result_error(sqlite3_context*, const char*, int); 4680 SQLITE_API void SQLITE_STDCALL sqlite3_result_double(sqlite3_context*, double);
4505 SQLITE_API void sqlite3_result_error16(sqlite3_context*, const void*, int); 4681 SQLITE_API void SQLITE_STDCALL sqlite3_result_error(sqlite3_context*, const char *, int);
4506 SQLITE_API void sqlite3_result_error_toobig(sqlite3_context*); 4682 SQLITE_API void SQLITE_STDCALL sqlite3_result_error16(sqlite3_context*, const vo id*, int);
4507 SQLITE_API void sqlite3_result_error_nomem(sqlite3_context*); 4683 SQLITE_API void SQLITE_STDCALL sqlite3_result_error_toobig(sqlite3_context*);
4508 SQLITE_API void sqlite3_result_error_code(sqlite3_context*, int); 4684 SQLITE_API void SQLITE_STDCALL sqlite3_result_error_nomem(sqlite3_context*);
4509 SQLITE_API void sqlite3_result_int(sqlite3_context*, int); 4685 SQLITE_API void SQLITE_STDCALL sqlite3_result_error_code(sqlite3_context*, int);
4510 SQLITE_API void sqlite3_result_int64(sqlite3_context*, sqlite3_int64); 4686 SQLITE_API void SQLITE_STDCALL sqlite3_result_int(sqlite3_context*, int);
4511 SQLITE_API void sqlite3_result_null(sqlite3_context*); 4687 SQLITE_API void SQLITE_STDCALL sqlite3_result_int64(sqlite3_context*, sqlite3_in t64);
4512 SQLITE_API void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)( void*)); 4688 SQLITE_API void SQLITE_STDCALL sqlite3_result_null(sqlite3_context*);
4513 SQLITE_API void sqlite3_result_text64(sqlite3_context*, const char*,sqlite3_uint 64, 4689 SQLITE_API void SQLITE_STDCALL sqlite3_result_text(sqlite3_context*, const char* , int, void(*)(void*));
4690 SQLITE_API void SQLITE_STDCALL sqlite3_result_text64(sqlite3_context*, const cha r*,sqlite3_uint64,
4514 void(*)(void*), unsigned char encoding); 4691 void(*)(void*), unsigned char encoding);
4515 SQLITE_API void sqlite3_result_text16(sqlite3_context*, const void*, int, void(* )(void*)); 4692 SQLITE_API void SQLITE_STDCALL sqlite3_result_text16(sqlite3_context*, const voi d*, int, void(*)(void*));
4516 SQLITE_API void sqlite3_result_text16le(sqlite3_context*, const void*, int,void( *)(void*)); 4693 SQLITE_API void SQLITE_STDCALL sqlite3_result_text16le(sqlite3_context*, const v oid*, int,void(*)(void*));
4517 SQLITE_API void sqlite3_result_text16be(sqlite3_context*, const void*, int,void( *)(void*)); 4694 SQLITE_API void SQLITE_STDCALL sqlite3_result_text16be(sqlite3_context*, const v oid*, int,void(*)(void*));
4518 SQLITE_API void sqlite3_result_value(sqlite3_context*, sqlite3_value*); 4695 SQLITE_API void SQLITE_STDCALL sqlite3_result_value(sqlite3_context*, sqlite3_va lue*);
4519 SQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n); 4696 SQLITE_API void SQLITE_STDCALL sqlite3_result_zeroblob(sqlite3_context*, int n);
4697 SQLITE_API int SQLITE_STDCALL sqlite3_result_zeroblob64(sqlite3_context*, sqlite 3_uint64 n);
4698
4699
4700 /*
4701 ** CAPI3REF: Setting The Subtype Of An SQL Function
4702 ** METHOD: sqlite3_context
4703 **
4704 ** The sqlite3_result_subtype(C,T) function causes the subtype of
4705 ** the result from the [application-defined SQL function] with
4706 ** [sqlite3_context] C to be the value T. Only the lower 8 bits
4707 ** of the subtype T are preserved in current versions of SQLite;
4708 ** higher order bits are discarded.
4709 ** The number of subtype bytes preserved by SQLite might increase
4710 ** in future releases of SQLite.
4711 */
4712 SQLITE_API void SQLITE_STDCALL sqlite3_result_subtype(sqlite3_context*,unsigned int);
4520 4713
4521 /* 4714 /*
4522 ** CAPI3REF: Define New Collating Sequences 4715 ** CAPI3REF: Define New Collating Sequences
4716 ** METHOD: sqlite3
4523 ** 4717 **
4524 ** ^These functions add, remove, or modify a [collation] associated 4718 ** ^These functions add, remove, or modify a [collation] associated
4525 ** with the [database connection] specified as the first argument. 4719 ** with the [database connection] specified as the first argument.
4526 ** 4720 **
4527 ** ^The name of the collation is a UTF-8 string 4721 ** ^The name of the collation is a UTF-8 string
4528 ** for sqlite3_create_collation() and sqlite3_create_collation_v2() 4722 ** for sqlite3_create_collation() and sqlite3_create_collation_v2()
4529 ** and a UTF-16 string in native byte order for sqlite3_create_collation16(). 4723 ** and a UTF-16 string in native byte order for sqlite3_create_collation16().
4530 ** ^Collation names that compare equal according to [sqlite3_strnicmp()] are 4724 ** ^Collation names that compare equal according to [sqlite3_strnicmp()] are
4531 ** considered to be the same name. 4725 ** considered to be the same name.
4532 ** 4726 **
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
4590 ** sqlite3_create_collation_v2() function fails. Applications that invoke 4784 ** sqlite3_create_collation_v2() function fails. Applications that invoke
4591 ** sqlite3_create_collation_v2() with a non-NULL xDestroy argument should 4785 ** sqlite3_create_collation_v2() with a non-NULL xDestroy argument should
4592 ** check the return code and dispose of the application data pointer 4786 ** check the return code and dispose of the application data pointer
4593 ** themselves rather than expecting SQLite to deal with it for them. 4787 ** themselves rather than expecting SQLite to deal with it for them.
4594 ** This is different from every other SQLite interface. The inconsistency 4788 ** This is different from every other SQLite interface. The inconsistency
4595 ** is unfortunate but cannot be changed without breaking backwards 4789 ** is unfortunate but cannot be changed without breaking backwards
4596 ** compatibility. 4790 ** compatibility.
4597 ** 4791 **
4598 ** See also: [sqlite3_collation_needed()] and [sqlite3_collation_needed16()]. 4792 ** See also: [sqlite3_collation_needed()] and [sqlite3_collation_needed16()].
4599 */ 4793 */
4600 SQLITE_API int sqlite3_create_collation( 4794 SQLITE_API int SQLITE_STDCALL sqlite3_create_collation(
4601 sqlite3*, 4795 sqlite3*,
4602 const char *zName, 4796 const char *zName,
4603 int eTextRep, 4797 int eTextRep,
4604 void *pArg, 4798 void *pArg,
4605 int(*xCompare)(void*,int,const void*,int,const void*) 4799 int(*xCompare)(void*,int,const void*,int,const void*)
4606 ); 4800 );
4607 SQLITE_API int sqlite3_create_collation_v2( 4801 SQLITE_API int SQLITE_STDCALL sqlite3_create_collation_v2(
4608 sqlite3*, 4802 sqlite3*,
4609 const char *zName, 4803 const char *zName,
4610 int eTextRep, 4804 int eTextRep,
4611 void *pArg, 4805 void *pArg,
4612 int(*xCompare)(void*,int,const void*,int,const void*), 4806 int(*xCompare)(void*,int,const void*,int,const void*),
4613 void(*xDestroy)(void*) 4807 void(*xDestroy)(void*)
4614 ); 4808 );
4615 SQLITE_API int sqlite3_create_collation16( 4809 SQLITE_API int SQLITE_STDCALL sqlite3_create_collation16(
4616 sqlite3*, 4810 sqlite3*,
4617 const void *zName, 4811 const void *zName,
4618 int eTextRep, 4812 int eTextRep,
4619 void *pArg, 4813 void *pArg,
4620 int(*xCompare)(void*,int,const void*,int,const void*) 4814 int(*xCompare)(void*,int,const void*,int,const void*)
4621 ); 4815 );
4622 4816
4623 /* 4817 /*
4624 ** CAPI3REF: Collation Needed Callbacks 4818 ** CAPI3REF: Collation Needed Callbacks
4819 ** METHOD: sqlite3
4625 ** 4820 **
4626 ** ^To avoid having to register all collation sequences before a database 4821 ** ^To avoid having to register all collation sequences before a database
4627 ** can be used, a single callback function may be registered with the 4822 ** can be used, a single callback function may be registered with the
4628 ** [database connection] to be invoked whenever an undefined collation 4823 ** [database connection] to be invoked whenever an undefined collation
4629 ** sequence is required. 4824 ** sequence is required.
4630 ** 4825 **
4631 ** ^If the function is registered using the sqlite3_collation_needed() API, 4826 ** ^If the function is registered using the sqlite3_collation_needed() API,
4632 ** then it is passed the names of undefined collation sequences as strings 4827 ** then it is passed the names of undefined collation sequences as strings
4633 ** encoded in UTF-8. ^If sqlite3_collation_needed16() is used, 4828 ** encoded in UTF-8. ^If sqlite3_collation_needed16() is used,
4634 ** the names are passed as UTF-16 in machine native byte order. 4829 ** the names are passed as UTF-16 in machine native byte order.
4635 ** ^A call to either function replaces the existing collation-needed callback. 4830 ** ^A call to either function replaces the existing collation-needed callback.
4636 ** 4831 **
4637 ** ^(When the callback is invoked, the first argument passed is a copy 4832 ** ^(When the callback is invoked, the first argument passed is a copy
4638 ** of the second argument to sqlite3_collation_needed() or 4833 ** of the second argument to sqlite3_collation_needed() or
4639 ** sqlite3_collation_needed16(). The second argument is the database 4834 ** sqlite3_collation_needed16(). The second argument is the database
4640 ** connection. The third argument is one of [SQLITE_UTF8], [SQLITE_UTF16BE], 4835 ** connection. The third argument is one of [SQLITE_UTF8], [SQLITE_UTF16BE],
4641 ** or [SQLITE_UTF16LE], indicating the most desirable form of the collation 4836 ** or [SQLITE_UTF16LE], indicating the most desirable form of the collation
4642 ** sequence function required. The fourth parameter is the name of the 4837 ** sequence function required. The fourth parameter is the name of the
4643 ** required collation sequence.)^ 4838 ** required collation sequence.)^
4644 ** 4839 **
4645 ** The callback function should register the desired collation using 4840 ** The callback function should register the desired collation using
4646 ** [sqlite3_create_collation()], [sqlite3_create_collation16()], or 4841 ** [sqlite3_create_collation()], [sqlite3_create_collation16()], or
4647 ** [sqlite3_create_collation_v2()]. 4842 ** [sqlite3_create_collation_v2()].
4648 */ 4843 */
4649 SQLITE_API int sqlite3_collation_needed( 4844 SQLITE_API int SQLITE_STDCALL sqlite3_collation_needed(
4650 sqlite3*, 4845 sqlite3*,
4651 void*, 4846 void*,
4652 void(*)(void*,sqlite3*,int eTextRep,const char*) 4847 void(*)(void*,sqlite3*,int eTextRep,const char*)
4653 ); 4848 );
4654 SQLITE_API int sqlite3_collation_needed16( 4849 SQLITE_API int SQLITE_STDCALL sqlite3_collation_needed16(
4655 sqlite3*, 4850 sqlite3*,
4656 void*, 4851 void*,
4657 void(*)(void*,sqlite3*,int eTextRep,const void*) 4852 void(*)(void*,sqlite3*,int eTextRep,const void*)
4658 ); 4853 );
4659 4854
4660 #ifdef SQLITE_HAS_CODEC 4855 #ifdef SQLITE_HAS_CODEC
4661 /* 4856 /*
4662 ** Specify the key for an encrypted database. This routine should be 4857 ** Specify the key for an encrypted database. This routine should be
4663 ** called right after sqlite3_open(). 4858 ** called right after sqlite3_open().
4664 ** 4859 **
4665 ** The code to implement this API is not available in the public release 4860 ** The code to implement this API is not available in the public release
4666 ** of SQLite. 4861 ** of SQLite.
4667 */ 4862 */
4668 SQLITE_API int sqlite3_key( 4863 SQLITE_API int SQLITE_STDCALL sqlite3_key(
4669 sqlite3 *db, /* Database to be rekeyed */ 4864 sqlite3 *db, /* Database to be rekeyed */
4670 const void *pKey, int nKey /* The key */ 4865 const void *pKey, int nKey /* The key */
4671 ); 4866 );
4672 SQLITE_API int sqlite3_key_v2( 4867 SQLITE_API int SQLITE_STDCALL sqlite3_key_v2(
4673 sqlite3 *db, /* Database to be rekeyed */ 4868 sqlite3 *db, /* Database to be rekeyed */
4674 const char *zDbName, /* Name of the database */ 4869 const char *zDbName, /* Name of the database */
4675 const void *pKey, int nKey /* The key */ 4870 const void *pKey, int nKey /* The key */
4676 ); 4871 );
4677 4872
4678 /* 4873 /*
4679 ** Change the key on an open database. If the current database is not 4874 ** Change the key on an open database. If the current database is not
4680 ** encrypted, this routine will encrypt it. If pNew==0 or nNew==0, the 4875 ** encrypted, this routine will encrypt it. If pNew==0 or nNew==0, the
4681 ** database is decrypted. 4876 ** database is decrypted.
4682 ** 4877 **
4683 ** The code to implement this API is not available in the public release 4878 ** The code to implement this API is not available in the public release
4684 ** of SQLite. 4879 ** of SQLite.
4685 */ 4880 */
4686 SQLITE_API int sqlite3_rekey( 4881 SQLITE_API int SQLITE_STDCALL sqlite3_rekey(
4687 sqlite3 *db, /* Database to be rekeyed */ 4882 sqlite3 *db, /* Database to be rekeyed */
4688 const void *pKey, int nKey /* The new key */ 4883 const void *pKey, int nKey /* The new key */
4689 ); 4884 );
4690 SQLITE_API int sqlite3_rekey_v2( 4885 SQLITE_API int SQLITE_STDCALL sqlite3_rekey_v2(
4691 sqlite3 *db, /* Database to be rekeyed */ 4886 sqlite3 *db, /* Database to be rekeyed */
4692 const char *zDbName, /* Name of the database */ 4887 const char *zDbName, /* Name of the database */
4693 const void *pKey, int nKey /* The new key */ 4888 const void *pKey, int nKey /* The new key */
4694 ); 4889 );
4695 4890
4696 /* 4891 /*
4697 ** Specify the activation key for a SEE database. Unless 4892 ** Specify the activation key for a SEE database. Unless
4698 ** activated, none of the SEE routines will work. 4893 ** activated, none of the SEE routines will work.
4699 */ 4894 */
4700 SQLITE_API void sqlite3_activate_see( 4895 SQLITE_API void SQLITE_STDCALL sqlite3_activate_see(
4701 const char *zPassPhrase /* Activation phrase */ 4896 const char *zPassPhrase /* Activation phrase */
4702 ); 4897 );
4703 #endif 4898 #endif
4704 4899
4705 #ifdef SQLITE_ENABLE_CEROD 4900 #ifdef SQLITE_ENABLE_CEROD
4706 /* 4901 /*
4707 ** Specify the activation key for a CEROD database. Unless 4902 ** Specify the activation key for a CEROD database. Unless
4708 ** activated, none of the CEROD routines will work. 4903 ** activated, none of the CEROD routines will work.
4709 */ 4904 */
4710 SQLITE_API void sqlite3_activate_cerod( 4905 SQLITE_API void SQLITE_STDCALL sqlite3_activate_cerod(
4711 const char *zPassPhrase /* Activation phrase */ 4906 const char *zPassPhrase /* Activation phrase */
4712 ); 4907 );
4713 #endif 4908 #endif
4714 4909
4715 /* 4910 /*
4716 ** CAPI3REF: Suspend Execution For A Short Time 4911 ** CAPI3REF: Suspend Execution For A Short Time
4717 ** 4912 **
4718 ** The sqlite3_sleep() function causes the current thread to suspend execution 4913 ** The sqlite3_sleep() function causes the current thread to suspend execution
4719 ** for at least a number of milliseconds specified in its parameter. 4914 ** for at least a number of milliseconds specified in its parameter.
4720 ** 4915 **
4721 ** If the operating system does not support sleep requests with 4916 ** If the operating system does not support sleep requests with
4722 ** millisecond time resolution, then the time will be rounded up to 4917 ** millisecond time resolution, then the time will be rounded up to
4723 ** the nearest second. The number of milliseconds of sleep actually 4918 ** the nearest second. The number of milliseconds of sleep actually
4724 ** requested from the operating system is returned. 4919 ** requested from the operating system is returned.
4725 ** 4920 **
4726 ** ^SQLite implements this interface by calling the xSleep() 4921 ** ^SQLite implements this interface by calling the xSleep()
4727 ** method of the default [sqlite3_vfs] object. If the xSleep() method 4922 ** method of the default [sqlite3_vfs] object. If the xSleep() method
4728 ** of the default VFS is not implemented correctly, or not implemented at 4923 ** of the default VFS is not implemented correctly, or not implemented at
4729 ** all, then the behavior of sqlite3_sleep() may deviate from the description 4924 ** all, then the behavior of sqlite3_sleep() may deviate from the description
4730 ** in the previous paragraphs. 4925 ** in the previous paragraphs.
4731 */ 4926 */
4732 SQLITE_API int sqlite3_sleep(int); 4927 SQLITE_API int SQLITE_STDCALL sqlite3_sleep(int);
4733 4928
4734 /* 4929 /*
4735 ** CAPI3REF: Name Of The Folder Holding Temporary Files 4930 ** CAPI3REF: Name Of The Folder Holding Temporary Files
4736 ** 4931 **
4737 ** ^(If this global variable is made to point to a string which is 4932 ** ^(If this global variable is made to point to a string which is
4738 ** the name of a folder (a.k.a. directory), then all temporary files 4933 ** the name of a folder (a.k.a. directory), then all temporary files
4739 ** created by SQLite when using a built-in [sqlite3_vfs | VFS] 4934 ** created by SQLite when using a built-in [sqlite3_vfs | VFS]
4740 ** will be placed in that directory.)^ ^If this variable 4935 ** will be placed in that directory.)^ ^If this variable
4741 ** is a NULL pointer, then SQLite performs a search for an appropriate 4936 ** is a NULL pointer, then SQLite performs a search for an appropriate
4742 ** temporary file directory. 4937 ** temporary file directory.
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
4822 ** using [sqlite3_free]. 5017 ** using [sqlite3_free].
4823 ** Hence, if this variable is modified directly, either it should be 5018 ** Hence, if this variable is modified directly, either it should be
4824 ** made NULL or made to point to memory obtained from [sqlite3_malloc] 5019 ** made NULL or made to point to memory obtained from [sqlite3_malloc]
4825 ** or else the use of the [data_store_directory pragma] should be avoided. 5020 ** or else the use of the [data_store_directory pragma] should be avoided.
4826 */ 5021 */
4827 SQLITE_API SQLITE_EXTERN char *sqlite3_data_directory; 5022 SQLITE_API SQLITE_EXTERN char *sqlite3_data_directory;
4828 5023
4829 /* 5024 /*
4830 ** CAPI3REF: Test For Auto-Commit Mode 5025 ** CAPI3REF: Test For Auto-Commit Mode
4831 ** KEYWORDS: {autocommit mode} 5026 ** KEYWORDS: {autocommit mode}
5027 ** METHOD: sqlite3
4832 ** 5028 **
4833 ** ^The sqlite3_get_autocommit() interface returns non-zero or 5029 ** ^The sqlite3_get_autocommit() interface returns non-zero or
4834 ** zero if the given database connection is or is not in autocommit mode, 5030 ** zero if the given database connection is or is not in autocommit mode,
4835 ** respectively. ^Autocommit mode is on by default. 5031 ** respectively. ^Autocommit mode is on by default.
4836 ** ^Autocommit mode is disabled by a [BEGIN] statement. 5032 ** ^Autocommit mode is disabled by a [BEGIN] statement.
4837 ** ^Autocommit mode is re-enabled by a [COMMIT] or [ROLLBACK]. 5033 ** ^Autocommit mode is re-enabled by a [COMMIT] or [ROLLBACK].
4838 ** 5034 **
4839 ** If certain kinds of errors occur on a statement within a multi-statement 5035 ** If certain kinds of errors occur on a statement within a multi-statement
4840 ** transaction (errors including [SQLITE_FULL], [SQLITE_IOERR], 5036 ** transaction (errors including [SQLITE_FULL], [SQLITE_IOERR],
4841 ** [SQLITE_NOMEM], [SQLITE_BUSY], and [SQLITE_INTERRUPT]) then the 5037 ** [SQLITE_NOMEM], [SQLITE_BUSY], and [SQLITE_INTERRUPT]) then the
4842 ** transaction might be rolled back automatically. The only way to 5038 ** transaction might be rolled back automatically. The only way to
4843 ** find out whether SQLite automatically rolled back the transaction after 5039 ** find out whether SQLite automatically rolled back the transaction after
4844 ** an error is to use this function. 5040 ** an error is to use this function.
4845 ** 5041 **
4846 ** If another thread changes the autocommit status of the database 5042 ** If another thread changes the autocommit status of the database
4847 ** connection while this routine is running, then the return value 5043 ** connection while this routine is running, then the return value
4848 ** is undefined. 5044 ** is undefined.
4849 */ 5045 */
4850 SQLITE_API int sqlite3_get_autocommit(sqlite3*); 5046 SQLITE_API int SQLITE_STDCALL sqlite3_get_autocommit(sqlite3*);
4851 5047
4852 /* 5048 /*
4853 ** CAPI3REF: Find The Database Handle Of A Prepared Statement 5049 ** CAPI3REF: Find The Database Handle Of A Prepared Statement
5050 ** METHOD: sqlite3_stmt
4854 ** 5051 **
4855 ** ^The sqlite3_db_handle interface returns the [database connection] handle 5052 ** ^The sqlite3_db_handle interface returns the [database connection] handle
4856 ** to which a [prepared statement] belongs. ^The [database connection] 5053 ** to which a [prepared statement] belongs. ^The [database connection]
4857 ** returned by sqlite3_db_handle is the same [database connection] 5054 ** returned by sqlite3_db_handle is the same [database connection]
4858 ** that was the first argument 5055 ** that was the first argument
4859 ** to the [sqlite3_prepare_v2()] call (or its variants) that was used to 5056 ** to the [sqlite3_prepare_v2()] call (or its variants) that was used to
4860 ** create the statement in the first place. 5057 ** create the statement in the first place.
4861 */ 5058 */
4862 SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*); 5059 SQLITE_API sqlite3 *SQLITE_STDCALL sqlite3_db_handle(sqlite3_stmt*);
4863 5060
4864 /* 5061 /*
4865 ** CAPI3REF: Return The Filename For A Database Connection 5062 ** CAPI3REF: Return The Filename For A Database Connection
5063 ** METHOD: sqlite3
4866 ** 5064 **
4867 ** ^The sqlite3_db_filename(D,N) interface returns a pointer to a filename 5065 ** ^The sqlite3_db_filename(D,N) interface returns a pointer to a filename
4868 ** associated with database N of connection D. ^The main database file 5066 ** associated with database N of connection D. ^The main database file
4869 ** has the name "main". If there is no attached database N on the database 5067 ** has the name "main". If there is no attached database N on the database
4870 ** connection D, or if database N is a temporary or in-memory database, then 5068 ** connection D, or if database N is a temporary or in-memory database, then
4871 ** a NULL pointer is returned. 5069 ** a NULL pointer is returned.
4872 ** 5070 **
4873 ** ^The filename returned by this function is the output of the 5071 ** ^The filename returned by this function is the output of the
4874 ** xFullPathname method of the [VFS]. ^In other words, the filename 5072 ** xFullPathname method of the [VFS]. ^In other words, the filename
4875 ** will be an absolute pathname, even if the filename used 5073 ** will be an absolute pathname, even if the filename used
4876 ** to open the database originally was a URI or relative pathname. 5074 ** to open the database originally was a URI or relative pathname.
4877 */ 5075 */
4878 SQLITE_API const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName); 5076 SQLITE_API const char *SQLITE_STDCALL sqlite3_db_filename(sqlite3 *db, const cha r *zDbName);
4879 5077
4880 /* 5078 /*
4881 ** CAPI3REF: Determine if a database is read-only 5079 ** CAPI3REF: Determine if a database is read-only
5080 ** METHOD: sqlite3
4882 ** 5081 **
4883 ** ^The sqlite3_db_readonly(D,N) interface returns 1 if the database N 5082 ** ^The sqlite3_db_readonly(D,N) interface returns 1 if the database N
4884 ** of connection D is read-only, 0 if it is read/write, or -1 if N is not 5083 ** of connection D is read-only, 0 if it is read/write, or -1 if N is not
4885 ** the name of a database on connection D. 5084 ** the name of a database on connection D.
4886 */ 5085 */
4887 SQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName); 5086 SQLITE_API int SQLITE_STDCALL sqlite3_db_readonly(sqlite3 *db, const char *zDbNa me);
4888 5087
4889 /* 5088 /*
4890 ** CAPI3REF: Find the next prepared statement 5089 ** CAPI3REF: Find the next prepared statement
5090 ** METHOD: sqlite3
4891 ** 5091 **
4892 ** ^This interface returns a pointer to the next [prepared statement] after 5092 ** ^This interface returns a pointer to the next [prepared statement] after
4893 ** pStmt associated with the [database connection] pDb. ^If pStmt is NULL 5093 ** pStmt associated with the [database connection] pDb. ^If pStmt is NULL
4894 ** then this interface returns a pointer to the first prepared statement 5094 ** then this interface returns a pointer to the first prepared statement
4895 ** associated with the database connection pDb. ^If no prepared statement 5095 ** associated with the database connection pDb. ^If no prepared statement
4896 ** satisfies the conditions of this routine, it returns NULL. 5096 ** satisfies the conditions of this routine, it returns NULL.
4897 ** 5097 **
4898 ** The [database connection] pointer D in a call to 5098 ** The [database connection] pointer D in a call to
4899 ** [sqlite3_next_stmt(D,S)] must refer to an open database 5099 ** [sqlite3_next_stmt(D,S)] must refer to an open database
4900 ** connection and in particular must not be a NULL pointer. 5100 ** connection and in particular must not be a NULL pointer.
4901 */ 5101 */
4902 SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt); 5102 SQLITE_API sqlite3_stmt *SQLITE_STDCALL sqlite3_next_stmt(sqlite3 *pDb, sqlite3_ stmt *pStmt);
4903 5103
4904 /* 5104 /*
4905 ** CAPI3REF: Commit And Rollback Notification Callbacks 5105 ** CAPI3REF: Commit And Rollback Notification Callbacks
5106 ** METHOD: sqlite3
4906 ** 5107 **
4907 ** ^The sqlite3_commit_hook() interface registers a callback 5108 ** ^The sqlite3_commit_hook() interface registers a callback
4908 ** function to be invoked whenever a transaction is [COMMIT | committed]. 5109 ** function to be invoked whenever a transaction is [COMMIT | committed].
4909 ** ^Any callback set by a previous call to sqlite3_commit_hook() 5110 ** ^Any callback set by a previous call to sqlite3_commit_hook()
4910 ** for the same database connection is overridden. 5111 ** for the same database connection is overridden.
4911 ** ^The sqlite3_rollback_hook() interface registers a callback 5112 ** ^The sqlite3_rollback_hook() interface registers a callback
4912 ** function to be invoked whenever a transaction is [ROLLBACK | rolled back]. 5113 ** function to be invoked whenever a transaction is [ROLLBACK | rolled back].
4913 ** ^Any callback set by a previous call to sqlite3_rollback_hook() 5114 ** ^Any callback set by a previous call to sqlite3_rollback_hook()
4914 ** for the same database connection is overridden. 5115 ** for the same database connection is overridden.
4915 ** ^The pArg argument is passed through to the callback. 5116 ** ^The pArg argument is passed through to the callback.
(...skipping 24 matching lines...) Expand all
4940 ** hook returning non-zero, just as it would be with any other rollback. 5141 ** hook returning non-zero, just as it would be with any other rollback.
4941 ** 5142 **
4942 ** ^For the purposes of this API, a transaction is said to have been 5143 ** ^For the purposes of this API, a transaction is said to have been
4943 ** rolled back if an explicit "ROLLBACK" statement is executed, or 5144 ** rolled back if an explicit "ROLLBACK" statement is executed, or
4944 ** an error or constraint causes an implicit rollback to occur. 5145 ** an error or constraint causes an implicit rollback to occur.
4945 ** ^The rollback callback is not invoked if a transaction is 5146 ** ^The rollback callback is not invoked if a transaction is
4946 ** automatically rolled back because the database connection is closed. 5147 ** automatically rolled back because the database connection is closed.
4947 ** 5148 **
4948 ** See also the [sqlite3_update_hook()] interface. 5149 ** See also the [sqlite3_update_hook()] interface.
4949 */ 5150 */
4950 SQLITE_API void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*); 5151 SQLITE_API void *SQLITE_STDCALL sqlite3_commit_hook(sqlite3*, int(*)(void*), voi d*);
4951 SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*); 5152 SQLITE_API void *SQLITE_STDCALL sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
4952 5153
4953 /* 5154 /*
4954 ** CAPI3REF: Data Change Notification Callbacks 5155 ** CAPI3REF: Data Change Notification Callbacks
5156 ** METHOD: sqlite3
4955 ** 5157 **
4956 ** ^The sqlite3_update_hook() interface registers a callback function 5158 ** ^The sqlite3_update_hook() interface registers a callback function
4957 ** with the [database connection] identified by the first argument 5159 ** with the [database connection] identified by the first argument
4958 ** to be invoked whenever a row is updated, inserted or deleted in 5160 ** to be invoked whenever a row is updated, inserted or deleted in
4959 ** a rowid table. 5161 ** a rowid table.
4960 ** ^Any callback set by a previous call to this function 5162 ** ^Any callback set by a previous call to this function
4961 ** for the same database connection is overridden. 5163 ** for the same database connection is overridden.
4962 ** 5164 **
4963 ** ^The second argument is a pointer to the function to invoke when a 5165 ** ^The second argument is a pointer to the function to invoke when a
4964 ** row is updated, inserted or deleted in a rowid table. 5166 ** row is updated, inserted or deleted in a rowid table.
(...skipping 26 matching lines...) Expand all
4991 ** database connections for the meaning of "modify" in this paragraph. 5193 ** database connections for the meaning of "modify" in this paragraph.
4992 ** 5194 **
4993 ** ^The sqlite3_update_hook(D,C,P) function 5195 ** ^The sqlite3_update_hook(D,C,P) function
4994 ** returns the P argument from the previous call 5196 ** returns the P argument from the previous call
4995 ** on the same [database connection] D, or NULL for 5197 ** on the same [database connection] D, or NULL for
4996 ** the first call on D. 5198 ** the first call on D.
4997 ** 5199 **
4998 ** See also the [sqlite3_commit_hook()] and [sqlite3_rollback_hook()] 5200 ** See also the [sqlite3_commit_hook()] and [sqlite3_rollback_hook()]
4999 ** interfaces. 5201 ** interfaces.
5000 */ 5202 */
5001 SQLITE_API void *sqlite3_update_hook( 5203 SQLITE_API void *SQLITE_STDCALL sqlite3_update_hook(
5002 sqlite3*, 5204 sqlite3*,
5003 void(*)(void *,int ,char const *,char const *,sqlite3_int64), 5205 void(*)(void *,int ,char const *,char const *,sqlite3_int64),
5004 void* 5206 void*
5005 ); 5207 );
5006 5208
5007 /* 5209 /*
5008 ** CAPI3REF: Enable Or Disable Shared Pager Cache 5210 ** CAPI3REF: Enable Or Disable Shared Pager Cache
5009 ** 5211 **
5010 ** ^(This routine enables or disables the sharing of the database cache 5212 ** ^(This routine enables or disables the sharing of the database cache
5011 ** and schema data structures between [database connection | connections] 5213 ** and schema data structures between [database connection | connections]
5012 ** to the same database. Sharing is enabled if the argument is true 5214 ** to the same database. Sharing is enabled if the argument is true
5013 ** and disabled if the argument is false.)^ 5215 ** and disabled if the argument is false.)^
5014 ** 5216 **
5015 ** ^Cache sharing is enabled and disabled for an entire process. 5217 ** ^Cache sharing is enabled and disabled for an entire process.
5016 ** This is a change as of SQLite version 3.5.0. In prior versions of SQLite, 5218 ** This is a change as of SQLite version 3.5.0. In prior versions of SQLite,
5017 ** sharing was enabled or disabled for each thread separately. 5219 ** sharing was enabled or disabled for each thread separately.
5018 ** 5220 **
5019 ** ^(The cache sharing mode set by this interface effects all subsequent 5221 ** ^(The cache sharing mode set by this interface effects all subsequent
5020 ** calls to [sqlite3_open()], [sqlite3_open_v2()], and [sqlite3_open16()]. 5222 ** calls to [sqlite3_open()], [sqlite3_open_v2()], and [sqlite3_open16()].
5021 ** Existing database connections continue use the sharing mode 5223 ** Existing database connections continue use the sharing mode
5022 ** that was in effect at the time they were opened.)^ 5224 ** that was in effect at the time they were opened.)^
5023 ** 5225 **
5024 ** ^(This routine returns [SQLITE_OK] if shared cache was enabled or disabled 5226 ** ^(This routine returns [SQLITE_OK] if shared cache was enabled or disabled
5025 ** successfully. An [error code] is returned otherwise.)^ 5227 ** successfully. An [error code] is returned otherwise.)^
5026 ** 5228 **
5027 ** ^Shared cache is disabled by default. But this might change in 5229 ** ^Shared cache is disabled by default. But this might change in
5028 ** future releases of SQLite. Applications that care about shared 5230 ** future releases of SQLite. Applications that care about shared
5029 ** cache setting should set it explicitly. 5231 ** cache setting should set it explicitly.
5030 ** 5232 **
5233 ** Note: This method is disabled on MacOS X 10.7 and iOS version 5.0
5234 ** and will always return SQLITE_MISUSE. On those systems,
5235 ** shared cache mode should be enabled per-database connection via
5236 ** [sqlite3_open_v2()] with [SQLITE_OPEN_SHAREDCACHE].
5237 **
5031 ** This interface is threadsafe on processors where writing a 5238 ** This interface is threadsafe on processors where writing a
5032 ** 32-bit integer is atomic. 5239 ** 32-bit integer is atomic.
5033 ** 5240 **
5034 ** See Also: [SQLite Shared-Cache Mode] 5241 ** See Also: [SQLite Shared-Cache Mode]
5035 */ 5242 */
5036 SQLITE_API int sqlite3_enable_shared_cache(int); 5243 SQLITE_API int SQLITE_STDCALL sqlite3_enable_shared_cache(int);
5037 5244
5038 /* 5245 /*
5039 ** CAPI3REF: Attempt To Free Heap Memory 5246 ** CAPI3REF: Attempt To Free Heap Memory
5040 ** 5247 **
5041 ** ^The sqlite3_release_memory() interface attempts to free N bytes 5248 ** ^The sqlite3_release_memory() interface attempts to free N bytes
5042 ** of heap memory by deallocating non-essential memory allocations 5249 ** of heap memory by deallocating non-essential memory allocations
5043 ** held by the database library. Memory used to cache database 5250 ** held by the database library. Memory used to cache database
5044 ** pages to improve performance is an example of non-essential memory. 5251 ** pages to improve performance is an example of non-essential memory.
5045 ** ^sqlite3_release_memory() returns the number of bytes actually freed, 5252 ** ^sqlite3_release_memory() returns the number of bytes actually freed,
5046 ** which might be more or less than the amount requested. 5253 ** which might be more or less than the amount requested.
5047 ** ^The sqlite3_release_memory() routine is a no-op returning zero 5254 ** ^The sqlite3_release_memory() routine is a no-op returning zero
5048 ** if SQLite is not compiled with [SQLITE_ENABLE_MEMORY_MANAGEMENT]. 5255 ** if SQLite is not compiled with [SQLITE_ENABLE_MEMORY_MANAGEMENT].
5049 ** 5256 **
5050 ** See also: [sqlite3_db_release_memory()] 5257 ** See also: [sqlite3_db_release_memory()]
5051 */ 5258 */
5052 SQLITE_API int sqlite3_release_memory(int); 5259 SQLITE_API int SQLITE_STDCALL sqlite3_release_memory(int);
5053 5260
5054 /* 5261 /*
5055 ** CAPI3REF: Free Memory Used By A Database Connection 5262 ** CAPI3REF: Free Memory Used By A Database Connection
5263 ** METHOD: sqlite3
5056 ** 5264 **
5057 ** ^The sqlite3_db_release_memory(D) interface attempts to free as much heap 5265 ** ^The sqlite3_db_release_memory(D) interface attempts to free as much heap
5058 ** memory as possible from database connection D. Unlike the 5266 ** memory as possible from database connection D. Unlike the
5059 ** [sqlite3_release_memory()] interface, this interface is in effect even 5267 ** [sqlite3_release_memory()] interface, this interface is in effect even
5060 ** when the [SQLITE_ENABLE_MEMORY_MANAGEMENT] compile-time option is 5268 ** when the [SQLITE_ENABLE_MEMORY_MANAGEMENT] compile-time option is
5061 ** omitted. 5269 ** omitted.
5062 ** 5270 **
5063 ** See also: [sqlite3_release_memory()] 5271 ** See also: [sqlite3_release_memory()]
5064 */ 5272 */
5065 SQLITE_API int sqlite3_db_release_memory(sqlite3*); 5273 SQLITE_API int SQLITE_STDCALL sqlite3_db_release_memory(sqlite3*);
5066 5274
5067 /* 5275 /*
5068 ** CAPI3REF: Impose A Limit On Heap Size 5276 ** CAPI3REF: Impose A Limit On Heap Size
5069 ** 5277 **
5070 ** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the 5278 ** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the
5071 ** soft limit on the amount of heap memory that may be allocated by SQLite. 5279 ** soft limit on the amount of heap memory that may be allocated by SQLite.
5072 ** ^SQLite strives to keep heap memory utilization below the soft heap 5280 ** ^SQLite strives to keep heap memory utilization below the soft heap
5073 ** limit by reducing the number of pages held in the page cache 5281 ** limit by reducing the number of pages held in the page cache
5074 ** as heap memory usages approaches the limit. 5282 ** as heap memory usages approaches the limit.
5075 ** ^The soft heap limit is "soft" because even though SQLite strives to stay 5283 ** ^The soft heap limit is "soft" because even though SQLite strives to stay
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
5107 ** the soft heap limit is enforced on every memory allocation. Without 5315 ** the soft heap limit is enforced on every memory allocation. Without
5108 ** [SQLITE_ENABLE_MEMORY_MANAGEMENT], the soft heap limit is only enforced 5316 ** [SQLITE_ENABLE_MEMORY_MANAGEMENT], the soft heap limit is only enforced
5109 ** when memory is allocated by the page cache. Testing suggests that because 5317 ** when memory is allocated by the page cache. Testing suggests that because
5110 ** the page cache is the predominate memory user in SQLite, most 5318 ** the page cache is the predominate memory user in SQLite, most
5111 ** applications will achieve adequate soft heap limit enforcement without 5319 ** applications will achieve adequate soft heap limit enforcement without
5112 ** the use of [SQLITE_ENABLE_MEMORY_MANAGEMENT]. 5320 ** the use of [SQLITE_ENABLE_MEMORY_MANAGEMENT].
5113 ** 5321 **
5114 ** The circumstances under which SQLite will enforce the soft heap limit may 5322 ** The circumstances under which SQLite will enforce the soft heap limit may
5115 ** changes in future releases of SQLite. 5323 ** changes in future releases of SQLite.
5116 */ 5324 */
5117 SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N); 5325 SQLITE_API sqlite3_int64 SQLITE_STDCALL sqlite3_soft_heap_limit64(sqlite3_int64 N);
5118 5326
5119 /* 5327 /*
5120 ** CAPI3REF: Deprecated Soft Heap Limit Interface 5328 ** CAPI3REF: Deprecated Soft Heap Limit Interface
5121 ** DEPRECATED 5329 ** DEPRECATED
5122 ** 5330 **
5123 ** This is a deprecated version of the [sqlite3_soft_heap_limit64()] 5331 ** This is a deprecated version of the [sqlite3_soft_heap_limit64()]
5124 ** interface. This routine is provided for historical compatibility 5332 ** interface. This routine is provided for historical compatibility
5125 ** only. All new applications should use the 5333 ** only. All new applications should use the
5126 ** [sqlite3_soft_heap_limit64()] interface rather than this one. 5334 ** [sqlite3_soft_heap_limit64()] interface rather than this one.
5127 */ 5335 */
5128 SQLITE_API SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N); 5336 SQLITE_API SQLITE_DEPRECATED void SQLITE_STDCALL sqlite3_soft_heap_limit(int N);
5129 5337
5130 5338
5131 /* 5339 /*
5132 ** CAPI3REF: Extract Metadata About A Column Of A Table 5340 ** CAPI3REF: Extract Metadata About A Column Of A Table
5341 ** METHOD: sqlite3
5133 ** 5342 **
5134 ** ^This routine returns metadata about a specific column of a specific 5343 ** ^(The sqlite3_table_column_metadata(X,D,T,C,....) routine returns
5135 ** database table accessible using the [database connection] handle 5344 ** information about column C of table T in database D
5136 ** passed as the first function argument. 5345 ** on [database connection] X.)^ ^The sqlite3_table_column_metadata()
5346 ** interface returns SQLITE_OK and fills in the non-NULL pointers in
5347 ** the final five arguments with appropriate values if the specified
5348 ** column exists. ^The sqlite3_table_column_metadata() interface returns
5349 ** SQLITE_ERROR and if the specified column does not exist.
5350 ** ^If the column-name parameter to sqlite3_table_column_metadata() is a
5351 ** NULL pointer, then this routine simply checks for the existance of the
5352 ** table and returns SQLITE_OK if the table exists and SQLITE_ERROR if it
5353 ** does not.
5137 ** 5354 **
5138 ** ^The column is identified by the second, third and fourth parameters to 5355 ** ^The column is identified by the second, third and fourth parameters to
5139 ** this function. ^The second parameter is either the name of the database 5356 ** this function. ^(The second parameter is either the name of the database
5140 ** (i.e. "main", "temp", or an attached database) containing the specified 5357 ** (i.e. "main", "temp", or an attached database) containing the specified
5141 ** table or NULL. ^If it is NULL, then all attached databases are searched 5358 ** table or NULL.)^ ^If it is NULL, then all attached databases are searched
5142 ** for the table using the same algorithm used by the database engine to 5359 ** for the table using the same algorithm used by the database engine to
5143 ** resolve unqualified table references. 5360 ** resolve unqualified table references.
5144 ** 5361 **
5145 ** ^The third and fourth parameters to this function are the table and column 5362 ** ^The third and fourth parameters to this function are the table and column
5146 ** name of the desired column, respectively. Neither of these parameters 5363 ** name of the desired column, respectively.
5147 ** may be NULL.
5148 ** 5364 **
5149 ** ^Metadata is returned by writing to the memory locations passed as the 5th 5365 ** ^Metadata is returned by writing to the memory locations passed as the 5th
5150 ** and subsequent parameters to this function. ^Any of these arguments may be 5366 ** and subsequent parameters to this function. ^Any of these arguments may be
5151 ** NULL, in which case the corresponding element of metadata is omitted. 5367 ** NULL, in which case the corresponding element of metadata is omitted.
5152 ** 5368 **
5153 ** ^(<blockquote> 5369 ** ^(<blockquote>
5154 ** <table border="1"> 5370 ** <table border="1">
5155 ** <tr><th> Parameter <th> Output<br>Type <th> Description 5371 ** <tr><th> Parameter <th> Output<br>Type <th> Description
5156 ** 5372 **
5157 ** <tr><td> 5th <td> const char* <td> Data type 5373 ** <tr><td> 5th <td> const char* <td> Data type
5158 ** <tr><td> 6th <td> const char* <td> Name of default collation sequence 5374 ** <tr><td> 6th <td> const char* <td> Name of default collation sequence
5159 ** <tr><td> 7th <td> int <td> True if column has a NOT NULL constraint 5375 ** <tr><td> 7th <td> int <td> True if column has a NOT NULL constraint
5160 ** <tr><td> 8th <td> int <td> True if column is part of the PRIMARY KEY 5376 ** <tr><td> 8th <td> int <td> True if column is part of the PRIMARY KEY
5161 ** <tr><td> 9th <td> int <td> True if column is [AUTOINCREMENT] 5377 ** <tr><td> 9th <td> int <td> True if column is [AUTOINCREMENT]
5162 ** </table> 5378 ** </table>
5163 ** </blockquote>)^ 5379 ** </blockquote>)^
5164 ** 5380 **
5165 ** ^The memory pointed to by the character pointers returned for the 5381 ** ^The memory pointed to by the character pointers returned for the
5166 ** declaration type and collation sequence is valid only until the next 5382 ** declaration type and collation sequence is valid until the next
5167 ** call to any SQLite API function. 5383 ** call to any SQLite API function.
5168 ** 5384 **
5169 ** ^If the specified table is actually a view, an [error code] is returned. 5385 ** ^If the specified table is actually a view, an [error code] is returned.
5170 ** 5386 **
5171 ** ^If the specified column is "rowid", "oid" or "_rowid_" and an 5387 ** ^If the specified column is "rowid", "oid" or "_rowid_" and the table
5388 ** is not a [WITHOUT ROWID] table and an
5172 ** [INTEGER PRIMARY KEY] column has been explicitly declared, then the output 5389 ** [INTEGER PRIMARY KEY] column has been explicitly declared, then the output
5173 ** parameters are set for the explicitly declared column. ^(If there is no 5390 ** parameters are set for the explicitly declared column. ^(If there is no
5174 ** explicitly declared [INTEGER PRIMARY KEY] column, then the output 5391 ** [INTEGER PRIMARY KEY] column, then the outputs
5175 ** parameters are set as follows: 5392 ** for the [rowid] are set as follows:
5176 ** 5393 **
5177 ** <pre> 5394 ** <pre>
5178 ** data type: "INTEGER" 5395 ** data type: "INTEGER"
5179 ** collation sequence: "BINARY" 5396 ** collation sequence: "BINARY"
5180 ** not null: 0 5397 ** not null: 0
5181 ** primary key: 1 5398 ** primary key: 1
5182 ** auto increment: 0 5399 ** auto increment: 0
5183 ** </pre>)^ 5400 ** </pre>)^
5184 ** 5401 **
5185 ** ^(This function may load one or more schemas from database files. If an 5402 ** ^This function causes all database schemas to be read from disk and
5186 ** error occurs during this process, or if the requested table or column 5403 ** parsed, if that has not already been done, and returns an error if
5187 ** cannot be found, an [error code] is returned and an error message left 5404 ** any errors are encountered while loading the schema.
5188 ** in the [database connection] (to be retrieved using sqlite3_errmsg()).)^
5189 **
5190 ** ^This API is only available if the library was compiled with the
5191 ** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol defined.
5192 */ 5405 */
5193 SQLITE_API int sqlite3_table_column_metadata( 5406 SQLITE_API int SQLITE_STDCALL sqlite3_table_column_metadata(
5194 sqlite3 *db, /* Connection handle */ 5407 sqlite3 *db, /* Connection handle */
5195 const char *zDbName, /* Database name or NULL */ 5408 const char *zDbName, /* Database name or NULL */
5196 const char *zTableName, /* Table name */ 5409 const char *zTableName, /* Table name */
5197 const char *zColumnName, /* Column name */ 5410 const char *zColumnName, /* Column name */
5198 char const **pzDataType, /* OUTPUT: Declared data type */ 5411 char const **pzDataType, /* OUTPUT: Declared data type */
5199 char const **pzCollSeq, /* OUTPUT: Collation sequence name */ 5412 char const **pzCollSeq, /* OUTPUT: Collation sequence name */
5200 int *pNotNull, /* OUTPUT: True if NOT NULL constraint exists */ 5413 int *pNotNull, /* OUTPUT: True if NOT NULL constraint exists */
5201 int *pPrimaryKey, /* OUTPUT: True if column part of PK */ 5414 int *pPrimaryKey, /* OUTPUT: True if column part of PK */
5202 int *pAutoinc /* OUTPUT: True if column is auto-increment */ 5415 int *pAutoinc /* OUTPUT: True if column is auto-increment */
5203 ); 5416 );
5204 5417
5205 /* 5418 /*
5206 ** CAPI3REF: Load An Extension 5419 ** CAPI3REF: Load An Extension
5420 ** METHOD: sqlite3
5207 ** 5421 **
5208 ** ^This interface loads an SQLite extension library from the named file. 5422 ** ^This interface loads an SQLite extension library from the named file.
5209 ** 5423 **
5210 ** ^The sqlite3_load_extension() interface attempts to load an 5424 ** ^The sqlite3_load_extension() interface attempts to load an
5211 ** [SQLite extension] library contained in the file zFile. If 5425 ** [SQLite extension] library contained in the file zFile. If
5212 ** the file cannot be loaded directly, attempts are made to load 5426 ** the file cannot be loaded directly, attempts are made to load
5213 ** with various operating-system specific extensions added. 5427 ** with various operating-system specific extensions added.
5214 ** So for example, if "samplelib" cannot be loaded, then names like 5428 ** So for example, if "samplelib" cannot be loaded, then names like
5215 ** "samplelib.so" or "samplelib.dylib" or "samplelib.dll" might 5429 ** "samplelib.so" or "samplelib.dylib" or "samplelib.dll" might
5216 ** be tried also. 5430 ** be tried also.
(...skipping 12 matching lines...) Expand all
5229 ** fill *pzErrMsg with error message text stored in memory 5443 ** fill *pzErrMsg with error message text stored in memory
5230 ** obtained from [sqlite3_malloc()]. The calling function 5444 ** obtained from [sqlite3_malloc()]. The calling function
5231 ** should free this memory by calling [sqlite3_free()]. 5445 ** should free this memory by calling [sqlite3_free()].
5232 ** 5446 **
5233 ** ^Extension loading must be enabled using 5447 ** ^Extension loading must be enabled using
5234 ** [sqlite3_enable_load_extension()] prior to calling this API, 5448 ** [sqlite3_enable_load_extension()] prior to calling this API,
5235 ** otherwise an error will be returned. 5449 ** otherwise an error will be returned.
5236 ** 5450 **
5237 ** See also the [load_extension() SQL function]. 5451 ** See also the [load_extension() SQL function].
5238 */ 5452 */
5239 SQLITE_API int sqlite3_load_extension( 5453 SQLITE_API int SQLITE_STDCALL sqlite3_load_extension(
5240 sqlite3 *db, /* Load the extension into this database connection */ 5454 sqlite3 *db, /* Load the extension into this database connection */
5241 const char *zFile, /* Name of the shared library containing extension */ 5455 const char *zFile, /* Name of the shared library containing extension */
5242 const char *zProc, /* Entry point. Derived from zFile if 0 */ 5456 const char *zProc, /* Entry point. Derived from zFile if 0 */
5243 char **pzErrMsg /* Put error message here if not 0 */ 5457 char **pzErrMsg /* Put error message here if not 0 */
5244 ); 5458 );
5245 5459
5246 /* 5460 /*
5247 ** CAPI3REF: Enable Or Disable Extension Loading 5461 ** CAPI3REF: Enable Or Disable Extension Loading
5462 ** METHOD: sqlite3
5248 ** 5463 **
5249 ** ^So as not to open security holes in older applications that are 5464 ** ^So as not to open security holes in older applications that are
5250 ** unprepared to deal with [extension loading], and as a means of disabling 5465 ** unprepared to deal with [extension loading], and as a means of disabling
5251 ** [extension loading] while evaluating user-entered SQL, the following API 5466 ** [extension loading] while evaluating user-entered SQL, the following API
5252 ** is provided to turn the [sqlite3_load_extension()] mechanism on and off. 5467 ** is provided to turn the [sqlite3_load_extension()] mechanism on and off.
5253 ** 5468 **
5254 ** ^Extension loading is off by default. 5469 ** ^Extension loading is off by default.
5255 ** ^Call the sqlite3_enable_load_extension() routine with onoff==1 5470 ** ^Call the sqlite3_enable_load_extension() routine with onoff==1
5256 ** to turn extension loading on and call it with onoff==0 to turn 5471 ** to turn extension loading on and call it with onoff==0 to turn
5257 ** it back off again. 5472 ** it back off again.
5258 */ 5473 */
5259 SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff); 5474 SQLITE_API int SQLITE_STDCALL sqlite3_enable_load_extension(sqlite3 *db, int ono ff);
5260 5475
5261 /* 5476 /*
5262 ** CAPI3REF: Automatically Load Statically Linked Extensions 5477 ** CAPI3REF: Automatically Load Statically Linked Extensions
5263 ** 5478 **
5264 ** ^This interface causes the xEntryPoint() function to be invoked for 5479 ** ^This interface causes the xEntryPoint() function to be invoked for
5265 ** each new [database connection] that is created. The idea here is that 5480 ** each new [database connection] that is created. The idea here is that
5266 ** xEntryPoint() is the entry point for a statically linked [SQLite extension] 5481 ** xEntryPoint() is the entry point for a statically linked [SQLite extension]
5267 ** that is to be automatically loaded into all new database connections. 5482 ** that is to be automatically loaded into all new database connections.
5268 ** 5483 **
5269 ** ^(Even though the function prototype shows that xEntryPoint() takes 5484 ** ^(Even though the function prototype shows that xEntryPoint() takes
(...skipping 17 matching lines...) Expand all
5287 ** xEntryPoint() returns an error, the [sqlite3_open()], [sqlite3_open16()], 5502 ** xEntryPoint() returns an error, the [sqlite3_open()], [sqlite3_open16()],
5288 ** or [sqlite3_open_v2()] call that provoked the xEntryPoint() will fail. 5503 ** or [sqlite3_open_v2()] call that provoked the xEntryPoint() will fail.
5289 ** 5504 **
5290 ** ^Calling sqlite3_auto_extension(X) with an entry point X that is already 5505 ** ^Calling sqlite3_auto_extension(X) with an entry point X that is already
5291 ** on the list of automatic extensions is a harmless no-op. ^No entry point 5506 ** on the list of automatic extensions is a harmless no-op. ^No entry point
5292 ** will be called more than once for each database connection that is opened. 5507 ** will be called more than once for each database connection that is opened.
5293 ** 5508 **
5294 ** See also: [sqlite3_reset_auto_extension()] 5509 ** See also: [sqlite3_reset_auto_extension()]
5295 ** and [sqlite3_cancel_auto_extension()] 5510 ** and [sqlite3_cancel_auto_extension()]
5296 */ 5511 */
5297 SQLITE_API int sqlite3_auto_extension(void (*xEntryPoint)(void)); 5512 SQLITE_API int SQLITE_STDCALL sqlite3_auto_extension(void (*xEntryPoint)(void));
5298 5513
5299 /* 5514 /*
5300 ** CAPI3REF: Cancel Automatic Extension Loading 5515 ** CAPI3REF: Cancel Automatic Extension Loading
5301 ** 5516 **
5302 ** ^The [sqlite3_cancel_auto_extension(X)] interface unregisters the 5517 ** ^The [sqlite3_cancel_auto_extension(X)] interface unregisters the
5303 ** initialization routine X that was registered using a prior call to 5518 ** initialization routine X that was registered using a prior call to
5304 ** [sqlite3_auto_extension(X)]. ^The [sqlite3_cancel_auto_extension(X)] 5519 ** [sqlite3_auto_extension(X)]. ^The [sqlite3_cancel_auto_extension(X)]
5305 ** routine returns 1 if initialization routine X was successfully 5520 ** routine returns 1 if initialization routine X was successfully
5306 ** unregistered and it returns 0 if X was not on the list of initialization 5521 ** unregistered and it returns 0 if X was not on the list of initialization
5307 ** routines. 5522 ** routines.
5308 */ 5523 */
5309 SQLITE_API int sqlite3_cancel_auto_extension(void (*xEntryPoint)(void)); 5524 SQLITE_API int SQLITE_STDCALL sqlite3_cancel_auto_extension(void (*xEntryPoint)( void));
5310 5525
5311 /* 5526 /*
5312 ** CAPI3REF: Reset Automatic Extension Loading 5527 ** CAPI3REF: Reset Automatic Extension Loading
5313 ** 5528 **
5314 ** ^This interface disables all automatic extensions previously 5529 ** ^This interface disables all automatic extensions previously
5315 ** registered using [sqlite3_auto_extension()]. 5530 ** registered using [sqlite3_auto_extension()].
5316 */ 5531 */
5317 SQLITE_API void sqlite3_reset_auto_extension(void); 5532 SQLITE_API void SQLITE_STDCALL sqlite3_reset_auto_extension(void);
5318 5533
5319 /* 5534 /*
5320 ** The interface to the virtual-table mechanism is currently considered 5535 ** The interface to the virtual-table mechanism is currently considered
5321 ** to be experimental. The interface might change in incompatible ways. 5536 ** to be experimental. The interface might change in incompatible ways.
5322 ** If this is a problem for you, do not use the interface at this time. 5537 ** If this is a problem for you, do not use the interface at this time.
5323 ** 5538 **
5324 ** When the virtual-table mechanism stabilizes, we will declare the 5539 ** When the virtual-table mechanism stabilizes, we will declare the
5325 ** interface fixed, support it indefinitely, and remove this comment. 5540 ** interface fixed, support it indefinitely, and remove this comment.
5326 */ 5541 */
5327 5542
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
5409 ** 5624 **
5410 ** ^The optimizer automatically inverts terms of the form "expr OP column" 5625 ** ^The optimizer automatically inverts terms of the form "expr OP column"
5411 ** and makes other simplifications to the WHERE clause in an attempt to 5626 ** and makes other simplifications to the WHERE clause in an attempt to
5412 ** get as many WHERE clause terms into the form shown above as possible. 5627 ** get as many WHERE clause terms into the form shown above as possible.
5413 ** ^The aConstraint[] array only reports WHERE clause terms that are 5628 ** ^The aConstraint[] array only reports WHERE clause terms that are
5414 ** relevant to the particular virtual table being queried. 5629 ** relevant to the particular virtual table being queried.
5415 ** 5630 **
5416 ** ^Information about the ORDER BY clause is stored in aOrderBy[]. 5631 ** ^Information about the ORDER BY clause is stored in aOrderBy[].
5417 ** ^Each term of aOrderBy records a column of the ORDER BY clause. 5632 ** ^Each term of aOrderBy records a column of the ORDER BY clause.
5418 ** 5633 **
5634 ** The colUsed field indicates which columns of the virtual table may be
5635 ** required by the current scan. Virtual table columns are numbered from
5636 ** zero in the order in which they appear within the CREATE TABLE statement
5637 ** passed to sqlite3_declare_vtab(). For the first 63 columns (columns 0-62),
5638 ** the corresponding bit is set within the colUsed mask if the column may be
5639 ** required by SQLite. If the table has at least 64 columns and any column
5640 ** to the right of the first 63 is required, then bit 63 of colUsed is also
5641 ** set. In other words, column iCol may be required if the expression
5642 ** (colUsed & ((sqlite3_uint64)1 << (iCol>=63 ? 63 : iCol))) evaluates to
5643 ** non-zero.
5644 **
5419 ** The [xBestIndex] method must fill aConstraintUsage[] with information 5645 ** The [xBestIndex] method must fill aConstraintUsage[] with information
5420 ** about what parameters to pass to xFilter. ^If argvIndex>0 then 5646 ** about what parameters to pass to xFilter. ^If argvIndex>0 then
5421 ** the right-hand side of the corresponding aConstraint[] is evaluated 5647 ** the right-hand side of the corresponding aConstraint[] is evaluated
5422 ** and becomes the argvIndex-th entry in argv. ^(If aConstraintUsage[].omit 5648 ** and becomes the argvIndex-th entry in argv. ^(If aConstraintUsage[].omit
5423 ** is true, then the constraint is assumed to be fully handled by the 5649 ** is true, then the constraint is assumed to be fully handled by the
5424 ** virtual table and is not checked again by SQLite.)^ 5650 ** virtual table and is not checked again by SQLite.)^
5425 ** 5651 **
5426 ** ^The idxNum and idxPtr values are recorded and passed into the 5652 ** ^The idxNum and idxPtr values are recorded and passed into the
5427 ** [xFilter] method. 5653 ** [xFilter] method.
5428 ** ^[sqlite3_free()] is used to free idxPtr if and only if 5654 ** ^[sqlite3_free()] is used to free idxPtr if and only if
5429 ** needToFreeIdxPtr is true. 5655 ** needToFreeIdxPtr is true.
5430 ** 5656 **
5431 ** ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in 5657 ** ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in
5432 ** the correct order to satisfy the ORDER BY clause so that no separate 5658 ** the correct order to satisfy the ORDER BY clause so that no separate
5433 ** sorting step is required. 5659 ** sorting step is required.
5434 ** 5660 **
5435 ** ^The estimatedCost value is an estimate of the cost of a particular 5661 ** ^The estimatedCost value is an estimate of the cost of a particular
5436 ** strategy. A cost of N indicates that the cost of the strategy is similar 5662 ** strategy. A cost of N indicates that the cost of the strategy is similar
5437 ** to a linear scan of an SQLite table with N rows. A cost of log(N) 5663 ** to a linear scan of an SQLite table with N rows. A cost of log(N)
5438 ** indicates that the expense of the operation is similar to that of a 5664 ** indicates that the expense of the operation is similar to that of a
5439 ** binary search on a unique indexed field of an SQLite table with N rows. 5665 ** binary search on a unique indexed field of an SQLite table with N rows.
5440 ** 5666 **
5441 ** ^The estimatedRows value is an estimate of the number of rows that 5667 ** ^The estimatedRows value is an estimate of the number of rows that
5442 ** will be returned by the strategy. 5668 ** will be returned by the strategy.
5443 ** 5669 **
5670 ** The xBestIndex method may optionally populate the idxFlags field with a
5671 ** mask of SQLITE_INDEX_SCAN_* flags. Currently there is only one such flag -
5672 ** SQLITE_INDEX_SCAN_UNIQUE. If the xBestIndex method sets this flag, SQLite
5673 ** assumes that the strategy may visit at most one row.
5674 **
5675 ** Additionally, if xBestIndex sets the SQLITE_INDEX_SCAN_UNIQUE flag, then
5676 ** SQLite also assumes that if a call to the xUpdate() method is made as
5677 ** part of the same statement to delete or update a virtual table row and the
5678 ** implementation returns SQLITE_CONSTRAINT, then there is no need to rollback
5679 ** any database changes. In other words, if the xUpdate() returns
5680 ** SQLITE_CONSTRAINT, the database contents must be exactly as they were
5681 ** before xUpdate was called. By contrast, if SQLITE_INDEX_SCAN_UNIQUE is not
5682 ** set and xUpdate returns SQLITE_CONSTRAINT, any database changes made by
5683 ** the xUpdate method are automatically rolled back by SQLite.
5684 **
5444 ** IMPORTANT: The estimatedRows field was added to the sqlite3_index_info 5685 ** IMPORTANT: The estimatedRows field was added to the sqlite3_index_info
5445 ** structure for SQLite version 3.8.2. If a virtual table extension is 5686 ** structure for SQLite version 3.8.2. If a virtual table extension is
5446 ** used with an SQLite version earlier than 3.8.2, the results of attempting 5687 ** used with an SQLite version earlier than 3.8.2, the results of attempting
5447 ** to read or write the estimatedRows field are undefined (but are likely 5688 ** to read or write the estimatedRows field are undefined (but are likely
5448 ** to included crashing the application). The estimatedRows field should 5689 ** to included crashing the application). The estimatedRows field should
5449 ** therefore only be used if [sqlite3_libversion_number()] returns a 5690 ** therefore only be used if [sqlite3_libversion_number()] returns a
5450 ** value greater than or equal to 3008002. 5691 ** value greater than or equal to 3008002. Similarly, the idxFlags field
5692 ** was added for version 3.9.0. It may therefore only be used if
5693 ** sqlite3_libversion_number() returns a value greater than or equal to
5694 ** 3009000.
5451 */ 5695 */
5452 struct sqlite3_index_info { 5696 struct sqlite3_index_info {
5453 /* Inputs */ 5697 /* Inputs */
5454 int nConstraint; /* Number of entries in aConstraint */ 5698 int nConstraint; /* Number of entries in aConstraint */
5455 struct sqlite3_index_constraint { 5699 struct sqlite3_index_constraint {
5456 int iColumn; /* Column on left-hand side of constraint */ 5700 int iColumn; /* Column on left-hand side of constraint */
5457 unsigned char op; /* Constraint operator */ 5701 unsigned char op; /* Constraint operator */
5458 unsigned char usable; /* True if this constraint is usable */ 5702 unsigned char usable; /* True if this constraint is usable */
5459 int iTermOffset; /* Used internally - xBestIndex should ignore */ 5703 int iTermOffset; /* Used internally - xBestIndex should ignore */
5460 } *aConstraint; /* Table of WHERE clause constraints */ 5704 } *aConstraint; /* Table of WHERE clause constraints */
5461 int nOrderBy; /* Number of terms in the ORDER BY clause */ 5705 int nOrderBy; /* Number of terms in the ORDER BY clause */
5462 struct sqlite3_index_orderby { 5706 struct sqlite3_index_orderby {
5463 int iColumn; /* Column number */ 5707 int iColumn; /* Column number */
5464 unsigned char desc; /* True for DESC. False for ASC. */ 5708 unsigned char desc; /* True for DESC. False for ASC. */
5465 } *aOrderBy; /* The ORDER BY clause */ 5709 } *aOrderBy; /* The ORDER BY clause */
5466 /* Outputs */ 5710 /* Outputs */
5467 struct sqlite3_index_constraint_usage { 5711 struct sqlite3_index_constraint_usage {
5468 int argvIndex; /* if >0, constraint is part of argv to xFilter */ 5712 int argvIndex; /* if >0, constraint is part of argv to xFilter */
5469 unsigned char omit; /* Do not code a test for this constraint */ 5713 unsigned char omit; /* Do not code a test for this constraint */
5470 } *aConstraintUsage; 5714 } *aConstraintUsage;
5471 int idxNum; /* Number used to identify the index */ 5715 int idxNum; /* Number used to identify the index */
5472 char *idxStr; /* String, possibly obtained from sqlite3_malloc */ 5716 char *idxStr; /* String, possibly obtained from sqlite3_malloc */
5473 int needToFreeIdxStr; /* Free idxStr using sqlite3_free() if true */ 5717 int needToFreeIdxStr; /* Free idxStr using sqlite3_free() if true */
5474 int orderByConsumed; /* True if output is already ordered */ 5718 int orderByConsumed; /* True if output is already ordered */
5475 double estimatedCost; /* Estimated cost of using this index */ 5719 double estimatedCost; /* Estimated cost of using this index */
5476 /* Fields below are only available in SQLite 3.8.2 and later */ 5720 /* Fields below are only available in SQLite 3.8.2 and later */
5477 sqlite3_int64 estimatedRows; /* Estimated number of rows returned */ 5721 sqlite3_int64 estimatedRows; /* Estimated number of rows returned */
5722 /* Fields below are only available in SQLite 3.9.0 and later */
5723 int idxFlags; /* Mask of SQLITE_INDEX_SCAN_* flags */
5724 /* Fields below are only available in SQLite 3.10.0 and later */
5725 sqlite3_uint64 colUsed; /* Input: Mask of columns used by statement */
5478 }; 5726 };
5479 5727
5480 /* 5728 /*
5729 ** CAPI3REF: Virtual Table Scan Flags
5730 */
5731 #define SQLITE_INDEX_SCAN_UNIQUE 1 /* Scan visits at most 1 row */
5732
5733 /*
5481 ** CAPI3REF: Virtual Table Constraint Operator Codes 5734 ** CAPI3REF: Virtual Table Constraint Operator Codes
5482 ** 5735 **
5483 ** These macros defined the allowed values for the 5736 ** These macros defined the allowed values for the
5484 ** [sqlite3_index_info].aConstraint[].op field. Each value represents 5737 ** [sqlite3_index_info].aConstraint[].op field. Each value represents
5485 ** an operator that is part of a constraint term in the wHERE clause of 5738 ** an operator that is part of a constraint term in the wHERE clause of
5486 ** a query that uses a [virtual table]. 5739 ** a query that uses a [virtual table].
5487 */ 5740 */
5488 #define SQLITE_INDEX_CONSTRAINT_EQ 2 5741 #define SQLITE_INDEX_CONSTRAINT_EQ 2
5489 #define SQLITE_INDEX_CONSTRAINT_GT 4 5742 #define SQLITE_INDEX_CONSTRAINT_GT 4
5490 #define SQLITE_INDEX_CONSTRAINT_LE 8 5743 #define SQLITE_INDEX_CONSTRAINT_LE 8
5491 #define SQLITE_INDEX_CONSTRAINT_LT 16 5744 #define SQLITE_INDEX_CONSTRAINT_LT 16
5492 #define SQLITE_INDEX_CONSTRAINT_GE 32 5745 #define SQLITE_INDEX_CONSTRAINT_GE 32
5493 #define SQLITE_INDEX_CONSTRAINT_MATCH 64 5746 #define SQLITE_INDEX_CONSTRAINT_MATCH 64
5747 #define SQLITE_INDEX_CONSTRAINT_LIKE 65
5748 #define SQLITE_INDEX_CONSTRAINT_GLOB 66
5749 #define SQLITE_INDEX_CONSTRAINT_REGEXP 67
5494 5750
5495 /* 5751 /*
5496 ** CAPI3REF: Register A Virtual Table Implementation 5752 ** CAPI3REF: Register A Virtual Table Implementation
5753 ** METHOD: sqlite3
5497 ** 5754 **
5498 ** ^These routines are used to register a new [virtual table module] name. 5755 ** ^These routines are used to register a new [virtual table module] name.
5499 ** ^Module names must be registered before 5756 ** ^Module names must be registered before
5500 ** creating a new [virtual table] using the module and before using a 5757 ** creating a new [virtual table] using the module and before using a
5501 ** preexisting [virtual table] for the module. 5758 ** preexisting [virtual table] for the module.
5502 ** 5759 **
5503 ** ^The module name is registered on the [database connection] specified 5760 ** ^The module name is registered on the [database connection] specified
5504 ** by the first parameter. ^The name of the module is given by the 5761 ** by the first parameter. ^The name of the module is given by the
5505 ** second parameter. ^The third parameter is a pointer to 5762 ** second parameter. ^The third parameter is a pointer to
5506 ** the implementation of the [virtual table module]. ^The fourth 5763 ** the implementation of the [virtual table module]. ^The fourth
5507 ** parameter is an arbitrary client data pointer that is passed through 5764 ** parameter is an arbitrary client data pointer that is passed through
5508 ** into the [xCreate] and [xConnect] methods of the virtual table module 5765 ** into the [xCreate] and [xConnect] methods of the virtual table module
5509 ** when a new virtual table is be being created or reinitialized. 5766 ** when a new virtual table is be being created or reinitialized.
5510 ** 5767 **
5511 ** ^The sqlite3_create_module_v2() interface has a fifth parameter which 5768 ** ^The sqlite3_create_module_v2() interface has a fifth parameter which
5512 ** is a pointer to a destructor for the pClientData. ^SQLite will 5769 ** is a pointer to a destructor for the pClientData. ^SQLite will
5513 ** invoke the destructor function (if it is not NULL) when SQLite 5770 ** invoke the destructor function (if it is not NULL) when SQLite
5514 ** no longer needs the pClientData pointer. ^The destructor will also 5771 ** no longer needs the pClientData pointer. ^The destructor will also
5515 ** be invoked if the call to sqlite3_create_module_v2() fails. 5772 ** be invoked if the call to sqlite3_create_module_v2() fails.
5516 ** ^The sqlite3_create_module() 5773 ** ^The sqlite3_create_module()
5517 ** interface is equivalent to sqlite3_create_module_v2() with a NULL 5774 ** interface is equivalent to sqlite3_create_module_v2() with a NULL
5518 ** destructor. 5775 ** destructor.
5519 */ 5776 */
5520 SQLITE_API int sqlite3_create_module( 5777 SQLITE_API int SQLITE_STDCALL sqlite3_create_module(
5521 sqlite3 *db, /* SQLite connection to register module with */ 5778 sqlite3 *db, /* SQLite connection to register module with */
5522 const char *zName, /* Name of the module */ 5779 const char *zName, /* Name of the module */
5523 const sqlite3_module *p, /* Methods for the module */ 5780 const sqlite3_module *p, /* Methods for the module */
5524 void *pClientData /* Client data for xCreate/xConnect */ 5781 void *pClientData /* Client data for xCreate/xConnect */
5525 ); 5782 );
5526 SQLITE_API int sqlite3_create_module_v2( 5783 SQLITE_API int SQLITE_STDCALL sqlite3_create_module_v2(
5527 sqlite3 *db, /* SQLite connection to register module with */ 5784 sqlite3 *db, /* SQLite connection to register module with */
5528 const char *zName, /* Name of the module */ 5785 const char *zName, /* Name of the module */
5529 const sqlite3_module *p, /* Methods for the module */ 5786 const sqlite3_module *p, /* Methods for the module */
5530 void *pClientData, /* Client data for xCreate/xConnect */ 5787 void *pClientData, /* Client data for xCreate/xConnect */
5531 void(*xDestroy)(void*) /* Module destructor function */ 5788 void(*xDestroy)(void*) /* Module destructor function */
5532 ); 5789 );
5533 5790
5534 /* 5791 /*
5535 ** CAPI3REF: Virtual Table Instance Object 5792 ** CAPI3REF: Virtual Table Instance Object
5536 ** KEYWORDS: sqlite3_vtab 5793 ** KEYWORDS: sqlite3_vtab
5537 ** 5794 **
5538 ** Every [virtual table module] implementation uses a subclass 5795 ** Every [virtual table module] implementation uses a subclass
5539 ** of this object to describe a particular instance 5796 ** of this object to describe a particular instance
5540 ** of the [virtual table]. Each subclass will 5797 ** of the [virtual table]. Each subclass will
5541 ** be tailored to the specific needs of the module implementation. 5798 ** be tailored to the specific needs of the module implementation.
5542 ** The purpose of this superclass is to define certain fields that are 5799 ** The purpose of this superclass is to define certain fields that are
5543 ** common to all module implementations. 5800 ** common to all module implementations.
5544 ** 5801 **
5545 ** ^Virtual tables methods can set an error message by assigning a 5802 ** ^Virtual tables methods can set an error message by assigning a
5546 ** string obtained from [sqlite3_mprintf()] to zErrMsg. The method should 5803 ** string obtained from [sqlite3_mprintf()] to zErrMsg. The method should
5547 ** take care that any prior string is freed by a call to [sqlite3_free()] 5804 ** take care that any prior string is freed by a call to [sqlite3_free()]
5548 ** prior to assigning a new string to zErrMsg. ^After the error message 5805 ** prior to assigning a new string to zErrMsg. ^After the error message
5549 ** is delivered up to the client application, the string will be automatically 5806 ** is delivered up to the client application, the string will be automatically
5550 ** freed by sqlite3_free() and the zErrMsg field will be zeroed. 5807 ** freed by sqlite3_free() and the zErrMsg field will be zeroed.
5551 */ 5808 */
5552 struct sqlite3_vtab { 5809 struct sqlite3_vtab {
5553 const sqlite3_module *pModule; /* The module for this virtual table */ 5810 const sqlite3_module *pModule; /* The module for this virtual table */
5554 int nRef; /* NO LONGER USED */ 5811 int nRef; /* Number of open cursors */
5555 char *zErrMsg; /* Error message from sqlite3_mprintf() */ 5812 char *zErrMsg; /* Error message from sqlite3_mprintf() */
5556 /* Virtual table implementations will typically add additional fields */ 5813 /* Virtual table implementations will typically add additional fields */
5557 }; 5814 };
5558 5815
5559 /* 5816 /*
5560 ** CAPI3REF: Virtual Table Cursor Object 5817 ** CAPI3REF: Virtual Table Cursor Object
5561 ** KEYWORDS: sqlite3_vtab_cursor {virtual table cursor} 5818 ** KEYWORDS: sqlite3_vtab_cursor {virtual table cursor}
5562 ** 5819 **
5563 ** Every [virtual table module] implementation uses a subclass of the 5820 ** Every [virtual table module] implementation uses a subclass of the
5564 ** following structure to describe cursors that point into the 5821 ** following structure to describe cursors that point into the
(...skipping 14 matching lines...) Expand all
5579 }; 5836 };
5580 5837
5581 /* 5838 /*
5582 ** CAPI3REF: Declare The Schema Of A Virtual Table 5839 ** CAPI3REF: Declare The Schema Of A Virtual Table
5583 ** 5840 **
5584 ** ^The [xCreate] and [xConnect] methods of a 5841 ** ^The [xCreate] and [xConnect] methods of a
5585 ** [virtual table module] call this interface 5842 ** [virtual table module] call this interface
5586 ** to declare the format (the names and datatypes of the columns) of 5843 ** to declare the format (the names and datatypes of the columns) of
5587 ** the virtual tables they implement. 5844 ** the virtual tables they implement.
5588 */ 5845 */
5589 SQLITE_API int sqlite3_declare_vtab(sqlite3*, const char *zSQL); 5846 SQLITE_API int SQLITE_STDCALL sqlite3_declare_vtab(sqlite3*, const char *zSQL);
5590 5847
5591 /* 5848 /*
5592 ** CAPI3REF: Overload A Function For A Virtual Table 5849 ** CAPI3REF: Overload A Function For A Virtual Table
5850 ** METHOD: sqlite3
5593 ** 5851 **
5594 ** ^(Virtual tables can provide alternative implementations of functions 5852 ** ^(Virtual tables can provide alternative implementations of functions
5595 ** using the [xFindFunction] method of the [virtual table module]. 5853 ** using the [xFindFunction] method of the [virtual table module].
5596 ** But global versions of those functions 5854 ** But global versions of those functions
5597 ** must exist in order to be overloaded.)^ 5855 ** must exist in order to be overloaded.)^
5598 ** 5856 **
5599 ** ^(This API makes sure a global version of a function with a particular 5857 ** ^(This API makes sure a global version of a function with a particular
5600 ** name and number of parameters exists. If no such function exists 5858 ** name and number of parameters exists. If no such function exists
5601 ** before this API is called, a new function is created.)^ ^The implementation 5859 ** before this API is called, a new function is created.)^ ^The implementation
5602 ** of the new function always causes an exception to be thrown. So 5860 ** of the new function always causes an exception to be thrown. So
5603 ** the new function is not good for anything by itself. Its only 5861 ** the new function is not good for anything by itself. Its only
5604 ** purpose is to be a placeholder function that can be overloaded 5862 ** purpose is to be a placeholder function that can be overloaded
5605 ** by a [virtual table]. 5863 ** by a [virtual table].
5606 */ 5864 */
5607 SQLITE_API int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nA rg); 5865 SQLITE_API int SQLITE_STDCALL sqlite3_overload_function(sqlite3*, const char *zF uncName, int nArg);
5608 5866
5609 /* 5867 /*
5610 ** The interface to the virtual-table mechanism defined above (back up 5868 ** The interface to the virtual-table mechanism defined above (back up
5611 ** to a comment remarkably similar to this one) is currently considered 5869 ** to a comment remarkably similar to this one) is currently considered
5612 ** to be experimental. The interface might change in incompatible ways. 5870 ** to be experimental. The interface might change in incompatible ways.
5613 ** If this is a problem for you, do not use the interface at this time. 5871 ** If this is a problem for you, do not use the interface at this time.
5614 ** 5872 **
5615 ** When the virtual-table mechanism stabilizes, we will declare the 5873 ** When the virtual-table mechanism stabilizes, we will declare the
5616 ** interface fixed, support it indefinitely, and remove this comment. 5874 ** interface fixed, support it indefinitely, and remove this comment.
5617 */ 5875 */
5618 5876
5619 /* 5877 /*
5620 ** CAPI3REF: A Handle To An Open BLOB 5878 ** CAPI3REF: A Handle To An Open BLOB
5621 ** KEYWORDS: {BLOB handle} {BLOB handles} 5879 ** KEYWORDS: {BLOB handle} {BLOB handles}
5622 ** 5880 **
5623 ** An instance of this object represents an open BLOB on which 5881 ** An instance of this object represents an open BLOB on which
5624 ** [sqlite3_blob_open | incremental BLOB I/O] can be performed. 5882 ** [sqlite3_blob_open | incremental BLOB I/O] can be performed.
5625 ** ^Objects of this type are created by [sqlite3_blob_open()] 5883 ** ^Objects of this type are created by [sqlite3_blob_open()]
5626 ** and destroyed by [sqlite3_blob_close()]. 5884 ** and destroyed by [sqlite3_blob_close()].
5627 ** ^The [sqlite3_blob_read()] and [sqlite3_blob_write()] interfaces 5885 ** ^The [sqlite3_blob_read()] and [sqlite3_blob_write()] interfaces
5628 ** can be used to read or write small subsections of the BLOB. 5886 ** can be used to read or write small subsections of the BLOB.
5629 ** ^The [sqlite3_blob_bytes()] interface returns the size of the BLOB in bytes. 5887 ** ^The [sqlite3_blob_bytes()] interface returns the size of the BLOB in bytes.
5630 */ 5888 */
5631 typedef struct sqlite3_blob sqlite3_blob; 5889 typedef struct sqlite3_blob sqlite3_blob;
5632 5890
5633 /* 5891 /*
5634 ** CAPI3REF: Open A BLOB For Incremental I/O 5892 ** CAPI3REF: Open A BLOB For Incremental I/O
5893 ** METHOD: sqlite3
5894 ** CONSTRUCTOR: sqlite3_blob
5635 ** 5895 **
5636 ** ^(This interfaces opens a [BLOB handle | handle] to the BLOB located 5896 ** ^(This interfaces opens a [BLOB handle | handle] to the BLOB located
5637 ** in row iRow, column zColumn, table zTable in database zDb; 5897 ** in row iRow, column zColumn, table zTable in database zDb;
5638 ** in other words, the same BLOB that would be selected by: 5898 ** in other words, the same BLOB that would be selected by:
5639 ** 5899 **
5640 ** <pre> 5900 ** <pre>
5641 ** SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow; 5901 ** SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;
5642 ** </pre>)^ 5902 ** </pre>)^
5643 ** 5903 **
5904 ** ^(Parameter zDb is not the filename that contains the database, but
5905 ** rather the symbolic name of the database. For attached databases, this is
5906 ** the name that appears after the AS keyword in the [ATTACH] statement.
5907 ** For the main database file, the database name is "main". For TEMP
5908 ** tables, the database name is "temp".)^
5909 **
5644 ** ^If the flags parameter is non-zero, then the BLOB is opened for read 5910 ** ^If the flags parameter is non-zero, then the BLOB is opened for read
5645 ** and write access. ^If it is zero, the BLOB is opened for read access. 5911 ** and write access. ^If the flags parameter is zero, the BLOB is opened for
5646 ** ^It is not possible to open a column that is part of an index or primary 5912 ** read-only access.
5647 ** key for writing. ^If [foreign key constraints] are enabled, it is
5648 ** not possible to open a column that is part of a [child key] for writing.
5649 ** 5913 **
5650 ** ^Note that the database name is not the filename that contains 5914 ** ^(On success, [SQLITE_OK] is returned and the new [BLOB handle] is stored
5651 ** the database but rather the symbolic name of the database that 5915 ** in *ppBlob. Otherwise an [error code] is returned and, unless the error
5652 ** appears after the AS keyword when the database is connected using [ATTACH]. 5916 ** code is SQLITE_MISUSE, *ppBlob is set to NULL.)^ ^This means that, provided
5653 ** ^For the main database file, the database name is "main". 5917 ** the API is not misused, it is always safe to call [sqlite3_blob_close()]
5654 ** ^For TEMP tables, the database name is "temp". 5918 ** on *ppBlob after this function it returns.
5655 ** 5919 **
5656 ** ^(On success, [SQLITE_OK] is returned and the new [BLOB handle] is written 5920 ** This function fails with SQLITE_ERROR if any of the following are true:
5657 ** to *ppBlob. Otherwise an [error code] is returned and *ppBlob is set 5921 ** <ul>
5658 ** to be a null pointer.)^ 5922 ** <li> ^(Database zDb does not exist)^,
5659 ** ^This function sets the [database connection] error code and message 5923 ** <li> ^(Table zTable does not exist within database zDb)^,
5660 ** accessible via [sqlite3_errcode()] and [sqlite3_errmsg()] and related 5924 ** <li> ^(Table zTable is a WITHOUT ROWID table)^,
5661 ** functions. ^Note that the *ppBlob variable is always initialized in a 5925 ** <li> ^(Column zColumn does not exist)^,
5662 ** way that makes it safe to invoke [sqlite3_blob_close()] on *ppBlob 5926 ** <li> ^(Row iRow is not present in the table)^,
5663 ** regardless of the success or failure of this routine. 5927 ** <li> ^(The specified column of row iRow contains a value that is not
5928 ** a TEXT or BLOB value)^,
5929 ** <li> ^(Column zColumn is part of an index, PRIMARY KEY or UNIQUE
5930 ** constraint and the blob is being opened for read/write access)^,
5931 ** <li> ^([foreign key constraints | Foreign key constraints] are enabled,
5932 ** column zColumn is part of a [child key] definition and the blob is
5933 ** being opened for read/write access)^.
5934 ** </ul>
5935 **
5936 ** ^Unless it returns SQLITE_MISUSE, this function sets the
5937 ** [database connection] error code and message accessible via
5938 ** [sqlite3_errcode()] and [sqlite3_errmsg()] and related functions.
5939 **
5664 ** 5940 **
5665 ** ^(If the row that a BLOB handle points to is modified by an 5941 ** ^(If the row that a BLOB handle points to is modified by an
5666 ** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects 5942 ** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects
5667 ** then the BLOB handle is marked as "expired". 5943 ** then the BLOB handle is marked as "expired".
5668 ** This is true if any column of the row is changed, even a column 5944 ** This is true if any column of the row is changed, even a column
5669 ** other than the one the BLOB handle is open on.)^ 5945 ** other than the one the BLOB handle is open on.)^
5670 ** ^Calls to [sqlite3_blob_read()] and [sqlite3_blob_write()] for 5946 ** ^Calls to [sqlite3_blob_read()] and [sqlite3_blob_write()] for
5671 ** an expired BLOB handle fail with a return code of [SQLITE_ABORT]. 5947 ** an expired BLOB handle fail with a return code of [SQLITE_ABORT].
5672 ** ^(Changes written into a BLOB prior to the BLOB expiring are not 5948 ** ^(Changes written into a BLOB prior to the BLOB expiring are not
5673 ** rolled back by the expiration of the BLOB. Such changes will eventually 5949 ** rolled back by the expiration of the BLOB. Such changes will eventually
5674 ** commit if the transaction continues to completion.)^ 5950 ** commit if the transaction continues to completion.)^
5675 ** 5951 **
5676 ** ^Use the [sqlite3_blob_bytes()] interface to determine the size of 5952 ** ^Use the [sqlite3_blob_bytes()] interface to determine the size of
5677 ** the opened blob. ^The size of a blob may not be changed by this 5953 ** the opened blob. ^The size of a blob may not be changed by this
5678 ** interface. Use the [UPDATE] SQL command to change the size of a 5954 ** interface. Use the [UPDATE] SQL command to change the size of a
5679 ** blob. 5955 ** blob.
5680 ** 5956 **
5681 ** ^The [sqlite3_blob_open()] interface will fail for a [WITHOUT ROWID]
5682 ** table. Incremental BLOB I/O is not possible on [WITHOUT ROWID] tables.
5683 **
5684 ** ^The [sqlite3_bind_zeroblob()] and [sqlite3_result_zeroblob()] interfaces 5957 ** ^The [sqlite3_bind_zeroblob()] and [sqlite3_result_zeroblob()] interfaces
5685 ** and the built-in [zeroblob] SQL function can be used, if desired, 5958 ** and the built-in [zeroblob] SQL function may be used to create a
5686 ** to create an empty, zero-filled blob in which to read or write using 5959 ** zero-filled blob to read or write using the incremental-blob interface.
5687 ** this interface.
5688 ** 5960 **
5689 ** To avoid a resource leak, every open [BLOB handle] should eventually 5961 ** To avoid a resource leak, every open [BLOB handle] should eventually
5690 ** be released by a call to [sqlite3_blob_close()]. 5962 ** be released by a call to [sqlite3_blob_close()].
5691 */ 5963 */
5692 SQLITE_API int sqlite3_blob_open( 5964 SQLITE_API int SQLITE_STDCALL sqlite3_blob_open(
5693 sqlite3*, 5965 sqlite3*,
5694 const char *zDb, 5966 const char *zDb,
5695 const char *zTable, 5967 const char *zTable,
5696 const char *zColumn, 5968 const char *zColumn,
5697 sqlite3_int64 iRow, 5969 sqlite3_int64 iRow,
5698 int flags, 5970 int flags,
5699 sqlite3_blob **ppBlob 5971 sqlite3_blob **ppBlob
5700 ); 5972 );
5701 5973
5702 /* 5974 /*
5703 ** CAPI3REF: Move a BLOB Handle to a New Row 5975 ** CAPI3REF: Move a BLOB Handle to a New Row
5976 ** METHOD: sqlite3_blob
5704 ** 5977 **
5705 ** ^This function is used to move an existing blob handle so that it points 5978 ** ^This function is used to move an existing blob handle so that it points
5706 ** to a different row of the same database table. ^The new row is identified 5979 ** to a different row of the same database table. ^The new row is identified
5707 ** by the rowid value passed as the second argument. Only the row can be 5980 ** by the rowid value passed as the second argument. Only the row can be
5708 ** changed. ^The database, table and column on which the blob handle is open 5981 ** changed. ^The database, table and column on which the blob handle is open
5709 ** remain the same. Moving an existing blob handle to a new row can be 5982 ** remain the same. Moving an existing blob handle to a new row can be
5710 ** faster than closing the existing handle and opening a new one. 5983 ** faster than closing the existing handle and opening a new one.
5711 ** 5984 **
5712 ** ^(The new row must meet the same criteria as for [sqlite3_blob_open()] - 5985 ** ^(The new row must meet the same criteria as for [sqlite3_blob_open()] -
5713 ** it must exist and there must be either a blob or text value stored in 5986 ** it must exist and there must be either a blob or text value stored in
5714 ** the nominated column.)^ ^If the new row is not present in the table, or if 5987 ** the nominated column.)^ ^If the new row is not present in the table, or if
5715 ** it does not contain a blob or text value, or if another error occurs, an 5988 ** it does not contain a blob or text value, or if another error occurs, an
5716 ** SQLite error code is returned and the blob handle is considered aborted. 5989 ** SQLite error code is returned and the blob handle is considered aborted.
5717 ** ^All subsequent calls to [sqlite3_blob_read()], [sqlite3_blob_write()] or 5990 ** ^All subsequent calls to [sqlite3_blob_read()], [sqlite3_blob_write()] or
5718 ** [sqlite3_blob_reopen()] on an aborted blob handle immediately return 5991 ** [sqlite3_blob_reopen()] on an aborted blob handle immediately return
5719 ** SQLITE_ABORT. ^Calling [sqlite3_blob_bytes()] on an aborted blob handle 5992 ** SQLITE_ABORT. ^Calling [sqlite3_blob_bytes()] on an aborted blob handle
5720 ** always returns zero. 5993 ** always returns zero.
5721 ** 5994 **
5722 ** ^This function sets the database handle error code and message. 5995 ** ^This function sets the database handle error code and message.
5723 */ 5996 */
5724 SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_i nt64); 5997 SQLITE_API int SQLITE_STDCALL sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64) ;
5725 5998
5726 /* 5999 /*
5727 ** CAPI3REF: Close A BLOB Handle 6000 ** CAPI3REF: Close A BLOB Handle
6001 ** DESTRUCTOR: sqlite3_blob
5728 ** 6002 **
5729 ** ^Closes an open [BLOB handle]. 6003 ** ^This function closes an open [BLOB handle]. ^(The BLOB handle is closed
6004 ** unconditionally. Even if this routine returns an error code, the
6005 ** handle is still closed.)^
5730 ** 6006 **
5731 ** ^Closing a BLOB shall cause the current transaction to commit 6007 ** ^If the blob handle being closed was opened for read-write access, and if
5732 ** if there are no other BLOBs, no pending prepared statements, and the 6008 ** the database is in auto-commit mode and there are no other open read-write
5733 ** database connection is in [autocommit mode]. 6009 ** blob handles or active write statements, the current transaction is
5734 ** ^If any writes were made to the BLOB, they might be held in cache 6010 ** committed. ^If an error occurs while committing the transaction, an error
5735 ** until the close operation if they will fit. 6011 ** code is returned and the transaction rolled back.
5736 ** 6012 **
5737 ** ^(Closing the BLOB often forces the changes 6013 ** Calling this function with an argument that is not a NULL pointer or an
5738 ** out to disk and so if any I/O errors occur, they will likely occur 6014 ** open blob handle results in undefined behaviour. ^Calling this routine
5739 ** at the time when the BLOB is closed. Any errors that occur during 6015 ** with a null pointer (such as would be returned by a failed call to
5740 ** closing are reported as a non-zero return value.)^ 6016 ** [sqlite3_blob_open()]) is a harmless no-op. ^Otherwise, if this function
5741 ** 6017 ** is passed a valid open blob handle, the values returned by the
5742 ** ^(The BLOB is closed unconditionally. Even if this routine returns 6018 ** sqlite3_errcode() and sqlite3_errmsg() functions are set before returning.
5743 ** an error code, the BLOB is still closed.)^
5744 **
5745 ** ^Calling this routine with a null pointer (such as would be returned
5746 ** by a failed call to [sqlite3_blob_open()]) is a harmless no-op.
5747 */ 6019 */
5748 SQLITE_API int sqlite3_blob_close(sqlite3_blob *); 6020 SQLITE_API int SQLITE_STDCALL sqlite3_blob_close(sqlite3_blob *);
5749 6021
5750 /* 6022 /*
5751 ** CAPI3REF: Return The Size Of An Open BLOB 6023 ** CAPI3REF: Return The Size Of An Open BLOB
6024 ** METHOD: sqlite3_blob
5752 ** 6025 **
5753 ** ^Returns the size in bytes of the BLOB accessible via the 6026 ** ^Returns the size in bytes of the BLOB accessible via the
5754 ** successfully opened [BLOB handle] in its only argument. ^The 6027 ** successfully opened [BLOB handle] in its only argument. ^The
5755 ** incremental blob I/O routines can only read or overwriting existing 6028 ** incremental blob I/O routines can only read or overwriting existing
5756 ** blob content; they cannot change the size of a blob. 6029 ** blob content; they cannot change the size of a blob.
5757 ** 6030 **
5758 ** This routine only works on a [BLOB handle] which has been created 6031 ** This routine only works on a [BLOB handle] which has been created
5759 ** by a prior successful call to [sqlite3_blob_open()] and which has not 6032 ** by a prior successful call to [sqlite3_blob_open()] and which has not
5760 ** been closed by [sqlite3_blob_close()]. Passing any other pointer in 6033 ** been closed by [sqlite3_blob_close()]. Passing any other pointer in
5761 ** to this routine results in undefined and probably undesirable behavior. 6034 ** to this routine results in undefined and probably undesirable behavior.
5762 */ 6035 */
5763 SQLITE_API int sqlite3_blob_bytes(sqlite3_blob *); 6036 SQLITE_API int SQLITE_STDCALL sqlite3_blob_bytes(sqlite3_blob *);
5764 6037
5765 /* 6038 /*
5766 ** CAPI3REF: Read Data From A BLOB Incrementally 6039 ** CAPI3REF: Read Data From A BLOB Incrementally
6040 ** METHOD: sqlite3_blob
5767 ** 6041 **
5768 ** ^(This function is used to read data from an open [BLOB handle] into a 6042 ** ^(This function is used to read data from an open [BLOB handle] into a
5769 ** caller-supplied buffer. N bytes of data are copied into buffer Z 6043 ** caller-supplied buffer. N bytes of data are copied into buffer Z
5770 ** from the open BLOB, starting at offset iOffset.)^ 6044 ** from the open BLOB, starting at offset iOffset.)^
5771 ** 6045 **
5772 ** ^If offset iOffset is less than N bytes from the end of the BLOB, 6046 ** ^If offset iOffset is less than N bytes from the end of the BLOB,
5773 ** [SQLITE_ERROR] is returned and no data is read. ^If N or iOffset is 6047 ** [SQLITE_ERROR] is returned and no data is read. ^If N or iOffset is
5774 ** less than zero, [SQLITE_ERROR] is returned and no data is read. 6048 ** less than zero, [SQLITE_ERROR] is returned and no data is read.
5775 ** ^The size of the blob (and hence the maximum value of N+iOffset) 6049 ** ^The size of the blob (and hence the maximum value of N+iOffset)
5776 ** can be determined using the [sqlite3_blob_bytes()] interface. 6050 ** can be determined using the [sqlite3_blob_bytes()] interface.
5777 ** 6051 **
5778 ** ^An attempt to read from an expired [BLOB handle] fails with an 6052 ** ^An attempt to read from an expired [BLOB handle] fails with an
5779 ** error code of [SQLITE_ABORT]. 6053 ** error code of [SQLITE_ABORT].
5780 ** 6054 **
5781 ** ^(On success, sqlite3_blob_read() returns SQLITE_OK. 6055 ** ^(On success, sqlite3_blob_read() returns SQLITE_OK.
5782 ** Otherwise, an [error code] or an [extended error code] is returned.)^ 6056 ** Otherwise, an [error code] or an [extended error code] is returned.)^
5783 ** 6057 **
5784 ** This routine only works on a [BLOB handle] which has been created 6058 ** This routine only works on a [BLOB handle] which has been created
5785 ** by a prior successful call to [sqlite3_blob_open()] and which has not 6059 ** by a prior successful call to [sqlite3_blob_open()] and which has not
5786 ** been closed by [sqlite3_blob_close()]. Passing any other pointer in 6060 ** been closed by [sqlite3_blob_close()]. Passing any other pointer in
5787 ** to this routine results in undefined and probably undesirable behavior. 6061 ** to this routine results in undefined and probably undesirable behavior.
5788 ** 6062 **
5789 ** See also: [sqlite3_blob_write()]. 6063 ** See also: [sqlite3_blob_write()].
5790 */ 6064 */
5791 SQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset); 6065 SQLITE_API int SQLITE_STDCALL sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
5792 6066
5793 /* 6067 /*
5794 ** CAPI3REF: Write Data Into A BLOB Incrementally 6068 ** CAPI3REF: Write Data Into A BLOB Incrementally
6069 ** METHOD: sqlite3_blob
5795 ** 6070 **
5796 ** ^This function is used to write data into an open [BLOB handle] from a 6071 ** ^(This function is used to write data into an open [BLOB handle] from a
5797 ** caller-supplied buffer. ^N bytes of data are copied from the buffer Z 6072 ** caller-supplied buffer. N bytes of data are copied from the buffer Z
5798 ** into the open BLOB, starting at offset iOffset. 6073 ** into the open BLOB, starting at offset iOffset.)^
6074 **
6075 ** ^(On success, sqlite3_blob_write() returns SQLITE_OK.
6076 ** Otherwise, an [error code] or an [extended error code] is returned.)^
6077 ** ^Unless SQLITE_MISUSE is returned, this function sets the
6078 ** [database connection] error code and message accessible via
6079 ** [sqlite3_errcode()] and [sqlite3_errmsg()] and related functions.
5799 ** 6080 **
5800 ** ^If the [BLOB handle] passed as the first argument was not opened for 6081 ** ^If the [BLOB handle] passed as the first argument was not opened for
5801 ** writing (the flags parameter to [sqlite3_blob_open()] was zero), 6082 ** writing (the flags parameter to [sqlite3_blob_open()] was zero),
5802 ** this function returns [SQLITE_READONLY]. 6083 ** this function returns [SQLITE_READONLY].
5803 ** 6084 **
5804 ** ^This function may only modify the contents of the BLOB; it is 6085 ** This function may only modify the contents of the BLOB; it is
5805 ** not possible to increase the size of a BLOB using this API. 6086 ** not possible to increase the size of a BLOB using this API.
5806 ** ^If offset iOffset is less than N bytes from the end of the BLOB, 6087 ** ^If offset iOffset is less than N bytes from the end of the BLOB,
5807 ** [SQLITE_ERROR] is returned and no data is written. ^If N is 6088 ** [SQLITE_ERROR] is returned and no data is written. The size of the
5808 ** less than zero [SQLITE_ERROR] is returned and no data is written. 6089 ** BLOB (and hence the maximum value of N+iOffset) can be determined
5809 ** The size of the BLOB (and hence the maximum value of N+iOffset) 6090 ** using the [sqlite3_blob_bytes()] interface. ^If N or iOffset are less
5810 ** can be determined using the [sqlite3_blob_bytes()] interface. 6091 ** than zero [SQLITE_ERROR] is returned and no data is written.
5811 ** 6092 **
5812 ** ^An attempt to write to an expired [BLOB handle] fails with an 6093 ** ^An attempt to write to an expired [BLOB handle] fails with an
5813 ** error code of [SQLITE_ABORT]. ^Writes to the BLOB that occurred 6094 ** error code of [SQLITE_ABORT]. ^Writes to the BLOB that occurred
5814 ** before the [BLOB handle] expired are not rolled back by the 6095 ** before the [BLOB handle] expired are not rolled back by the
5815 ** expiration of the handle, though of course those changes might 6096 ** expiration of the handle, though of course those changes might
5816 ** have been overwritten by the statement that expired the BLOB handle 6097 ** have been overwritten by the statement that expired the BLOB handle
5817 ** or by other independent statements. 6098 ** or by other independent statements.
5818 ** 6099 **
5819 ** ^(On success, sqlite3_blob_write() returns SQLITE_OK.
5820 ** Otherwise, an [error code] or an [extended error code] is returned.)^
5821 **
5822 ** This routine only works on a [BLOB handle] which has been created 6100 ** This routine only works on a [BLOB handle] which has been created
5823 ** by a prior successful call to [sqlite3_blob_open()] and which has not 6101 ** by a prior successful call to [sqlite3_blob_open()] and which has not
5824 ** been closed by [sqlite3_blob_close()]. Passing any other pointer in 6102 ** been closed by [sqlite3_blob_close()]. Passing any other pointer in
5825 ** to this routine results in undefined and probably undesirable behavior. 6103 ** to this routine results in undefined and probably undesirable behavior.
5826 ** 6104 **
5827 ** See also: [sqlite3_blob_read()]. 6105 ** See also: [sqlite3_blob_read()].
5828 */ 6106 */
5829 SQLITE_API int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOff set); 6107 SQLITE_API int SQLITE_STDCALL sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset);
5830 6108
5831 /* 6109 /*
5832 ** CAPI3REF: Virtual File System Objects 6110 ** CAPI3REF: Virtual File System Objects
5833 ** 6111 **
5834 ** A virtual filesystem (VFS) is an [sqlite3_vfs] object 6112 ** A virtual filesystem (VFS) is an [sqlite3_vfs] object
5835 ** that SQLite uses to interact 6113 ** that SQLite uses to interact
5836 ** with the underlying operating system. Most SQLite builds come with a 6114 ** with the underlying operating system. Most SQLite builds come with a
5837 ** single default VFS that is appropriate for the host computer. 6115 ** single default VFS that is appropriate for the host computer.
5838 ** New VFSes can be registered and existing VFSes can be unregistered. 6116 ** New VFSes can be registered and existing VFSes can be unregistered.
5839 ** The following interfaces are provided. 6117 ** The following interfaces are provided.
(...skipping 10 matching lines...) Expand all
5850 ** ^To make an existing VFS into the default VFS, register it again 6128 ** ^To make an existing VFS into the default VFS, register it again
5851 ** with the makeDflt flag set. If two different VFSes with the 6129 ** with the makeDflt flag set. If two different VFSes with the
5852 ** same name are registered, the behavior is undefined. If a 6130 ** same name are registered, the behavior is undefined. If a
5853 ** VFS is registered with a name that is NULL or an empty string, 6131 ** VFS is registered with a name that is NULL or an empty string,
5854 ** then the behavior is undefined. 6132 ** then the behavior is undefined.
5855 ** 6133 **
5856 ** ^Unregister a VFS with the sqlite3_vfs_unregister() interface. 6134 ** ^Unregister a VFS with the sqlite3_vfs_unregister() interface.
5857 ** ^(If the default VFS is unregistered, another VFS is chosen as 6135 ** ^(If the default VFS is unregistered, another VFS is chosen as
5858 ** the default. The choice for the new VFS is arbitrary.)^ 6136 ** the default. The choice for the new VFS is arbitrary.)^
5859 */ 6137 */
5860 SQLITE_API sqlite3_vfs *sqlite3_vfs_find(const char *zVfsName); 6138 SQLITE_API sqlite3_vfs *SQLITE_STDCALL sqlite3_vfs_find(const char *zVfsName);
5861 SQLITE_API int sqlite3_vfs_register(sqlite3_vfs*, int makeDflt); 6139 SQLITE_API int SQLITE_STDCALL sqlite3_vfs_register(sqlite3_vfs*, int makeDflt);
5862 SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*); 6140 SQLITE_API int SQLITE_STDCALL sqlite3_vfs_unregister(sqlite3_vfs*);
5863 6141
5864 /* 6142 /*
5865 ** CAPI3REF: Mutexes 6143 ** CAPI3REF: Mutexes
5866 ** 6144 **
5867 ** The SQLite core uses these routines for thread 6145 ** The SQLite core uses these routines for thread
5868 ** synchronization. Though they are intended for internal 6146 ** synchronization. Though they are intended for internal
5869 ** use by SQLite, code that links against SQLite is 6147 ** use by SQLite, code that links against SQLite is
5870 ** permitted to use any of these routines. 6148 ** permitted to use any of these routines.
5871 ** 6149 **
5872 ** The SQLite source code contains multiple implementations 6150 ** The SQLite source code contains multiple implementations
5873 ** of these mutex routines. An appropriate implementation 6151 ** of these mutex routines. An appropriate implementation
5874 ** is selected automatically at compile-time. ^(The following 6152 ** is selected automatically at compile-time. The following
5875 ** implementations are available in the SQLite core: 6153 ** implementations are available in the SQLite core:
5876 ** 6154 **
5877 ** <ul> 6155 ** <ul>
5878 ** <li> SQLITE_MUTEX_PTHREADS 6156 ** <li> SQLITE_MUTEX_PTHREADS
5879 ** <li> SQLITE_MUTEX_W32 6157 ** <li> SQLITE_MUTEX_W32
5880 ** <li> SQLITE_MUTEX_NOOP 6158 ** <li> SQLITE_MUTEX_NOOP
5881 ** </ul>)^ 6159 ** </ul>
5882 ** 6160 **
5883 ** ^The SQLITE_MUTEX_NOOP implementation is a set of routines 6161 ** The SQLITE_MUTEX_NOOP implementation is a set of routines
5884 ** that does no real locking and is appropriate for use in 6162 ** that does no real locking and is appropriate for use in
5885 ** a single-threaded application. ^The SQLITE_MUTEX_PTHREADS and 6163 ** a single-threaded application. The SQLITE_MUTEX_PTHREADS and
5886 ** SQLITE_MUTEX_W32 implementations are appropriate for use on Unix 6164 ** SQLITE_MUTEX_W32 implementations are appropriate for use on Unix
5887 ** and Windows. 6165 ** and Windows.
5888 ** 6166 **
5889 ** ^(If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor 6167 ** If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor
5890 ** macro defined (with "-DSQLITE_MUTEX_APPDEF=1"), then no mutex 6168 ** macro defined (with "-DSQLITE_MUTEX_APPDEF=1"), then no mutex
5891 ** implementation is included with the library. In this case the 6169 ** implementation is included with the library. In this case the
5892 ** application must supply a custom mutex implementation using the 6170 ** application must supply a custom mutex implementation using the
5893 ** [SQLITE_CONFIG_MUTEX] option of the sqlite3_config() function 6171 ** [SQLITE_CONFIG_MUTEX] option of the sqlite3_config() function
5894 ** before calling sqlite3_initialize() or any other public sqlite3_ 6172 ** before calling sqlite3_initialize() or any other public sqlite3_
5895 ** function that calls sqlite3_initialize().)^ 6173 ** function that calls sqlite3_initialize().
5896 ** 6174 **
5897 ** ^The sqlite3_mutex_alloc() routine allocates a new 6175 ** ^The sqlite3_mutex_alloc() routine allocates a new
5898 ** mutex and returns a pointer to it. ^If it returns NULL 6176 ** mutex and returns a pointer to it. ^The sqlite3_mutex_alloc()
5899 ** that means that a mutex could not be allocated. ^SQLite 6177 ** routine returns NULL if it is unable to allocate the requested
5900 ** will unwind its stack and return an error. ^(The argument 6178 ** mutex. The argument to sqlite3_mutex_alloc() must one of these
5901 ** to sqlite3_mutex_alloc() is one of these integer constants: 6179 ** integer constants:
5902 ** 6180 **
5903 ** <ul> 6181 ** <ul>
5904 ** <li> SQLITE_MUTEX_FAST 6182 ** <li> SQLITE_MUTEX_FAST
5905 ** <li> SQLITE_MUTEX_RECURSIVE 6183 ** <li> SQLITE_MUTEX_RECURSIVE
5906 ** <li> SQLITE_MUTEX_STATIC_MASTER 6184 ** <li> SQLITE_MUTEX_STATIC_MASTER
5907 ** <li> SQLITE_MUTEX_STATIC_MEM 6185 ** <li> SQLITE_MUTEX_STATIC_MEM
5908 ** <li> SQLITE_MUTEX_STATIC_OPEN 6186 ** <li> SQLITE_MUTEX_STATIC_OPEN
5909 ** <li> SQLITE_MUTEX_STATIC_PRNG 6187 ** <li> SQLITE_MUTEX_STATIC_PRNG
5910 ** <li> SQLITE_MUTEX_STATIC_LRU 6188 ** <li> SQLITE_MUTEX_STATIC_LRU
5911 ** <li> SQLITE_MUTEX_STATIC_PMEM 6189 ** <li> SQLITE_MUTEX_STATIC_PMEM
5912 ** <li> SQLITE_MUTEX_STATIC_APP1 6190 ** <li> SQLITE_MUTEX_STATIC_APP1
5913 ** <li> SQLITE_MUTEX_STATIC_APP2 6191 ** <li> SQLITE_MUTEX_STATIC_APP2
5914 ** </ul>)^ 6192 ** <li> SQLITE_MUTEX_STATIC_APP3
6193 ** <li> SQLITE_MUTEX_STATIC_VFS1
6194 ** <li> SQLITE_MUTEX_STATIC_VFS2
6195 ** <li> SQLITE_MUTEX_STATIC_VFS3
6196 ** </ul>
5915 ** 6197 **
5916 ** ^The first two constants (SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) 6198 ** ^The first two constants (SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE)
5917 ** cause sqlite3_mutex_alloc() to create 6199 ** cause sqlite3_mutex_alloc() to create
5918 ** a new mutex. ^The new mutex is recursive when SQLITE_MUTEX_RECURSIVE 6200 ** a new mutex. ^The new mutex is recursive when SQLITE_MUTEX_RECURSIVE
5919 ** is used but not necessarily so when SQLITE_MUTEX_FAST is used. 6201 ** is used but not necessarily so when SQLITE_MUTEX_FAST is used.
5920 ** The mutex implementation does not need to make a distinction 6202 ** The mutex implementation does not need to make a distinction
5921 ** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does 6203 ** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does
5922 ** not want to. ^SQLite will only request a recursive mutex in 6204 ** not want to. SQLite will only request a recursive mutex in
5923 ** cases where it really needs one. ^If a faster non-recursive mutex 6205 ** cases where it really needs one. If a faster non-recursive mutex
5924 ** implementation is available on the host platform, the mutex subsystem 6206 ** implementation is available on the host platform, the mutex subsystem
5925 ** might return such a mutex in response to SQLITE_MUTEX_FAST. 6207 ** might return such a mutex in response to SQLITE_MUTEX_FAST.
5926 ** 6208 **
5927 ** ^The other allowed parameters to sqlite3_mutex_alloc() (anything other 6209 ** ^The other allowed parameters to sqlite3_mutex_alloc() (anything other
5928 ** than SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) each return 6210 ** than SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) each return
5929 ** a pointer to a static preexisting mutex. ^Six static mutexes are 6211 ** a pointer to a static preexisting mutex. ^Nine static mutexes are
5930 ** used by the current version of SQLite. Future versions of SQLite 6212 ** used by the current version of SQLite. Future versions of SQLite
5931 ** may add additional static mutexes. Static mutexes are for internal 6213 ** may add additional static mutexes. Static mutexes are for internal
5932 ** use by SQLite only. Applications that use SQLite mutexes should 6214 ** use by SQLite only. Applications that use SQLite mutexes should
5933 ** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or 6215 ** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or
5934 ** SQLITE_MUTEX_RECURSIVE. 6216 ** SQLITE_MUTEX_RECURSIVE.
5935 ** 6217 **
5936 ** ^Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST 6218 ** ^Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST
5937 ** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc() 6219 ** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc()
5938 ** returns a different mutex on every call. ^But for the static 6220 ** returns a different mutex on every call. ^For the static
5939 ** mutex types, the same mutex is returned on every call that has 6221 ** mutex types, the same mutex is returned on every call that has
5940 ** the same type number. 6222 ** the same type number.
5941 ** 6223 **
5942 ** ^The sqlite3_mutex_free() routine deallocates a previously 6224 ** ^The sqlite3_mutex_free() routine deallocates a previously
5943 ** allocated dynamic mutex. ^SQLite is careful to deallocate every 6225 ** allocated dynamic mutex. Attempting to deallocate a static
5944 ** dynamic mutex that it allocates. The dynamic mutexes must not be in 6226 ** mutex results in undefined behavior.
5945 ** use when they are deallocated. Attempting to deallocate a static
5946 ** mutex results in undefined behavior. ^SQLite never deallocates
5947 ** a static mutex.
5948 ** 6227 **
5949 ** ^The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt 6228 ** ^The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt
5950 ** to enter a mutex. ^If another thread is already within the mutex, 6229 ** to enter a mutex. ^If another thread is already within the mutex,
5951 ** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return 6230 ** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return
5952 ** SQLITE_BUSY. ^The sqlite3_mutex_try() interface returns [SQLITE_OK] 6231 ** SQLITE_BUSY. ^The sqlite3_mutex_try() interface returns [SQLITE_OK]
5953 ** upon successful entry. ^(Mutexes created using 6232 ** upon successful entry. ^(Mutexes created using
5954 ** SQLITE_MUTEX_RECURSIVE can be entered multiple times by the same thread. 6233 ** SQLITE_MUTEX_RECURSIVE can be entered multiple times by the same thread.
5955 ** In such cases the, 6234 ** In such cases, the
5956 ** mutex must be exited an equal number of times before another thread 6235 ** mutex must be exited an equal number of times before another thread
5957 ** can enter.)^ ^(If the same thread tries to enter any other 6236 ** can enter.)^ If the same thread tries to enter any mutex other
5958 ** kind of mutex more than once, the behavior is undefined. 6237 ** than an SQLITE_MUTEX_RECURSIVE more than once, the behavior is undefined.
5959 ** SQLite will never exhibit
5960 ** such behavior in its own use of mutexes.)^
5961 ** 6238 **
5962 ** ^(Some systems (for example, Windows 95) do not support the operation 6239 ** ^(Some systems (for example, Windows 95) do not support the operation
5963 ** implemented by sqlite3_mutex_try(). On those systems, sqlite3_mutex_try() 6240 ** implemented by sqlite3_mutex_try(). On those systems, sqlite3_mutex_try()
5964 ** will always return SQLITE_BUSY. The SQLite core only ever uses 6241 ** will always return SQLITE_BUSY. The SQLite core only ever uses
5965 ** sqlite3_mutex_try() as an optimization so this is acceptable behavior.)^ 6242 ** sqlite3_mutex_try() as an optimization so this is acceptable
6243 ** behavior.)^
5966 ** 6244 **
5967 ** ^The sqlite3_mutex_leave() routine exits a mutex that was 6245 ** ^The sqlite3_mutex_leave() routine exits a mutex that was
5968 ** previously entered by the same thread. ^(The behavior 6246 ** previously entered by the same thread. The behavior
5969 ** is undefined if the mutex is not currently entered by the 6247 ** is undefined if the mutex is not currently entered by the
5970 ** calling thread or is not currently allocated. SQLite will 6248 ** calling thread or is not currently allocated.
5971 ** never do either.)^
5972 ** 6249 **
5973 ** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), or 6250 ** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), or
5974 ** sqlite3_mutex_leave() is a NULL pointer, then all three routines 6251 ** sqlite3_mutex_leave() is a NULL pointer, then all three routines
5975 ** behave as no-ops. 6252 ** behave as no-ops.
5976 ** 6253 **
5977 ** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()]. 6254 ** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()].
5978 */ 6255 */
5979 SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int); 6256 SQLITE_API sqlite3_mutex *SQLITE_STDCALL sqlite3_mutex_alloc(int);
5980 SQLITE_API void sqlite3_mutex_free(sqlite3_mutex*); 6257 SQLITE_API void SQLITE_STDCALL sqlite3_mutex_free(sqlite3_mutex*);
5981 SQLITE_API void sqlite3_mutex_enter(sqlite3_mutex*); 6258 SQLITE_API void SQLITE_STDCALL sqlite3_mutex_enter(sqlite3_mutex*);
5982 SQLITE_API int sqlite3_mutex_try(sqlite3_mutex*); 6259 SQLITE_API int SQLITE_STDCALL sqlite3_mutex_try(sqlite3_mutex*);
5983 SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex*); 6260 SQLITE_API void SQLITE_STDCALL sqlite3_mutex_leave(sqlite3_mutex*);
5984 6261
5985 /* 6262 /*
5986 ** CAPI3REF: Mutex Methods Object 6263 ** CAPI3REF: Mutex Methods Object
5987 ** 6264 **
5988 ** An instance of this structure defines the low-level routines 6265 ** An instance of this structure defines the low-level routines
5989 ** used to allocate and use mutexes. 6266 ** used to allocate and use mutexes.
5990 ** 6267 **
5991 ** Usually, the default mutex implementations provided by SQLite are 6268 ** Usually, the default mutex implementations provided by SQLite are
5992 ** sufficient, however the user has the option of substituting a custom 6269 ** sufficient, however the application has the option of substituting a custom
5993 ** implementation for specialized deployments or systems for which SQLite 6270 ** implementation for specialized deployments or systems for which SQLite
5994 ** does not provide a suitable implementation. In this case, the user 6271 ** does not provide a suitable implementation. In this case, the application
5995 ** creates and populates an instance of this structure to pass 6272 ** creates and populates an instance of this structure to pass
5996 ** to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option. 6273 ** to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option.
5997 ** Additionally, an instance of this structure can be used as an 6274 ** Additionally, an instance of this structure can be used as an
5998 ** output variable when querying the system for the current mutex 6275 ** output variable when querying the system for the current mutex
5999 ** implementation, using the [SQLITE_CONFIG_GETMUTEX] option. 6276 ** implementation, using the [SQLITE_CONFIG_GETMUTEX] option.
6000 ** 6277 **
6001 ** ^The xMutexInit method defined by this structure is invoked as 6278 ** ^The xMutexInit method defined by this structure is invoked as
6002 ** part of system initialization by the sqlite3_initialize() function. 6279 ** part of system initialization by the sqlite3_initialize() function.
6003 ** ^The xMutexInit routine is called by SQLite exactly once for each 6280 ** ^The xMutexInit routine is called by SQLite exactly once for each
6004 ** effective call to [sqlite3_initialize()]. 6281 ** effective call to [sqlite3_initialize()].
(...skipping 20 matching lines...) Expand all
6025 ** </ul>)^ 6302 ** </ul>)^
6026 ** 6303 **
6027 ** The only difference is that the public sqlite3_XXX functions enumerated 6304 ** The only difference is that the public sqlite3_XXX functions enumerated
6028 ** above silently ignore any invocations that pass a NULL pointer instead 6305 ** above silently ignore any invocations that pass a NULL pointer instead
6029 ** of a valid mutex handle. The implementations of the methods defined 6306 ** of a valid mutex handle. The implementations of the methods defined
6030 ** by this structure are not required to handle this case, the results 6307 ** by this structure are not required to handle this case, the results
6031 ** of passing a NULL pointer instead of a valid mutex handle are undefined 6308 ** of passing a NULL pointer instead of a valid mutex handle are undefined
6032 ** (i.e. it is acceptable to provide an implementation that segfaults if 6309 ** (i.e. it is acceptable to provide an implementation that segfaults if
6033 ** it is passed a NULL pointer). 6310 ** it is passed a NULL pointer).
6034 ** 6311 **
6035 ** The xMutexInit() method must be threadsafe. ^It must be harmless to 6312 ** The xMutexInit() method must be threadsafe. It must be harmless to
6036 ** invoke xMutexInit() multiple times within the same process and without 6313 ** invoke xMutexInit() multiple times within the same process and without
6037 ** intervening calls to xMutexEnd(). Second and subsequent calls to 6314 ** intervening calls to xMutexEnd(). Second and subsequent calls to
6038 ** xMutexInit() must be no-ops. 6315 ** xMutexInit() must be no-ops.
6039 ** 6316 **
6040 ** ^xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()] 6317 ** xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()]
6041 ** and its associates). ^Similarly, xMutexAlloc() must not use SQLite memory 6318 ** and its associates). Similarly, xMutexAlloc() must not use SQLite memory
6042 ** allocation for a static mutex. ^However xMutexAlloc() may use SQLite 6319 ** allocation for a static mutex. ^However xMutexAlloc() may use SQLite
6043 ** memory allocation for a fast or recursive mutex. 6320 ** memory allocation for a fast or recursive mutex.
6044 ** 6321 **
6045 ** ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is 6322 ** ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is
6046 ** called, but only if the prior call to xMutexInit returned SQLITE_OK. 6323 ** called, but only if the prior call to xMutexInit returned SQLITE_OK.
6047 ** If xMutexInit fails in any way, it is expected to clean up after itself 6324 ** If xMutexInit fails in any way, it is expected to clean up after itself
6048 ** prior to returning. 6325 ** prior to returning.
6049 */ 6326 */
6050 typedef struct sqlite3_mutex_methods sqlite3_mutex_methods; 6327 typedef struct sqlite3_mutex_methods sqlite3_mutex_methods;
6051 struct sqlite3_mutex_methods { 6328 struct sqlite3_mutex_methods {
6052 int (*xMutexInit)(void); 6329 int (*xMutexInit)(void);
6053 int (*xMutexEnd)(void); 6330 int (*xMutexEnd)(void);
6054 sqlite3_mutex *(*xMutexAlloc)(int); 6331 sqlite3_mutex *(*xMutexAlloc)(int);
6055 void (*xMutexFree)(sqlite3_mutex *); 6332 void (*xMutexFree)(sqlite3_mutex *);
6056 void (*xMutexEnter)(sqlite3_mutex *); 6333 void (*xMutexEnter)(sqlite3_mutex *);
6057 int (*xMutexTry)(sqlite3_mutex *); 6334 int (*xMutexTry)(sqlite3_mutex *);
6058 void (*xMutexLeave)(sqlite3_mutex *); 6335 void (*xMutexLeave)(sqlite3_mutex *);
6059 int (*xMutexHeld)(sqlite3_mutex *); 6336 int (*xMutexHeld)(sqlite3_mutex *);
6060 int (*xMutexNotheld)(sqlite3_mutex *); 6337 int (*xMutexNotheld)(sqlite3_mutex *);
6061 }; 6338 };
6062 6339
6063 /* 6340 /*
6064 ** CAPI3REF: Mutex Verification Routines 6341 ** CAPI3REF: Mutex Verification Routines
6065 ** 6342 **
6066 ** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routines 6343 ** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routines
6067 ** are intended for use inside assert() statements. ^The SQLite core 6344 ** are intended for use inside assert() statements. The SQLite core
6068 ** never uses these routines except inside an assert() and applications 6345 ** never uses these routines except inside an assert() and applications
6069 ** are advised to follow the lead of the core. ^The SQLite core only 6346 ** are advised to follow the lead of the core. The SQLite core only
6070 ** provides implementations for these routines when it is compiled 6347 ** provides implementations for these routines when it is compiled
6071 ** with the SQLITE_DEBUG flag. ^External mutex implementations 6348 ** with the SQLITE_DEBUG flag. External mutex implementations
6072 ** are only required to provide these routines if SQLITE_DEBUG is 6349 ** are only required to provide these routines if SQLITE_DEBUG is
6073 ** defined and if NDEBUG is not defined. 6350 ** defined and if NDEBUG is not defined.
6074 ** 6351 **
6075 ** ^These routines should return true if the mutex in their argument 6352 ** These routines should return true if the mutex in their argument
6076 ** is held or not held, respectively, by the calling thread. 6353 ** is held or not held, respectively, by the calling thread.
6077 ** 6354 **
6078 ** ^The implementation is not required to provide versions of these 6355 ** The implementation is not required to provide versions of these
6079 ** routines that actually work. If the implementation does not provide working 6356 ** routines that actually work. If the implementation does not provide working
6080 ** versions of these routines, it should at least provide stubs that always 6357 ** versions of these routines, it should at least provide stubs that always
6081 ** return true so that one does not get spurious assertion failures. 6358 ** return true so that one does not get spurious assertion failures.
6082 ** 6359 **
6083 ** ^If the argument to sqlite3_mutex_held() is a NULL pointer then 6360 ** If the argument to sqlite3_mutex_held() is a NULL pointer then
6084 ** the routine should return 1. This seems counter-intuitive since 6361 ** the routine should return 1. This seems counter-intuitive since
6085 ** clearly the mutex cannot be held if it does not exist. But 6362 ** clearly the mutex cannot be held if it does not exist. But
6086 ** the reason the mutex does not exist is because the build is not 6363 ** the reason the mutex does not exist is because the build is not
6087 ** using mutexes. And we do not want the assert() containing the 6364 ** using mutexes. And we do not want the assert() containing the
6088 ** call to sqlite3_mutex_held() to fail, so a non-zero return is 6365 ** call to sqlite3_mutex_held() to fail, so a non-zero return is
6089 ** the appropriate thing to do. ^The sqlite3_mutex_notheld() 6366 ** the appropriate thing to do. The sqlite3_mutex_notheld()
6090 ** interface should also return 1 when given a NULL pointer. 6367 ** interface should also return 1 when given a NULL pointer.
6091 */ 6368 */
6092 #ifndef NDEBUG 6369 #ifndef NDEBUG
6093 SQLITE_API int sqlite3_mutex_held(sqlite3_mutex*); 6370 SQLITE_API int SQLITE_STDCALL sqlite3_mutex_held(sqlite3_mutex*);
6094 SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*); 6371 SQLITE_API int SQLITE_STDCALL sqlite3_mutex_notheld(sqlite3_mutex*);
6095 #endif 6372 #endif
6096 6373
6097 /* 6374 /*
6098 ** CAPI3REF: Mutex Types 6375 ** CAPI3REF: Mutex Types
6099 ** 6376 **
6100 ** The [sqlite3_mutex_alloc()] interface takes a single argument 6377 ** The [sqlite3_mutex_alloc()] interface takes a single argument
6101 ** which is one of these integer constants. 6378 ** which is one of these integer constants.
6102 ** 6379 **
6103 ** The set of static mutexes may change from one SQLite release to the 6380 ** The set of static mutexes may change from one SQLite release to the
6104 ** next. Applications that override the built-in mutex logic must be 6381 ** next. Applications that override the built-in mutex logic must be
6105 ** prepared to accommodate additional static mutexes. 6382 ** prepared to accommodate additional static mutexes.
6106 */ 6383 */
6107 #define SQLITE_MUTEX_FAST 0 6384 #define SQLITE_MUTEX_FAST 0
6108 #define SQLITE_MUTEX_RECURSIVE 1 6385 #define SQLITE_MUTEX_RECURSIVE 1
6109 #define SQLITE_MUTEX_STATIC_MASTER 2 6386 #define SQLITE_MUTEX_STATIC_MASTER 2
6110 #define SQLITE_MUTEX_STATIC_MEM 3 /* sqlite3_malloc() */ 6387 #define SQLITE_MUTEX_STATIC_MEM 3 /* sqlite3_malloc() */
6111 #define SQLITE_MUTEX_STATIC_MEM2 4 /* NOT USED */ 6388 #define SQLITE_MUTEX_STATIC_MEM2 4 /* NOT USED */
6112 #define SQLITE_MUTEX_STATIC_OPEN 4 /* sqlite3BtreeOpen() */ 6389 #define SQLITE_MUTEX_STATIC_OPEN 4 /* sqlite3BtreeOpen() */
6113 #define SQLITE_MUTEX_STATIC_PRNG 5 /* sqlite3_random() */ 6390 #define SQLITE_MUTEX_STATIC_PRNG 5 /* sqlite3_random() */
6114 #define SQLITE_MUTEX_STATIC_LRU 6 /* lru page list */ 6391 #define SQLITE_MUTEX_STATIC_LRU 6 /* lru page list */
6115 #define SQLITE_MUTEX_STATIC_LRU2 7 /* NOT USED */ 6392 #define SQLITE_MUTEX_STATIC_LRU2 7 /* NOT USED */
6116 #define SQLITE_MUTEX_STATIC_PMEM 7 /* sqlite3PageMalloc() */ 6393 #define SQLITE_MUTEX_STATIC_PMEM 7 /* sqlite3PageMalloc() */
6117 #define SQLITE_MUTEX_STATIC_APP1 8 /* For use by application */ 6394 #define SQLITE_MUTEX_STATIC_APP1 8 /* For use by application */
6118 #define SQLITE_MUTEX_STATIC_APP2 9 /* For use by application */ 6395 #define SQLITE_MUTEX_STATIC_APP2 9 /* For use by application */
6119 #define SQLITE_MUTEX_STATIC_APP3 10 /* For use by application */ 6396 #define SQLITE_MUTEX_STATIC_APP3 10 /* For use by application */
6397 #define SQLITE_MUTEX_STATIC_VFS1 11 /* For use by built-in VFS */
6398 #define SQLITE_MUTEX_STATIC_VFS2 12 /* For use by extension VFS */
6399 #define SQLITE_MUTEX_STATIC_VFS3 13 /* For use by application VFS */
6120 6400
6121 /* 6401 /*
6122 ** CAPI3REF: Retrieve the mutex for a database connection 6402 ** CAPI3REF: Retrieve the mutex for a database connection
6403 ** METHOD: sqlite3
6123 ** 6404 **
6124 ** ^This interface returns a pointer the [sqlite3_mutex] object that 6405 ** ^This interface returns a pointer the [sqlite3_mutex] object that
6125 ** serializes access to the [database connection] given in the argument 6406 ** serializes access to the [database connection] given in the argument
6126 ** when the [threading mode] is Serialized. 6407 ** when the [threading mode] is Serialized.
6127 ** ^If the [threading mode] is Single-thread or Multi-thread then this 6408 ** ^If the [threading mode] is Single-thread or Multi-thread then this
6128 ** routine returns a NULL pointer. 6409 ** routine returns a NULL pointer.
6129 */ 6410 */
6130 SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*); 6411 SQLITE_API sqlite3_mutex *SQLITE_STDCALL sqlite3_db_mutex(sqlite3*);
6131 6412
6132 /* 6413 /*
6133 ** CAPI3REF: Low-Level Control Of Database Files 6414 ** CAPI3REF: Low-Level Control Of Database Files
6415 ** METHOD: sqlite3
6134 ** 6416 **
6135 ** ^The [sqlite3_file_control()] interface makes a direct call to the 6417 ** ^The [sqlite3_file_control()] interface makes a direct call to the
6136 ** xFileControl method for the [sqlite3_io_methods] object associated 6418 ** xFileControl method for the [sqlite3_io_methods] object associated
6137 ** with a particular database identified by the second argument. ^The 6419 ** with a particular database identified by the second argument. ^The
6138 ** name of the database is "main" for the main database or "temp" for the 6420 ** name of the database is "main" for the main database or "temp" for the
6139 ** TEMP database, or the name that appears after the AS keyword for 6421 ** TEMP database, or the name that appears after the AS keyword for
6140 ** databases that are added using the [ATTACH] SQL command. 6422 ** databases that are added using the [ATTACH] SQL command.
6141 ** ^A NULL pointer can be used in place of "main" to refer to the 6423 ** ^A NULL pointer can be used in place of "main" to refer to the
6142 ** main database file. 6424 ** main database file.
6143 ** ^The third and fourth parameters to this routine 6425 ** ^The third and fourth parameters to this routine
(...skipping 10 matching lines...) Expand all
6154 ** ^If the second parameter (zDbName) does not match the name of any 6436 ** ^If the second parameter (zDbName) does not match the name of any
6155 ** open database file, then SQLITE_ERROR is returned. ^This error 6437 ** open database file, then SQLITE_ERROR is returned. ^This error
6156 ** code is not remembered and will not be recalled by [sqlite3_errcode()] 6438 ** code is not remembered and will not be recalled by [sqlite3_errcode()]
6157 ** or [sqlite3_errmsg()]. The underlying xFileControl method might 6439 ** or [sqlite3_errmsg()]. The underlying xFileControl method might
6158 ** also return SQLITE_ERROR. There is no way to distinguish between 6440 ** also return SQLITE_ERROR. There is no way to distinguish between
6159 ** an incorrect zDbName and an SQLITE_ERROR return from the underlying 6441 ** an incorrect zDbName and an SQLITE_ERROR return from the underlying
6160 ** xFileControl method. 6442 ** xFileControl method.
6161 ** 6443 **
6162 ** See also: [SQLITE_FCNTL_LOCKSTATE] 6444 ** See also: [SQLITE_FCNTL_LOCKSTATE]
6163 */ 6445 */
6164 SQLITE_API int sqlite3_file_control(sqlite3*, const char *zDbName, int op, void* ); 6446 SQLITE_API int SQLITE_STDCALL sqlite3_file_control(sqlite3*, const char *zDbName , int op, void*);
6165 6447
6166 /* 6448 /*
6167 ** CAPI3REF: Testing Interface 6449 ** CAPI3REF: Testing Interface
6168 ** 6450 **
6169 ** ^The sqlite3_test_control() interface is used to read out internal 6451 ** ^The sqlite3_test_control() interface is used to read out internal
6170 ** state of SQLite and to inject faults into SQLite for testing 6452 ** state of SQLite and to inject faults into SQLite for testing
6171 ** purposes. ^The first parameter is an operation code that determines 6453 ** purposes. ^The first parameter is an operation code that determines
6172 ** the number, meaning, and operation of all subsequent parameters. 6454 ** the number, meaning, and operation of all subsequent parameters.
6173 ** 6455 **
6174 ** This interface is not for use by applications. It exists solely 6456 ** This interface is not for use by applications. It exists solely
6175 ** for verifying the correct operation of the SQLite library. Depending 6457 ** for verifying the correct operation of the SQLite library. Depending
6176 ** on how the SQLite library is compiled, this interface might not exist. 6458 ** on how the SQLite library is compiled, this interface might not exist.
6177 ** 6459 **
6178 ** The details of the operation codes, their meanings, the parameters 6460 ** The details of the operation codes, their meanings, the parameters
6179 ** they take, and what they do are all subject to change without notice. 6461 ** they take, and what they do are all subject to change without notice.
6180 ** Unlike most of the SQLite API, this function is not guaranteed to 6462 ** Unlike most of the SQLite API, this function is not guaranteed to
6181 ** operate consistently from one release to the next. 6463 ** operate consistently from one release to the next.
6182 */ 6464 */
6183 SQLITE_API int sqlite3_test_control(int op, ...); 6465 SQLITE_API int SQLITE_CDECL sqlite3_test_control(int op, ...);
6184 6466
6185 /* 6467 /*
6186 ** CAPI3REF: Testing Interface Operation Codes 6468 ** CAPI3REF: Testing Interface Operation Codes
6187 ** 6469 **
6188 ** These constants are the valid operation code parameters used 6470 ** These constants are the valid operation code parameters used
6189 ** as the first argument to [sqlite3_test_control()]. 6471 ** as the first argument to [sqlite3_test_control()].
6190 ** 6472 **
6191 ** These parameters and their meanings are subject to change 6473 ** These parameters and their meanings are subject to change
6192 ** without notice. These values are for testing purposes only. 6474 ** without notice. These values are for testing purposes only.
6193 ** Applications should not use any of these parameters or the 6475 ** Applications should not use any of these parameters or the
(...skipping 13 matching lines...) Expand all
6207 #define SQLITE_TESTCTRL_OPTIMIZATIONS 15 6489 #define SQLITE_TESTCTRL_OPTIMIZATIONS 15
6208 #define SQLITE_TESTCTRL_ISKEYWORD 16 6490 #define SQLITE_TESTCTRL_ISKEYWORD 16
6209 #define SQLITE_TESTCTRL_SCRATCHMALLOC 17 6491 #define SQLITE_TESTCTRL_SCRATCHMALLOC 17
6210 #define SQLITE_TESTCTRL_LOCALTIME_FAULT 18 6492 #define SQLITE_TESTCTRL_LOCALTIME_FAULT 18
6211 #define SQLITE_TESTCTRL_EXPLAIN_STMT 19 /* NOT USED */ 6493 #define SQLITE_TESTCTRL_EXPLAIN_STMT 19 /* NOT USED */
6212 #define SQLITE_TESTCTRL_NEVER_CORRUPT 20 6494 #define SQLITE_TESTCTRL_NEVER_CORRUPT 20
6213 #define SQLITE_TESTCTRL_VDBE_COVERAGE 21 6495 #define SQLITE_TESTCTRL_VDBE_COVERAGE 21
6214 #define SQLITE_TESTCTRL_BYTEORDER 22 6496 #define SQLITE_TESTCTRL_BYTEORDER 22
6215 #define SQLITE_TESTCTRL_ISINIT 23 6497 #define SQLITE_TESTCTRL_ISINIT 23
6216 #define SQLITE_TESTCTRL_SORTER_MMAP 24 6498 #define SQLITE_TESTCTRL_SORTER_MMAP 24
6217 #define SQLITE_TESTCTRL_LAST 24 6499 #define SQLITE_TESTCTRL_IMPOSTER 25
6500 #define SQLITE_TESTCTRL_LAST 25
6218 6501
6219 /* 6502 /*
6220 ** CAPI3REF: SQLite Runtime Status 6503 ** CAPI3REF: SQLite Runtime Status
6221 ** 6504 **
6222 ** ^This interface is used to retrieve runtime status information 6505 ** ^These interfaces are used to retrieve runtime status information
6223 ** about the performance of SQLite, and optionally to reset various 6506 ** about the performance of SQLite, and optionally to reset various
6224 ** highwater marks. ^The first argument is an integer code for 6507 ** highwater marks. ^The first argument is an integer code for
6225 ** the specific parameter to measure. ^(Recognized integer codes 6508 ** the specific parameter to measure. ^(Recognized integer codes
6226 ** are of the form [status parameters | SQLITE_STATUS_...].)^ 6509 ** are of the form [status parameters | SQLITE_STATUS_...].)^
6227 ** ^The current value of the parameter is returned into *pCurrent. 6510 ** ^The current value of the parameter is returned into *pCurrent.
6228 ** ^The highest recorded value is returned in *pHighwater. ^If the 6511 ** ^The highest recorded value is returned in *pHighwater. ^If the
6229 ** resetFlag is true, then the highest record value is reset after 6512 ** resetFlag is true, then the highest record value is reset after
6230 ** *pHighwater is written. ^(Some parameters do not record the highest 6513 ** *pHighwater is written. ^(Some parameters do not record the highest
6231 ** value. For those parameters 6514 ** value. For those parameters
6232 ** nothing is written into *pHighwater and the resetFlag is ignored.)^ 6515 ** nothing is written into *pHighwater and the resetFlag is ignored.)^
6233 ** ^(Other parameters record only the highwater mark and not the current 6516 ** ^(Other parameters record only the highwater mark and not the current
6234 ** value. For these latter parameters nothing is written into *pCurrent.)^ 6517 ** value. For these latter parameters nothing is written into *pCurrent.)^
6235 ** 6518 **
6236 ** ^The sqlite3_status() routine returns SQLITE_OK on success and a 6519 ** ^The sqlite3_status() and sqlite3_status64() routines return
6237 ** non-zero [error code] on failure. 6520 ** SQLITE_OK on success and a non-zero [error code] on failure.
6238 ** 6521 **
6239 ** This routine is threadsafe but is not atomic. This routine can be 6522 ** If either the current value or the highwater mark is too large to
6240 ** called while other threads are running the same or different SQLite 6523 ** be represented by a 32-bit integer, then the values returned by
6241 ** interfaces. However the values returned in *pCurrent and 6524 ** sqlite3_status() are undefined.
6242 ** *pHighwater reflect the status of SQLite at different points in time
6243 ** and it is possible that another thread might change the parameter
6244 ** in between the times when *pCurrent and *pHighwater are written.
6245 ** 6525 **
6246 ** See also: [sqlite3_db_status()] 6526 ** See also: [sqlite3_db_status()]
6247 */ 6527 */
6248 SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetF lag); 6528 SQLITE_API int SQLITE_STDCALL sqlite3_status(int op, int *pCurrent, int *pHighwa ter, int resetFlag);
6529 SQLITE_API int SQLITE_STDCALL sqlite3_status64(
6530 int op,
6531 sqlite3_int64 *pCurrent,
6532 sqlite3_int64 *pHighwater,
6533 int resetFlag
6534 );
6249 6535
6250 6536
6251 /* 6537 /*
6252 ** CAPI3REF: Status Parameters 6538 ** CAPI3REF: Status Parameters
6253 ** KEYWORDS: {status parameters} 6539 ** KEYWORDS: {status parameters}
6254 ** 6540 **
6255 ** These integer constants designate various run-time status parameters 6541 ** These integer constants designate various run-time status parameters
6256 ** that can be returned by [sqlite3_status()]. 6542 ** that can be returned by [sqlite3_status()].
6257 ** 6543 **
6258 ** <dl> 6544 ** <dl>
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
6317 ** slots were available. 6603 ** slots were available.
6318 ** </dd>)^ 6604 ** </dd>)^
6319 ** 6605 **
6320 ** [[SQLITE_STATUS_SCRATCH_SIZE]] ^(<dt>SQLITE_STATUS_SCRATCH_SIZE</dt> 6606 ** [[SQLITE_STATUS_SCRATCH_SIZE]] ^(<dt>SQLITE_STATUS_SCRATCH_SIZE</dt>
6321 ** <dd>This parameter records the largest memory allocation request 6607 ** <dd>This parameter records the largest memory allocation request
6322 ** handed to [scratch memory allocator]. Only the value returned in the 6608 ** handed to [scratch memory allocator]. Only the value returned in the
6323 ** *pHighwater parameter to [sqlite3_status()] is of interest. 6609 ** *pHighwater parameter to [sqlite3_status()] is of interest.
6324 ** The value written into the *pCurrent parameter is undefined.</dd>)^ 6610 ** The value written into the *pCurrent parameter is undefined.</dd>)^
6325 ** 6611 **
6326 ** [[SQLITE_STATUS_PARSER_STACK]] ^(<dt>SQLITE_STATUS_PARSER_STACK</dt> 6612 ** [[SQLITE_STATUS_PARSER_STACK]] ^(<dt>SQLITE_STATUS_PARSER_STACK</dt>
6327 ** <dd>This parameter records the deepest parser stack. It is only 6613 ** <dd>The *pHighwater parameter records the deepest parser stack.
6614 ** The *pCurrent value is undefined. The *pHighwater value is only
6328 ** meaningful if SQLite is compiled with [YYTRACKMAXSTACKDEPTH].</dd>)^ 6615 ** meaningful if SQLite is compiled with [YYTRACKMAXSTACKDEPTH].</dd>)^
6329 ** </dl> 6616 ** </dl>
6330 ** 6617 **
6331 ** New status parameters may be added from time to time. 6618 ** New status parameters may be added from time to time.
6332 */ 6619 */
6333 #define SQLITE_STATUS_MEMORY_USED 0 6620 #define SQLITE_STATUS_MEMORY_USED 0
6334 #define SQLITE_STATUS_PAGECACHE_USED 1 6621 #define SQLITE_STATUS_PAGECACHE_USED 1
6335 #define SQLITE_STATUS_PAGECACHE_OVERFLOW 2 6622 #define SQLITE_STATUS_PAGECACHE_OVERFLOW 2
6336 #define SQLITE_STATUS_SCRATCH_USED 3 6623 #define SQLITE_STATUS_SCRATCH_USED 3
6337 #define SQLITE_STATUS_SCRATCH_OVERFLOW 4 6624 #define SQLITE_STATUS_SCRATCH_OVERFLOW 4
6338 #define SQLITE_STATUS_MALLOC_SIZE 5 6625 #define SQLITE_STATUS_MALLOC_SIZE 5
6339 #define SQLITE_STATUS_PARSER_STACK 6 6626 #define SQLITE_STATUS_PARSER_STACK 6
6340 #define SQLITE_STATUS_PAGECACHE_SIZE 7 6627 #define SQLITE_STATUS_PAGECACHE_SIZE 7
6341 #define SQLITE_STATUS_SCRATCH_SIZE 8 6628 #define SQLITE_STATUS_SCRATCH_SIZE 8
6342 #define SQLITE_STATUS_MALLOC_COUNT 9 6629 #define SQLITE_STATUS_MALLOC_COUNT 9
6343 6630
6344 /* 6631 /*
6345 ** CAPI3REF: Database Connection Status 6632 ** CAPI3REF: Database Connection Status
6633 ** METHOD: sqlite3
6346 ** 6634 **
6347 ** ^This interface is used to retrieve runtime status information 6635 ** ^This interface is used to retrieve runtime status information
6348 ** about a single [database connection]. ^The first argument is the 6636 ** about a single [database connection]. ^The first argument is the
6349 ** database connection object to be interrogated. ^The second argument 6637 ** database connection object to be interrogated. ^The second argument
6350 ** is an integer constant, taken from the set of 6638 ** is an integer constant, taken from the set of
6351 ** [SQLITE_DBSTATUS options], that 6639 ** [SQLITE_DBSTATUS options], that
6352 ** determines the parameter to interrogate. The set of 6640 ** determines the parameter to interrogate. The set of
6353 ** [SQLITE_DBSTATUS options] is likely 6641 ** [SQLITE_DBSTATUS options] is likely
6354 ** to grow in future releases of SQLite. 6642 ** to grow in future releases of SQLite.
6355 ** 6643 **
6356 ** ^The current value of the requested parameter is written into *pCur 6644 ** ^The current value of the requested parameter is written into *pCur
6357 ** and the highest instantaneous value is written into *pHiwtr. ^If 6645 ** and the highest instantaneous value is written into *pHiwtr. ^If
6358 ** the resetFlg is true, then the highest instantaneous value is 6646 ** the resetFlg is true, then the highest instantaneous value is
6359 ** reset back down to the current value. 6647 ** reset back down to the current value.
6360 ** 6648 **
6361 ** ^The sqlite3_db_status() routine returns SQLITE_OK on success and a 6649 ** ^The sqlite3_db_status() routine returns SQLITE_OK on success and a
6362 ** non-zero [error code] on failure. 6650 ** non-zero [error code] on failure.
6363 ** 6651 **
6364 ** See also: [sqlite3_status()] and [sqlite3_stmt_status()]. 6652 ** See also: [sqlite3_status()] and [sqlite3_stmt_status()].
6365 */ 6653 */
6366 SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r esetFlg); 6654 SQLITE_API int SQLITE_STDCALL sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
6367 6655
6368 /* 6656 /*
6369 ** CAPI3REF: Status Parameters for database connections 6657 ** CAPI3REF: Status Parameters for database connections
6370 ** KEYWORDS: {SQLITE_DBSTATUS options} 6658 ** KEYWORDS: {SQLITE_DBSTATUS options}
6371 ** 6659 **
6372 ** These constants are the available integer "verbs" that can be passed as 6660 ** These constants are the available integer "verbs" that can be passed as
6373 ** the second argument to the [sqlite3_db_status()] interface. 6661 ** the second argument to the [sqlite3_db_status()] interface.
6374 ** 6662 **
6375 ** New verbs may be added in future releases of SQLite. Existing verbs 6663 ** New verbs may be added in future releases of SQLite. Existing verbs
6376 ** might be discontinued. Applications should check the return code from 6664 ** might be discontinued. Applications should check the return code from
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
6464 #define SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL 6 6752 #define SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL 6
6465 #define SQLITE_DBSTATUS_CACHE_HIT 7 6753 #define SQLITE_DBSTATUS_CACHE_HIT 7
6466 #define SQLITE_DBSTATUS_CACHE_MISS 8 6754 #define SQLITE_DBSTATUS_CACHE_MISS 8
6467 #define SQLITE_DBSTATUS_CACHE_WRITE 9 6755 #define SQLITE_DBSTATUS_CACHE_WRITE 9
6468 #define SQLITE_DBSTATUS_DEFERRED_FKS 10 6756 #define SQLITE_DBSTATUS_DEFERRED_FKS 10
6469 #define SQLITE_DBSTATUS_MAX 10 /* Largest defined DBSTATUS */ 6757 #define SQLITE_DBSTATUS_MAX 10 /* Largest defined DBSTATUS */
6470 6758
6471 6759
6472 /* 6760 /*
6473 ** CAPI3REF: Prepared Statement Status 6761 ** CAPI3REF: Prepared Statement Status
6762 ** METHOD: sqlite3_stmt
6474 ** 6763 **
6475 ** ^(Each prepared statement maintains various 6764 ** ^(Each prepared statement maintains various
6476 ** [SQLITE_STMTSTATUS counters] that measure the number 6765 ** [SQLITE_STMTSTATUS counters] that measure the number
6477 ** of times it has performed specific operations.)^ These counters can 6766 ** of times it has performed specific operations.)^ These counters can
6478 ** be used to monitor the performance characteristics of the prepared 6767 ** be used to monitor the performance characteristics of the prepared
6479 ** statements. For example, if the number of table steps greatly exceeds 6768 ** statements. For example, if the number of table steps greatly exceeds
6480 ** the number of table searches or result rows, that would tend to indicate 6769 ** the number of table searches or result rows, that would tend to indicate
6481 ** that the prepared statement is using a full table scan rather than 6770 ** that the prepared statement is using a full table scan rather than
6482 ** an index. 6771 ** an index.
6483 ** 6772 **
6484 ** ^(This interface is used to retrieve and reset counter values from 6773 ** ^(This interface is used to retrieve and reset counter values from
6485 ** a [prepared statement]. The first argument is the prepared statement 6774 ** a [prepared statement]. The first argument is the prepared statement
6486 ** object to be interrogated. The second argument 6775 ** object to be interrogated. The second argument
6487 ** is an integer code for a specific [SQLITE_STMTSTATUS counter] 6776 ** is an integer code for a specific [SQLITE_STMTSTATUS counter]
6488 ** to be interrogated.)^ 6777 ** to be interrogated.)^
6489 ** ^The current value of the requested counter is returned. 6778 ** ^The current value of the requested counter is returned.
6490 ** ^If the resetFlg is true, then the counter is reset to zero after this 6779 ** ^If the resetFlg is true, then the counter is reset to zero after this
6491 ** interface call returns. 6780 ** interface call returns.
6492 ** 6781 **
6493 ** See also: [sqlite3_status()] and [sqlite3_db_status()]. 6782 ** See also: [sqlite3_status()] and [sqlite3_db_status()].
6494 */ 6783 */
6495 SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg); 6784 SQLITE_API int SQLITE_STDCALL sqlite3_stmt_status(sqlite3_stmt*, int op,int rese tFlg);
6496 6785
6497 /* 6786 /*
6498 ** CAPI3REF: Status Parameters for prepared statements 6787 ** CAPI3REF: Status Parameters for prepared statements
6499 ** KEYWORDS: {SQLITE_STMTSTATUS counter} {SQLITE_STMTSTATUS counters} 6788 ** KEYWORDS: {SQLITE_STMTSTATUS counter} {SQLITE_STMTSTATUS counters}
6500 ** 6789 **
6501 ** These preprocessor macros define integer codes that name counter 6790 ** These preprocessor macros define integer codes that name counter
6502 ** values associated with the [sqlite3_stmt_status()] interface. 6791 ** values associated with the [sqlite3_stmt_status()] interface.
6503 ** The meanings of the various counters are as follows: 6792 ** The meanings of the various counters are as follows:
6504 ** 6793 **
6505 ** <dl> 6794 ** <dl>
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
6812 ** ^The database name is "main" for the main database, "temp" for the 7101 ** ^The database name is "main" for the main database, "temp" for the
6813 ** temporary database, or the name specified after the AS keyword in 7102 ** temporary database, or the name specified after the AS keyword in
6814 ** an [ATTACH] statement for an attached database. 7103 ** an [ATTACH] statement for an attached database.
6815 ** ^The S and M arguments passed to 7104 ** ^The S and M arguments passed to
6816 ** sqlite3_backup_init(D,N,S,M) identify the [database connection] 7105 ** sqlite3_backup_init(D,N,S,M) identify the [database connection]
6817 ** and database name of the source database, respectively. 7106 ** and database name of the source database, respectively.
6818 ** ^The source and destination [database connections] (parameters S and D) 7107 ** ^The source and destination [database connections] (parameters S and D)
6819 ** must be different or else sqlite3_backup_init(D,N,S,M) will fail with 7108 ** must be different or else sqlite3_backup_init(D,N,S,M) will fail with
6820 ** an error. 7109 ** an error.
6821 ** 7110 **
7111 ** ^A call to sqlite3_backup_init() will fail, returning SQLITE_ERROR, if
7112 ** there is already a read or read-write transaction open on the
7113 ** destination database.
7114 **
6822 ** ^If an error occurs within sqlite3_backup_init(D,N,S,M), then NULL is 7115 ** ^If an error occurs within sqlite3_backup_init(D,N,S,M), then NULL is
6823 ** returned and an error code and error message are stored in the 7116 ** returned and an error code and error message are stored in the
6824 ** destination [database connection] D. 7117 ** destination [database connection] D.
6825 ** ^The error code and message for the failed call to sqlite3_backup_init() 7118 ** ^The error code and message for the failed call to sqlite3_backup_init()
6826 ** can be retrieved using the [sqlite3_errcode()], [sqlite3_errmsg()], and/or 7119 ** can be retrieved using the [sqlite3_errcode()], [sqlite3_errmsg()], and/or
6827 ** [sqlite3_errmsg16()] functions. 7120 ** [sqlite3_errmsg16()] functions.
6828 ** ^A successful call to sqlite3_backup_init() returns a pointer to an 7121 ** ^A successful call to sqlite3_backup_init() returns a pointer to an
6829 ** [sqlite3_backup] object. 7122 ** [sqlite3_backup] object.
6830 ** ^The [sqlite3_backup] object may be used with the sqlite3_backup_step() and 7123 ** ^The [sqlite3_backup] object may be used with the sqlite3_backup_step() and
6831 ** sqlite3_backup_finish() functions to perform the specified backup 7124 ** sqlite3_backup_finish() functions to perform the specified backup
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
6904 ** sqlite3_backup_step() errors occurred, regardless or whether or not 7197 ** sqlite3_backup_step() errors occurred, regardless or whether or not
6905 ** sqlite3_backup_step() completed. 7198 ** sqlite3_backup_step() completed.
6906 ** ^If an out-of-memory condition or IO error occurred during any prior 7199 ** ^If an out-of-memory condition or IO error occurred during any prior
6907 ** sqlite3_backup_step() call on the same [sqlite3_backup] object, then 7200 ** sqlite3_backup_step() call on the same [sqlite3_backup] object, then
6908 ** sqlite3_backup_finish() returns the corresponding [error code]. 7201 ** sqlite3_backup_finish() returns the corresponding [error code].
6909 ** 7202 **
6910 ** ^A return of [SQLITE_BUSY] or [SQLITE_LOCKED] from sqlite3_backup_step() 7203 ** ^A return of [SQLITE_BUSY] or [SQLITE_LOCKED] from sqlite3_backup_step()
6911 ** is not a permanent error and does not affect the return value of 7204 ** is not a permanent error and does not affect the return value of
6912 ** sqlite3_backup_finish(). 7205 ** sqlite3_backup_finish().
6913 ** 7206 **
6914 ** [[sqlite3_backup__remaining()]] [[sqlite3_backup_pagecount()]] 7207 ** [[sqlite3_backup_remaining()]] [[sqlite3_backup_pagecount()]]
6915 ** <b>sqlite3_backup_remaining() and sqlite3_backup_pagecount()</b> 7208 ** <b>sqlite3_backup_remaining() and sqlite3_backup_pagecount()</b>
6916 ** 7209 **
6917 ** ^Each call to sqlite3_backup_step() sets two values inside 7210 ** ^The sqlite3_backup_remaining() routine returns the number of pages still
6918 ** the [sqlite3_backup] object: the number of pages still to be backed 7211 ** to be backed up at the conclusion of the most recent sqlite3_backup_step().
6919 ** up and the total number of pages in the source database file. 7212 ** ^The sqlite3_backup_pagecount() routine returns the total number of pages
6920 ** The sqlite3_backup_remaining() and sqlite3_backup_pagecount() interfaces 7213 ** in the source database at the conclusion of the most recent
6921 ** retrieve these two values, respectively. 7214 ** sqlite3_backup_step().
6922 ** 7215 ** ^(The values returned by these functions are only updated by
6923 ** ^The values returned by these functions are only updated by 7216 ** sqlite3_backup_step(). If the source database is modified in a way that
6924 ** sqlite3_backup_step(). ^If the source database is modified during a backup 7217 ** changes the size of the source database or the number of pages remaining,
6925 ** operation, then the values are not updated to account for any extra 7218 ** those changes are not reflected in the output of sqlite3_backup_pagecount()
6926 ** pages that need to be updated or the size of the source database file 7219 ** and sqlite3_backup_remaining() until after the next
6927 ** changing. 7220 ** sqlite3_backup_step().)^
6928 ** 7221 **
6929 ** <b>Concurrent Usage of Database Handles</b> 7222 ** <b>Concurrent Usage of Database Handles</b>
6930 ** 7223 **
6931 ** ^The source [database connection] may be used by the application for other 7224 ** ^The source [database connection] may be used by the application for other
6932 ** purposes while a backup operation is underway or being initialized. 7225 ** purposes while a backup operation is underway or being initialized.
6933 ** ^If SQLite is compiled and configured to support threadsafe database 7226 ** ^If SQLite is compiled and configured to support threadsafe database
6934 ** connections, then the source database connection may be used concurrently 7227 ** connections, then the source database connection may be used concurrently
6935 ** from within other threads. 7228 ** from within other threads.
6936 ** 7229 **
6937 ** However, the application must guarantee that the destination 7230 ** However, the application must guarantee that the destination
(...skipping 12 matching lines...) Expand all
6950 ** backed up to is not accessed by any connection within the process, 7243 ** backed up to is not accessed by any connection within the process,
6951 ** not just the specific connection that was passed to sqlite3_backup_init(). 7244 ** not just the specific connection that was passed to sqlite3_backup_init().
6952 ** 7245 **
6953 ** The [sqlite3_backup] object itself is partially threadsafe. Multiple 7246 ** The [sqlite3_backup] object itself is partially threadsafe. Multiple
6954 ** threads may safely make multiple concurrent calls to sqlite3_backup_step(). 7247 ** threads may safely make multiple concurrent calls to sqlite3_backup_step().
6955 ** However, the sqlite3_backup_remaining() and sqlite3_backup_pagecount() 7248 ** However, the sqlite3_backup_remaining() and sqlite3_backup_pagecount()
6956 ** APIs are not strictly speaking threadsafe. If they are invoked at the 7249 ** APIs are not strictly speaking threadsafe. If they are invoked at the
6957 ** same time as another thread is invoking sqlite3_backup_step() it is 7250 ** same time as another thread is invoking sqlite3_backup_step() it is
6958 ** possible that they return invalid values. 7251 ** possible that they return invalid values.
6959 */ 7252 */
6960 SQLITE_API sqlite3_backup *sqlite3_backup_init( 7253 SQLITE_API sqlite3_backup *SQLITE_STDCALL sqlite3_backup_init(
6961 sqlite3 *pDest, /* Destination database handle */ 7254 sqlite3 *pDest, /* Destination database handle */
6962 const char *zDestName, /* Destination database name */ 7255 const char *zDestName, /* Destination database name */
6963 sqlite3 *pSource, /* Source database handle */ 7256 sqlite3 *pSource, /* Source database handle */
6964 const char *zSourceName /* Source database name */ 7257 const char *zSourceName /* Source database name */
6965 ); 7258 );
6966 SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage); 7259 SQLITE_API int SQLITE_STDCALL sqlite3_backup_step(sqlite3_backup *p, int nPage);
6967 SQLITE_API int sqlite3_backup_finish(sqlite3_backup *p); 7260 SQLITE_API int SQLITE_STDCALL sqlite3_backup_finish(sqlite3_backup *p);
6968 SQLITE_API int sqlite3_backup_remaining(sqlite3_backup *p); 7261 SQLITE_API int SQLITE_STDCALL sqlite3_backup_remaining(sqlite3_backup *p);
6969 SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p); 7262 SQLITE_API int SQLITE_STDCALL sqlite3_backup_pagecount(sqlite3_backup *p);
6970 7263
6971 /* 7264 /*
6972 ** CAPI3REF: Unlock Notification 7265 ** CAPI3REF: Unlock Notification
7266 ** METHOD: sqlite3
6973 ** 7267 **
6974 ** ^When running in shared-cache mode, a database operation may fail with 7268 ** ^When running in shared-cache mode, a database operation may fail with
6975 ** an [SQLITE_LOCKED] error if the required locks on the shared-cache or 7269 ** an [SQLITE_LOCKED] error if the required locks on the shared-cache or
6976 ** individual tables within the shared-cache cannot be obtained. See 7270 ** individual tables within the shared-cache cannot be obtained. See
6977 ** [SQLite Shared-Cache Mode] for a description of shared-cache locking. 7271 ** [SQLite Shared-Cache Mode] for a description of shared-cache locking.
6978 ** ^This API may be used to register a callback that SQLite will invoke 7272 ** ^This API may be used to register a callback that SQLite will invoke
6979 ** when the connection currently holding the required lock relinquishes it. 7273 ** when the connection currently holding the required lock relinquishes it.
6980 ** ^This API is only available if the library was compiled with the 7274 ** ^This API is only available if the library was compiled with the
6981 ** [SQLITE_ENABLE_UNLOCK_NOTIFY] C-preprocessor symbol defined. 7275 ** [SQLITE_ENABLE_UNLOCK_NOTIFY] C-preprocessor symbol defined.
6982 ** 7276 **
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
7075 ** sqlite3_unlock_notify() results in the unlock-notify callback being 7369 ** sqlite3_unlock_notify() results in the unlock-notify callback being
7076 ** invoked immediately. If the application then re-attempts the "DROP TABLE" 7370 ** invoked immediately. If the application then re-attempts the "DROP TABLE"
7077 ** or "DROP INDEX" query, an infinite loop might be the result. 7371 ** or "DROP INDEX" query, an infinite loop might be the result.
7078 ** 7372 **
7079 ** One way around this problem is to check the extended error code returned 7373 ** One way around this problem is to check the extended error code returned
7080 ** by an sqlite3_step() call. ^(If there is a blocking connection, then the 7374 ** by an sqlite3_step() call. ^(If there is a blocking connection, then the
7081 ** extended error code is set to SQLITE_LOCKED_SHAREDCACHE. Otherwise, in 7375 ** extended error code is set to SQLITE_LOCKED_SHAREDCACHE. Otherwise, in
7082 ** the special "DROP TABLE/INDEX" case, the extended error code is just 7376 ** the special "DROP TABLE/INDEX" case, the extended error code is just
7083 ** SQLITE_LOCKED.)^ 7377 ** SQLITE_LOCKED.)^
7084 */ 7378 */
7085 SQLITE_API int sqlite3_unlock_notify( 7379 SQLITE_API int SQLITE_STDCALL sqlite3_unlock_notify(
7086 sqlite3 *pBlocked, /* Waiting connection */ 7380 sqlite3 *pBlocked, /* Waiting connection */
7087 void (*xNotify)(void **apArg, int nArg), /* Callback function to invoke */ 7381 void (*xNotify)(void **apArg, int nArg), /* Callback function to invoke */
7088 void *pNotifyArg /* Argument to pass to xNotify */ 7382 void *pNotifyArg /* Argument to pass to xNotify */
7089 ); 7383 );
7090 7384
7091 7385
7092 /* 7386 /*
7093 ** CAPI3REF: String Comparison 7387 ** CAPI3REF: String Comparison
7094 ** 7388 **
7095 ** ^The [sqlite3_stricmp()] and [sqlite3_strnicmp()] APIs allow applications 7389 ** ^The [sqlite3_stricmp()] and [sqlite3_strnicmp()] APIs allow applications
7096 ** and extensions to compare the contents of two buffers containing UTF-8 7390 ** and extensions to compare the contents of two buffers containing UTF-8
7097 ** strings in a case-independent fashion, using the same definition of "case 7391 ** strings in a case-independent fashion, using the same definition of "case
7098 ** independence" that SQLite uses internally when comparing identifiers. 7392 ** independence" that SQLite uses internally when comparing identifiers.
7099 */ 7393 */
7100 SQLITE_API int sqlite3_stricmp(const char *, const char *); 7394 SQLITE_API int SQLITE_STDCALL sqlite3_stricmp(const char *, const char *);
7101 SQLITE_API int sqlite3_strnicmp(const char *, const char *, int); 7395 SQLITE_API int SQLITE_STDCALL sqlite3_strnicmp(const char *, const char *, int);
7102 7396
7103 /* 7397 /*
7104 ** CAPI3REF: String Globbing 7398 ** CAPI3REF: String Globbing
7105 * 7399 *
7106 ** ^The [sqlite3_strglob(P,X)] interface returns zero if string X matches 7400 ** ^The [sqlite3_strglob(P,X)] interface returns zero if and only if
7107 ** the glob pattern P, and it returns non-zero if string X does not match 7401 ** string X matches the [GLOB] pattern P.
7108 ** the glob pattern P. ^The definition of glob pattern matching used in 7402 ** ^The definition of [GLOB] pattern matching used in
7109 ** [sqlite3_strglob(P,X)] is the same as for the "X GLOB P" operator in the 7403 ** [sqlite3_strglob(P,X)] is the same as for the "X GLOB P" operator in the
7110 ** SQL dialect used by SQLite. ^The sqlite3_strglob(P,X) function is case 7404 ** SQL dialect understood by SQLite. ^The [sqlite3_strglob(P,X)] function
7111 ** sensitive. 7405 ** is case sensitive.
7112 ** 7406 **
7113 ** Note that this routine returns zero on a match and non-zero if the strings 7407 ** Note that this routine returns zero on a match and non-zero if the strings
7114 ** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()]. 7408 ** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()].
7409 **
7410 ** See also: [sqlite3_strlike()].
7115 */ 7411 */
7116 SQLITE_API int sqlite3_strglob(const char *zGlob, const char *zStr); 7412 SQLITE_API int SQLITE_STDCALL sqlite3_strglob(const char *zGlob, const char *zSt r);
7413
7414 /* Begin recover virtual table patch for Chromium */
7415 /* Our patches don't conform to SQLite's amalgamation processing. Hack it. */
7416 #ifndef CHROMIUM_SQLITE_API
7417 #define CHROMIUM_SQLITE_API SQLITE_API
7418 #endif
7419 /*
7420 ** Call to initialize the recover virtual-table modules (see recover.c).
7421 **
7422 ** This could be loaded by default in main.c, but that would make the
7423 ** virtual table available to Web SQL. Breaking it out allows only
7424 ** selected users to enable it (currently sql/recovery.cc).
7425 */
7426 CHROMIUM_SQLITE_API
7427 int recoverVtableInit(sqlite3 *db);
7428 /* End recover virtual table patch for Chromium */
7429
7430 /* Begin WebDatabase patch for Chromium */
7431 /* Expose some SQLite internals for the WebDatabase vfs.
7432 ** DO NOT EXTEND THE USE OF THIS.
7433 */
7434 #ifndef CHROMIUM_SQLITE_API
7435 #define CHROMIUM_SQLITE_API SQLITE_API
7436 #endif
7437 #if defined(CHROMIUM_SQLITE_INTERNALS)
7438 #ifdef _WIN32
7439 CHROMIUM_SQLITE_API
7440 void chromium_sqlite3_initialize_win_sqlite3_file(sqlite3_file* file, HANDLE han dle);
7441 #else /* _WIN32 */
7442 CHROMIUM_SQLITE_API
7443 int chromium_sqlite3_fill_in_unix_sqlite3_file(sqlite3_vfs* pVfs,
7444 int fd,
7445 sqlite3_file* pFile,
7446 const char* zPath,
7447 int noLock,
7448 int flags);
7449 #endif /* _WIN32 */
7450 #endif /* CHROMIUM_SQLITE_INTERNALS */
7451 /* End WebDatabase patch for Chromium */
7452
7453 /*
7454 ** CAPI3REF: String LIKE Matching
7455 *
7456 ** ^The [sqlite3_strlike(P,X,E)] interface returns zero if and only if
7457 ** string X matches the [LIKE] pattern P with escape character E.
7458 ** ^The definition of [LIKE] pattern matching used in
7459 ** [sqlite3_strlike(P,X,E)] is the same as for the "X LIKE P ESCAPE E"
7460 ** operator in the SQL dialect understood by SQLite. ^For "X LIKE P" without
7461 ** the ESCAPE clause, set the E parameter of [sqlite3_strlike(P,X,E)] to 0.
7462 ** ^As with the LIKE operator, the [sqlite3_strlike(P,X,E)] function is case
7463 ** insensitive - equivalent upper and lower case ASCII characters match
7464 ** one another.
7465 **
7466 ** ^The [sqlite3_strlike(P,X,E)] function matches Unicode characters, though
7467 ** only ASCII characters are case folded.
7468 **
7469 ** Note that this routine returns zero on a match and non-zero if the strings
7470 ** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()].
7471 **
7472 ** See also: [sqlite3_strglob()].
7473 */
7474 SQLITE_API int SQLITE_STDCALL sqlite3_strlike(const char *zGlob, const char *zSt r, unsigned int cEsc);
7117 7475
7118 /* 7476 /*
7119 ** CAPI3REF: Error Logging Interface 7477 ** CAPI3REF: Error Logging Interface
7120 ** 7478 **
7121 ** ^The [sqlite3_log()] interface writes a message into the [error log] 7479 ** ^The [sqlite3_log()] interface writes a message into the [error log]
7122 ** established by the [SQLITE_CONFIG_LOG] option to [sqlite3_config()]. 7480 ** established by the [SQLITE_CONFIG_LOG] option to [sqlite3_config()].
7123 ** ^If logging is enabled, the zFormat string and subsequent arguments are 7481 ** ^If logging is enabled, the zFormat string and subsequent arguments are
7124 ** used with [sqlite3_snprintf()] to generate the final output string. 7482 ** used with [sqlite3_snprintf()] to generate the final output string.
7125 ** 7483 **
7126 ** The sqlite3_log() interface is intended for use by extensions such as 7484 ** The sqlite3_log() interface is intended for use by extensions such as
7127 ** virtual tables, collating functions, and SQL functions. While there is 7485 ** virtual tables, collating functions, and SQL functions. While there is
7128 ** nothing to prevent an application from calling sqlite3_log(), doing so 7486 ** nothing to prevent an application from calling sqlite3_log(), doing so
7129 ** is considered bad form. 7487 ** is considered bad form.
7130 ** 7488 **
7131 ** The zFormat string must not be NULL. 7489 ** The zFormat string must not be NULL.
7132 ** 7490 **
7133 ** To avoid deadlocks and other threading problems, the sqlite3_log() routine 7491 ** To avoid deadlocks and other threading problems, the sqlite3_log() routine
7134 ** will not use dynamically allocated memory. The log message is stored in 7492 ** will not use dynamically allocated memory. The log message is stored in
7135 ** a fixed-length buffer on the stack. If the log message is longer than 7493 ** a fixed-length buffer on the stack. If the log message is longer than
7136 ** a few hundred characters, it will be truncated to the length of the 7494 ** a few hundred characters, it will be truncated to the length of the
7137 ** buffer. 7495 ** buffer.
7138 */ 7496 */
7139 SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...); 7497 SQLITE_API void SQLITE_CDECL sqlite3_log(int iErrCode, const char *zFormat, ...) ;
7140 7498
7141 /* 7499 /*
7142 ** CAPI3REF: Write-Ahead Log Commit Hook 7500 ** CAPI3REF: Write-Ahead Log Commit Hook
7501 ** METHOD: sqlite3
7143 ** 7502 **
7144 ** ^The [sqlite3_wal_hook()] function is used to register a callback that 7503 ** ^The [sqlite3_wal_hook()] function is used to register a callback that
7145 ** will be invoked each time a database connection commits data to a 7504 ** is invoked each time data is committed to a database in wal mode.
7146 ** [write-ahead log] (i.e. whenever a transaction is committed in
7147 ** [journal_mode | journal_mode=WAL mode]).
7148 ** 7505 **
7149 ** ^The callback is invoked by SQLite after the commit has taken place and 7506 ** ^(The callback is invoked by SQLite after the commit has taken place and
7150 ** the associated write-lock on the database released, so the implementation 7507 ** the associated write-lock on the database released)^, so the implementation
7151 ** may read, write or [checkpoint] the database as required. 7508 ** may read, write or [checkpoint] the database as required.
7152 ** 7509 **
7153 ** ^The first parameter passed to the callback function when it is invoked 7510 ** ^The first parameter passed to the callback function when it is invoked
7154 ** is a copy of the third parameter passed to sqlite3_wal_hook() when 7511 ** is a copy of the third parameter passed to sqlite3_wal_hook() when
7155 ** registering the callback. ^The second is a copy of the database handle. 7512 ** registering the callback. ^The second is a copy of the database handle.
7156 ** ^The third parameter is the name of the database that was written to - 7513 ** ^The third parameter is the name of the database that was written to -
7157 ** either "main" or the name of an [ATTACH]-ed database. ^The fourth parameter 7514 ** either "main" or the name of an [ATTACH]-ed database. ^The fourth parameter
7158 ** is the number of pages currently in the write-ahead log file, 7515 ** is the number of pages currently in the write-ahead log file,
7159 ** including those that were just committed. 7516 ** including those that were just committed.
7160 ** 7517 **
7161 ** The callback function should normally return [SQLITE_OK]. ^If an error 7518 ** The callback function should normally return [SQLITE_OK]. ^If an error
7162 ** code is returned, that error will propagate back up through the 7519 ** code is returned, that error will propagate back up through the
7163 ** SQLite code base to cause the statement that provoked the callback 7520 ** SQLite code base to cause the statement that provoked the callback
7164 ** to report an error, though the commit will have still occurred. If the 7521 ** to report an error, though the commit will have still occurred. If the
7165 ** callback returns [SQLITE_ROW] or [SQLITE_DONE], or if it returns a value 7522 ** callback returns [SQLITE_ROW] or [SQLITE_DONE], or if it returns a value
7166 ** that does not correspond to any valid SQLite error code, the results 7523 ** that does not correspond to any valid SQLite error code, the results
7167 ** are undefined. 7524 ** are undefined.
7168 ** 7525 **
7169 ** A single database handle may have at most a single write-ahead log callback 7526 ** A single database handle may have at most a single write-ahead log callback
7170 ** registered at one time. ^Calling [sqlite3_wal_hook()] replaces any 7527 ** registered at one time. ^Calling [sqlite3_wal_hook()] replaces any
7171 ** previously registered write-ahead log callback. ^Note that the 7528 ** previously registered write-ahead log callback. ^Note that the
7172 ** [sqlite3_wal_autocheckpoint()] interface and the 7529 ** [sqlite3_wal_autocheckpoint()] interface and the
7173 ** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will 7530 ** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will
7174 ** those overwrite any prior [sqlite3_wal_hook()] settings. 7531 ** those overwrite any prior [sqlite3_wal_hook()] settings.
7175 */ 7532 */
7176 SQLITE_API void *sqlite3_wal_hook( 7533 SQLITE_API void *SQLITE_STDCALL sqlite3_wal_hook(
7177 sqlite3*, 7534 sqlite3*,
7178 int(*)(void *,sqlite3*,const char*,int), 7535 int(*)(void *,sqlite3*,const char*,int),
7179 void* 7536 void*
7180 ); 7537 );
7181 7538
7182 /* 7539 /*
7183 ** CAPI3REF: Configure an auto-checkpoint 7540 ** CAPI3REF: Configure an auto-checkpoint
7541 ** METHOD: sqlite3
7184 ** 7542 **
7185 ** ^The [sqlite3_wal_autocheckpoint(D,N)] is a wrapper around 7543 ** ^The [sqlite3_wal_autocheckpoint(D,N)] is a wrapper around
7186 ** [sqlite3_wal_hook()] that causes any database on [database connection] D 7544 ** [sqlite3_wal_hook()] that causes any database on [database connection] D
7187 ** to automatically [checkpoint] 7545 ** to automatically [checkpoint]
7188 ** after committing a transaction if there are N or 7546 ** after committing a transaction if there are N or
7189 ** more frames in the [write-ahead log] file. ^Passing zero or 7547 ** more frames in the [write-ahead log] file. ^Passing zero or
7190 ** a negative value as the nFrame parameter disables automatic 7548 ** a negative value as the nFrame parameter disables automatic
7191 ** checkpoints entirely. 7549 ** checkpoints entirely.
7192 ** 7550 **
7193 ** ^The callback registered by this function replaces any existing callback 7551 ** ^The callback registered by this function replaces any existing callback
7194 ** registered using [sqlite3_wal_hook()]. ^Likewise, registering a callback 7552 ** registered using [sqlite3_wal_hook()]. ^Likewise, registering a callback
7195 ** using [sqlite3_wal_hook()] disables the automatic checkpoint mechanism 7553 ** using [sqlite3_wal_hook()] disables the automatic checkpoint mechanism
7196 ** configured by this function. 7554 ** configured by this function.
7197 ** 7555 **
7198 ** ^The [wal_autocheckpoint pragma] can be used to invoke this interface 7556 ** ^The [wal_autocheckpoint pragma] can be used to invoke this interface
7199 ** from SQL. 7557 ** from SQL.
7200 ** 7558 **
7201 ** ^Checkpoints initiated by this mechanism are 7559 ** ^Checkpoints initiated by this mechanism are
7202 ** [sqlite3_wal_checkpoint_v2|PASSIVE]. 7560 ** [sqlite3_wal_checkpoint_v2|PASSIVE].
7203 ** 7561 **
7204 ** ^Every new [database connection] defaults to having the auto-checkpoint 7562 ** ^Every new [database connection] defaults to having the auto-checkpoint
7205 ** enabled with a threshold of 1000 or [SQLITE_DEFAULT_WAL_AUTOCHECKPOINT] 7563 ** enabled with a threshold of 1000 or [SQLITE_DEFAULT_WAL_AUTOCHECKPOINT]
7206 ** pages. The use of this interface 7564 ** pages. The use of this interface
7207 ** is only necessary if the default setting is found to be suboptimal 7565 ** is only necessary if the default setting is found to be suboptimal
7208 ** for a particular application. 7566 ** for a particular application.
7209 */ 7567 */
7210 SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N); 7568 SQLITE_API int SQLITE_STDCALL sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
7211 7569
7212 /* 7570 /*
7213 ** CAPI3REF: Checkpoint a database 7571 ** CAPI3REF: Checkpoint a database
7572 ** METHOD: sqlite3
7214 ** 7573 **
7215 ** ^The [sqlite3_wal_checkpoint(D,X)] interface causes database named X 7574 ** ^(The sqlite3_wal_checkpoint(D,X) is equivalent to
7216 ** on [database connection] D to be [checkpointed]. ^If X is NULL or an 7575 ** [sqlite3_wal_checkpoint_v2](D,X,[SQLITE_CHECKPOINT_PASSIVE],0,0).)^
7217 ** empty string, then a checkpoint is run on all databases of
7218 ** connection D. ^If the database connection D is not in
7219 ** [WAL | write-ahead log mode] then this interface is a harmless no-op.
7220 ** ^The [sqlite3_wal_checkpoint(D,X)] interface initiates a
7221 ** [sqlite3_wal_checkpoint_v2|PASSIVE] checkpoint.
7222 ** Use the [sqlite3_wal_checkpoint_v2()] interface to get a FULL
7223 ** or RESET checkpoint.
7224 ** 7576 **
7225 ** ^The [wal_checkpoint pragma] can be used to invoke this interface 7577 ** In brief, sqlite3_wal_checkpoint(D,X) causes the content in the
7226 ** from SQL. ^The [sqlite3_wal_autocheckpoint()] interface and the 7578 ** [write-ahead log] for database X on [database connection] D to be
7227 ** [wal_autocheckpoint pragma] can be used to cause this interface to be 7579 ** transferred into the database file and for the write-ahead log to
7228 ** run whenever the WAL reaches a certain size threshold. 7580 ** be reset. See the [checkpointing] documentation for addition
7581 ** information.
7229 ** 7582 **
7230 ** See also: [sqlite3_wal_checkpoint_v2()] 7583 ** This interface used to be the only way to cause a checkpoint to
7584 ** occur. But then the newer and more powerful [sqlite3_wal_checkpoint_v2()]
7585 ** interface was added. This interface is retained for backwards
7586 ** compatibility and as a convenience for applications that need to manually
7587 ** start a callback but which do not need the full power (and corresponding
7588 ** complication) of [sqlite3_wal_checkpoint_v2()].
7231 */ 7589 */
7232 SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb); 7590 SQLITE_API int SQLITE_STDCALL sqlite3_wal_checkpoint(sqlite3 *db, const char *zD b);
7233 7591
7234 /* 7592 /*
7235 ** CAPI3REF: Checkpoint a database 7593 ** CAPI3REF: Checkpoint a database
7594 ** METHOD: sqlite3
7236 ** 7595 **
7237 ** Run a checkpoint operation on WAL database zDb attached to database 7596 ** ^(The sqlite3_wal_checkpoint_v2(D,X,M,L,C) interface runs a checkpoint
7238 ** handle db. The specific operation is determined by the value of the 7597 ** operation on database X of [database connection] D in mode M. Status
7239 ** eMode parameter: 7598 ** information is written back into integers pointed to by L and C.)^
7599 ** ^(The M parameter must be a valid [checkpoint mode]:)^
7240 ** 7600 **
7241 ** <dl> 7601 ** <dl>
7242 ** <dt>SQLITE_CHECKPOINT_PASSIVE<dd> 7602 ** <dt>SQLITE_CHECKPOINT_PASSIVE<dd>
7243 ** Checkpoint as many frames as possible without waiting for any database 7603 ** ^Checkpoint as many frames as possible without waiting for any database
7244 ** readers or writers to finish. Sync the db file if all frames in the log 7604 ** readers or writers to finish, then sync the database file if all frames
7245 ** are checkpointed. This mode is the same as calling 7605 ** in the log were checkpointed. ^The [busy-handler callback]
7246 ** sqlite3_wal_checkpoint(). The [sqlite3_busy_handler|busy-handler callback] 7606 ** is never invoked in the SQLITE_CHECKPOINT_PASSIVE mode.
7247 ** is never invoked. 7607 ** ^On the other hand, passive mode might leave the checkpoint unfinished
7608 ** if there are concurrent readers or writers.
7248 ** 7609 **
7249 ** <dt>SQLITE_CHECKPOINT_FULL<dd> 7610 ** <dt>SQLITE_CHECKPOINT_FULL<dd>
7250 ** This mode blocks (it invokes the 7611 ** ^This mode blocks (it invokes the
7251 ** [sqlite3_busy_handler|busy-handler callback]) until there is no 7612 ** [sqlite3_busy_handler|busy-handler callback]) until there is no
7252 ** database writer and all readers are reading from the most recent database 7613 ** database writer and all readers are reading from the most recent database
7253 ** snapshot. It then checkpoints all frames in the log file and syncs the 7614 ** snapshot. ^It then checkpoints all frames in the log file and syncs the
7254 ** database file. This call blocks database writers while it is running, 7615 ** database file. ^This mode blocks new database writers while it is pending,
7255 ** but not database readers. 7616 ** but new database readers are allowed to continue unimpeded.
7256 ** 7617 **
7257 ** <dt>SQLITE_CHECKPOINT_RESTART<dd> 7618 ** <dt>SQLITE_CHECKPOINT_RESTART<dd>
7258 ** This mode works the same way as SQLITE_CHECKPOINT_FULL, except after 7619 ** ^This mode works the same way as SQLITE_CHECKPOINT_FULL with the addition
7259 ** checkpointing the log file it blocks (calls the 7620 ** that after checkpointing the log file it blocks (calls the
7260 ** [sqlite3_busy_handler|busy-handler callback]) 7621 ** [busy-handler callback])
7261 ** until all readers are reading from the database file only. This ensures 7622 ** until all readers are reading from the database file only. ^This ensures
7262 ** that the next client to write to the database file restarts the log file 7623 ** that the next writer will restart the log file from the beginning.
7263 ** from the beginning. This call blocks database writers while it is running, 7624 ** ^Like SQLITE_CHECKPOINT_FULL, this mode blocks new
7264 ** but not database readers. 7625 ** database writer attempts while it is pending, but does not impede readers.
7626 **
7627 ** <dt>SQLITE_CHECKPOINT_TRUNCATE<dd>
7628 ** ^This mode works the same way as SQLITE_CHECKPOINT_RESTART with the
7629 ** addition that it also truncates the log file to zero bytes just prior
7630 ** to a successful return.
7265 ** </dl> 7631 ** </dl>
7266 ** 7632 **
7267 ** If pnLog is not NULL, then *pnLog is set to the total number of frames in 7633 ** ^If pnLog is not NULL, then *pnLog is set to the total number of frames in
7268 ** the log file before returning. If pnCkpt is not NULL, then *pnCkpt is set to 7634 ** the log file or to -1 if the checkpoint could not run because
7269 ** the total number of checkpointed frames (including any that were already 7635 ** of an error or because the database is not in [WAL mode]. ^If pnCkpt is not
7270 ** checkpointed when this function is called). *pnLog and *pnCkpt may be 7636 ** NULL,then *pnCkpt is set to the total number of checkpointed frames in the
7271 ** populated even if sqlite3_wal_checkpoint_v2() returns other than SQLITE_OK. 7637 ** log file (including any that were already checkpointed before the function
7272 ** If no values are available because of an error, they are both set to -1 7638 ** was called) or to -1 if the checkpoint could not run due to an error or
7273 ** before returning to communicate this to the caller. 7639 ** because the database is not in WAL mode. ^Note that upon successful
7640 ** completion of an SQLITE_CHECKPOINT_TRUNCATE, the log file will have been
7641 ** truncated to zero bytes and so both *pnLog and *pnCkpt will be set to zero.
7274 ** 7642 **
7275 ** All calls obtain an exclusive "checkpoint" lock on the database file. If 7643 ** ^All calls obtain an exclusive "checkpoint" lock on the database file. ^If
7276 ** any other process is running a checkpoint operation at the same time, the 7644 ** any other process is running a checkpoint operation at the same time, the
7277 ** lock cannot be obtained and SQLITE_BUSY is returned. Even if there is a 7645 ** lock cannot be obtained and SQLITE_BUSY is returned. ^Even if there is a
7278 ** busy-handler configured, it will not be invoked in this case. 7646 ** busy-handler configured, it will not be invoked in this case.
7279 ** 7647 **
7280 ** The SQLITE_CHECKPOINT_FULL and RESTART modes also obtain the exclusive 7648 ** ^The SQLITE_CHECKPOINT_FULL, RESTART and TRUNCATE modes also obtain the
7281 ** "writer" lock on the database file. If the writer lock cannot be obtained 7649 ** exclusive "writer" lock on the database file. ^If the writer lock cannot be
7282 ** immediately, and a busy-handler is configured, it is invoked and the writer 7650 ** obtained immediately, and a busy-handler is configured, it is invoked and
7283 ** lock retried until either the busy-handler returns 0 or the lock is 7651 ** the writer lock retried until either the busy-handler returns 0 or the lock
7284 ** successfully obtained. The busy-handler is also invoked while waiting for 7652 ** is successfully obtained. ^The busy-handler is also invoked while waiting for
7285 ** database readers as described above. If the busy-handler returns 0 before 7653 ** database readers as described above. ^If the busy-handler returns 0 before
7286 ** the writer lock is obtained or while waiting for database readers, the 7654 ** the writer lock is obtained or while waiting for database readers, the
7287 ** checkpoint operation proceeds from that point in the same way as 7655 ** checkpoint operation proceeds from that point in the same way as
7288 ** SQLITE_CHECKPOINT_PASSIVE - checkpointing as many frames as possible 7656 ** SQLITE_CHECKPOINT_PASSIVE - checkpointing as many frames as possible
7289 ** without blocking any further. SQLITE_BUSY is returned in this case. 7657 ** without blocking any further. ^SQLITE_BUSY is returned in this case.
7290 ** 7658 **
7291 ** If parameter zDb is NULL or points to a zero length string, then the 7659 ** ^If parameter zDb is NULL or points to a zero length string, then the
7292 ** specified operation is attempted on all WAL databases. In this case the 7660 ** specified operation is attempted on all WAL databases [attached] to
7293 ** values written to output parameters *pnLog and *pnCkpt are undefined. If 7661 ** [database connection] db. In this case the
7662 ** values written to output parameters *pnLog and *pnCkpt are undefined. ^If
7294 ** an SQLITE_BUSY error is encountered when processing one or more of the 7663 ** an SQLITE_BUSY error is encountered when processing one or more of the
7295 ** attached WAL databases, the operation is still attempted on any remaining 7664 ** attached WAL databases, the operation is still attempted on any remaining
7296 ** attached databases and SQLITE_BUSY is returned to the caller. If any other 7665 ** attached databases and SQLITE_BUSY is returned at the end. ^If any other
7297 ** error occurs while processing an attached database, processing is abandoned 7666 ** error occurs while processing an attached database, processing is abandoned
7298 ** and the error code returned to the caller immediately. If no error 7667 ** and the error code is returned to the caller immediately. ^If no error
7299 ** (SQLITE_BUSY or otherwise) is encountered while processing the attached 7668 ** (SQLITE_BUSY or otherwise) is encountered while processing the attached
7300 ** databases, SQLITE_OK is returned. 7669 ** databases, SQLITE_OK is returned.
7301 ** 7670 **
7302 ** If database zDb is the name of an attached database that is not in WAL 7671 ** ^If database zDb is the name of an attached database that is not in WAL
7303 ** mode, SQLITE_OK is returned and both *pnLog and *pnCkpt set to -1. If 7672 ** mode, SQLITE_OK is returned and both *pnLog and *pnCkpt set to -1. ^If
7304 ** zDb is not NULL (or a zero length string) and is not the name of any 7673 ** zDb is not NULL (or a zero length string) and is not the name of any
7305 ** attached database, SQLITE_ERROR is returned to the caller. 7674 ** attached database, SQLITE_ERROR is returned to the caller.
7675 **
7676 ** ^Unless it returns SQLITE_MISUSE,
7677 ** the sqlite3_wal_checkpoint_v2() interface
7678 ** sets the error information that is queried by
7679 ** [sqlite3_errcode()] and [sqlite3_errmsg()].
7680 **
7681 ** ^The [PRAGMA wal_checkpoint] command can be used to invoke this interface
7682 ** from SQL.
7306 */ 7683 */
7307 SQLITE_API int sqlite3_wal_checkpoint_v2( 7684 SQLITE_API int SQLITE_STDCALL sqlite3_wal_checkpoint_v2(
7308 sqlite3 *db, /* Database handle */ 7685 sqlite3 *db, /* Database handle */
7309 const char *zDb, /* Name of attached database (or NULL) */ 7686 const char *zDb, /* Name of attached database (or NULL) */
7310 int eMode, /* SQLITE_CHECKPOINT_* value */ 7687 int eMode, /* SQLITE_CHECKPOINT_* value */
7311 int *pnLog, /* OUT: Size of WAL log in frames */ 7688 int *pnLog, /* OUT: Size of WAL log in frames */
7312 int *pnCkpt /* OUT: Total number of frames checkpointed */ 7689 int *pnCkpt /* OUT: Total number of frames checkpointed */
7313 ); 7690 );
7314 7691
7315 /* 7692 /*
7316 ** CAPI3REF: Checkpoint operation parameters 7693 ** CAPI3REF: Checkpoint Mode Values
7694 ** KEYWORDS: {checkpoint mode}
7317 ** 7695 **
7318 ** These constants can be used as the 3rd parameter to 7696 ** These constants define all valid values for the "checkpoint mode" passed
7319 ** [sqlite3_wal_checkpoint_v2()]. See the [sqlite3_wal_checkpoint_v2()] 7697 ** as the third parameter to the [sqlite3_wal_checkpoint_v2()] interface.
7320 ** documentation for additional information about the meaning and use of 7698 ** See the [sqlite3_wal_checkpoint_v2()] documentation for details on the
7321 ** each of these values. 7699 ** meaning of each of these checkpoint modes.
7322 */ 7700 */
7323 #define SQLITE_CHECKPOINT_PASSIVE 0 7701 #define SQLITE_CHECKPOINT_PASSIVE 0 /* Do as much as possible w/o blocking */
7324 #define SQLITE_CHECKPOINT_FULL 1 7702 #define SQLITE_CHECKPOINT_FULL 1 /* Wait for writers, then checkpoint */
7325 #define SQLITE_CHECKPOINT_RESTART 2 7703 #define SQLITE_CHECKPOINT_RESTART 2 /* Like FULL but wait for for readers */
7704 #define SQLITE_CHECKPOINT_TRUNCATE 3 /* Like RESTART but also truncate WAL */
7326 7705
7327 /* 7706 /*
7328 ** CAPI3REF: Virtual Table Interface Configuration 7707 ** CAPI3REF: Virtual Table Interface Configuration
7329 ** 7708 **
7330 ** This function may be called by either the [xConnect] or [xCreate] method 7709 ** This function may be called by either the [xConnect] or [xCreate] method
7331 ** of a [virtual table] implementation to configure 7710 ** of a [virtual table] implementation to configure
7332 ** various facets of the virtual table interface. 7711 ** various facets of the virtual table interface.
7333 ** 7712 **
7334 ** If this interface is invoked outside the context of an xConnect or 7713 ** If this interface is invoked outside the context of an xConnect or
7335 ** xCreate virtual table method then the behavior is undefined. 7714 ** xCreate virtual table method then the behavior is undefined.
7336 ** 7715 **
7337 ** At present, there is only one option that may be configured using 7716 ** At present, there is only one option that may be configured using
7338 ** this function. (See [SQLITE_VTAB_CONSTRAINT_SUPPORT].) Further options 7717 ** this function. (See [SQLITE_VTAB_CONSTRAINT_SUPPORT].) Further options
7339 ** may be added in the future. 7718 ** may be added in the future.
7340 */ 7719 */
7341 SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...); 7720 SQLITE_API int SQLITE_CDECL sqlite3_vtab_config(sqlite3*, int op, ...);
7342 7721
7343 /* 7722 /*
7344 ** CAPI3REF: Virtual Table Configuration Options 7723 ** CAPI3REF: Virtual Table Configuration Options
7345 ** 7724 **
7346 ** These macros define the various options to the 7725 ** These macros define the various options to the
7347 ** [sqlite3_vtab_config()] interface that [virtual table] implementations 7726 ** [sqlite3_vtab_config()] interface that [virtual table] implementations
7348 ** can use to customize and optimize their behavior. 7727 ** can use to customize and optimize their behavior.
7349 ** 7728 **
7350 ** <dl> 7729 ** <dl>
7351 ** <dt>SQLITE_VTAB_CONSTRAINT_SUPPORT 7730 ** <dt>SQLITE_VTAB_CONSTRAINT_SUPPORT
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
7384 /* 7763 /*
7385 ** CAPI3REF: Determine The Virtual Table Conflict Policy 7764 ** CAPI3REF: Determine The Virtual Table Conflict Policy
7386 ** 7765 **
7387 ** This function may only be called from within a call to the [xUpdate] method 7766 ** This function may only be called from within a call to the [xUpdate] method
7388 ** of a [virtual table] implementation for an INSERT or UPDATE operation. ^The 7767 ** of a [virtual table] implementation for an INSERT or UPDATE operation. ^The
7389 ** value returned is one of [SQLITE_ROLLBACK], [SQLITE_IGNORE], [SQLITE_FAIL], 7768 ** value returned is one of [SQLITE_ROLLBACK], [SQLITE_IGNORE], [SQLITE_FAIL],
7390 ** [SQLITE_ABORT], or [SQLITE_REPLACE], according to the [ON CONFLICT] mode 7769 ** [SQLITE_ABORT], or [SQLITE_REPLACE], according to the [ON CONFLICT] mode
7391 ** of the SQL statement that triggered the call to the [xUpdate] method of the 7770 ** of the SQL statement that triggered the call to the [xUpdate] method of the
7392 ** [virtual table]. 7771 ** [virtual table].
7393 */ 7772 */
7394 SQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *); 7773 SQLITE_API int SQLITE_STDCALL sqlite3_vtab_on_conflict(sqlite3 *);
7395 7774
7396 /* 7775 /*
7397 ** CAPI3REF: Conflict resolution modes 7776 ** CAPI3REF: Conflict resolution modes
7398 ** KEYWORDS: {conflict resolution mode} 7777 ** KEYWORDS: {conflict resolution mode}
7399 ** 7778 **
7400 ** These constants are returned by [sqlite3_vtab_on_conflict()] to 7779 ** These constants are returned by [sqlite3_vtab_on_conflict()] to
7401 ** inform a [virtual table] implementation what the [ON CONFLICT] mode 7780 ** inform a [virtual table] implementation what the [ON CONFLICT] mode
7402 ** is for the SQL statement being evaluated. 7781 ** is for the SQL statement being evaluated.
7403 ** 7782 **
7404 ** Note that the [SQLITE_IGNORE] constant is also used as a potential 7783 ** Note that the [SQLITE_IGNORE] constant is also used as a potential
7405 ** return value from the [sqlite3_set_authorizer()] callback and that 7784 ** return value from the [sqlite3_set_authorizer()] callback and that
7406 ** [SQLITE_ABORT] is also a [result code]. 7785 ** [SQLITE_ABORT] is also a [result code].
7407 */ 7786 */
7408 #define SQLITE_ROLLBACK 1 7787 #define SQLITE_ROLLBACK 1
7409 /* #define SQLITE_IGNORE 2 // Also used by sqlite3_authorizer() callback */ 7788 /* #define SQLITE_IGNORE 2 // Also used by sqlite3_authorizer() callback */
7410 #define SQLITE_FAIL 3 7789 #define SQLITE_FAIL 3
7411 /* #define SQLITE_ABORT 4 // Also an error code */ 7790 /* #define SQLITE_ABORT 4 // Also an error code */
7412 #define SQLITE_REPLACE 5 7791 #define SQLITE_REPLACE 5
7413 7792
7414 7793 /*
7415 7794 ** CAPI3REF: Prepared Statement Scan Status Opcodes
7416 /* Begin recover virtual table patch for Chromium */ 7795 ** KEYWORDS: {scanstatus options}
7417 /* Our patches don't conform to SQLite's amalgamation processing. Hack it. */ 7796 **
7418 #ifndef CHROMIUM_SQLITE_API 7797 ** The following constants can be used for the T parameter to the
7419 #define CHROMIUM_SQLITE_API SQLITE_API 7798 ** [sqlite3_stmt_scanstatus(S,X,T,V)] interface. Each constant designates a
7420 #endif 7799 ** different metric for sqlite3_stmt_scanstatus() to return.
7421 /* 7800 **
7422 ** Call to initialize the recover virtual-table modules (see recover.c). 7801 ** When the value returned to V is a string, space to hold that string is
7423 ** 7802 ** managed by the prepared statement S and will be automatically freed when
7424 ** This could be loaded by default in main.c, but that would make the 7803 ** S is finalized.
7425 ** virtual table available to Web SQL. Breaking it out allows only 7804 **
7426 ** selected users to enable it (currently sql/recovery.cc). 7805 ** <dl>
7427 */ 7806 ** [[SQLITE_SCANSTAT_NLOOP]] <dt>SQLITE_SCANSTAT_NLOOP</dt>
7428 CHROMIUM_SQLITE_API 7807 ** <dd>^The [sqlite3_int64] variable pointed to by the T parameter will be
7429 int recoverVtableInit(sqlite3 *db); 7808 ** set to the total number of times that the X-th loop has run.</dd>
7430 /* End recover virtual table patch for Chromium */ 7809 **
7431 7810 ** [[SQLITE_SCANSTAT_NVISIT]] <dt>SQLITE_SCANSTAT_NVISIT</dt>
7432 /* Begin WebDatabase patch for Chromium */ 7811 ** <dd>^The [sqlite3_int64] variable pointed to by the T parameter will be set
7433 /* Expose some SQLite internals for the WebDatabase vfs. 7812 ** to the total number of rows examined by all iterations of the X-th loop.</dd>
7434 ** DO NOT EXTEND THE USE OF THIS. 7813 **
7435 */ 7814 ** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt>
7436 #ifndef CHROMIUM_SQLITE_API 7815 ** <dd>^The "double" variable pointed to by the T parameter will be set to the
7437 #define CHROMIUM_SQLITE_API SQLITE_API 7816 ** query planner's estimate for the average number of rows output from each
7438 #endif 7817 ** iteration of the X-th loop. If the query planner's estimates was accurate,
7439 #if defined(CHROMIUM_SQLITE_INTERNALS) 7818 ** then this value will approximate the quotient NVISIT/NLOOP and the
7440 #ifdef _WIN32 7819 ** product of this value for all prior loops with the same SELECTID will
7441 CHROMIUM_SQLITE_API 7820 ** be the NLOOP value for the current loop.
7442 void chromium_sqlite3_initialize_win_sqlite3_file(sqlite3_file* file, HANDLE han dle); 7821 **
7443 #else /* _WIN32 */ 7822 ** [[SQLITE_SCANSTAT_NAME]] <dt>SQLITE_SCANSTAT_NAME</dt>
7444 CHROMIUM_SQLITE_API 7823 ** <dd>^The "const char *" variable pointed to by the T parameter will be set
7445 int chromium_sqlite3_fill_in_unix_sqlite3_file(sqlite3_vfs* pVfs, 7824 ** to a zero-terminated UTF-8 string containing the name of the index or table
7446 int fd, 7825 ** used for the X-th loop.
7447 sqlite3_file* pFile, 7826 **
7448 const char* zPath, 7827 ** [[SQLITE_SCANSTAT_EXPLAIN]] <dt>SQLITE_SCANSTAT_EXPLAIN</dt>
7449 int noLock, 7828 ** <dd>^The "const char *" variable pointed to by the T parameter will be set
7450 int flags); 7829 ** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN]
7451 #endif /* _WIN32 */ 7830 ** description for the X-th loop.
7452 #endif /* CHROMIUM_SQLITE_INTERNALS */ 7831 **
7453 /* End WebDatabase patch for Chromium */ 7832 ** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECT</dt>
7833 ** <dd>^The "int" variable pointed to by the T parameter will be set to the
7834 ** "select-id" for the X-th loop. The select-id identifies which query or
7835 ** subquery the loop is part of. The main query has a select-id of zero.
7836 ** The select-id is the same value as is output in the first column
7837 ** of an [EXPLAIN QUERY PLAN] query.
7838 ** </dl>
7839 */
7840 #define SQLITE_SCANSTAT_NLOOP 0
7841 #define SQLITE_SCANSTAT_NVISIT 1
7842 #define SQLITE_SCANSTAT_EST 2
7843 #define SQLITE_SCANSTAT_NAME 3
7844 #define SQLITE_SCANSTAT_EXPLAIN 4
7845 #define SQLITE_SCANSTAT_SELECTID 5
7846
7847 /*
7848 ** CAPI3REF: Prepared Statement Scan Status
7849 ** METHOD: sqlite3_stmt
7850 **
7851 ** This interface returns information about the predicted and measured
7852 ** performance for pStmt. Advanced applications can use this
7853 ** interface to compare the predicted and the measured performance and
7854 ** issue warnings and/or rerun [ANALYZE] if discrepancies are found.
7855 **
7856 ** Since this interface is expected to be rarely used, it is only
7857 ** available if SQLite is compiled using the [SQLITE_ENABLE_STMT_SCANSTATUS]
7858 ** compile-time option.
7859 **
7860 ** The "iScanStatusOp" parameter determines which status information to return.
7861 ** The "iScanStatusOp" must be one of the [scanstatus options] or the behavior
7862 ** of this interface is undefined.
7863 ** ^The requested measurement is written into a variable pointed to by
7864 ** the "pOut" parameter.
7865 ** Parameter "idx" identifies the specific loop to retrieve statistics for.
7866 ** Loops are numbered starting from zero. ^If idx is out of range - less than
7867 ** zero or greater than or equal to the total number of loops used to implement
7868 ** the statement - a non-zero value is returned and the variable that pOut
7869 ** points to is unchanged.
7870 **
7871 ** ^Statistics might not be available for all loops in all statements. ^In cases
7872 ** where there exist loops with no available statistics, this function behaves
7873 ** as if the loop did not exist - it returns non-zero and leave the variable
7874 ** that pOut points to unchanged.
7875 **
7876 ** See also: [sqlite3_stmt_scanstatus_reset()]
7877 */
7878 SQLITE_API int SQLITE_STDCALL sqlite3_stmt_scanstatus(
7879 sqlite3_stmt *pStmt, /* Prepared statement for which info desired */
7880 int idx, /* Index of loop to report on */
7881 int iScanStatusOp, /* Information desired. SQLITE_SCANSTAT_* */
7882 void *pOut /* Result written here */
7883 );
7884
7885 /*
7886 ** CAPI3REF: Zero Scan-Status Counters
7887 ** METHOD: sqlite3_stmt
7888 **
7889 ** ^Zero all [sqlite3_stmt_scanstatus()] related event counters.
7890 **
7891 ** This API is only available if the library is built with pre-processor
7892 ** symbol [SQLITE_ENABLE_STMT_SCANSTATUS] defined.
7893 */
7894 SQLITE_API void SQLITE_STDCALL sqlite3_stmt_scanstatus_reset(sqlite3_stmt*);
7895
7896 /*
7897 ** CAPI3REF: Flush caches to disk mid-transaction
7898 **
7899 ** ^If a write-transaction is open on [database connection] D when the
7900 ** [sqlite3_db_cacheflush(D)] interface invoked, any dirty
7901 ** pages in the pager-cache that are not currently in use are written out
7902 ** to disk. A dirty page may be in use if a database cursor created by an
7903 ** active SQL statement is reading from it, or if it is page 1 of a database
7904 ** file (page 1 is always "in use"). ^The [sqlite3_db_cacheflush(D)]
7905 ** interface flushes caches for all schemas - "main", "temp", and
7906 ** any [attached] databases.
7907 **
7908 ** ^If this function needs to obtain extra database locks before dirty pages
7909 ** can be flushed to disk, it does so. ^If those locks cannot be obtained
7910 ** immediately and there is a busy-handler callback configured, it is invoked
7911 ** in the usual manner. ^If the required lock still cannot be obtained, then
7912 ** the database is skipped and an attempt made to flush any dirty pages
7913 ** belonging to the next (if any) database. ^If any databases are skipped
7914 ** because locks cannot be obtained, but no other error occurs, this
7915 ** function returns SQLITE_BUSY.
7916 **
7917 ** ^If any other error occurs while flushing dirty pages to disk (for
7918 ** example an IO error or out-of-memory condition), then processing is
7919 ** abandoned and an SQLite [error code] is returned to the caller immediately.
7920 **
7921 ** ^Otherwise, if no error occurs, [sqlite3_db_cacheflush()] returns SQLITE_OK.
7922 **
7923 ** ^This function does not set the database handle error code or message
7924 ** returned by the [sqlite3_errcode()] and [sqlite3_errmsg()] functions.
7925 */
7926 SQLITE_API int SQLITE_STDCALL sqlite3_db_cacheflush(sqlite3*);
7927
7928 /*
7929 ** CAPI3REF: Database Snapshot
7930 ** KEYWORDS: {snapshot}
7931 ** EXPERIMENTAL
7932 **
7933 ** An instance of the snapshot object records the state of a [WAL mode]
7934 ** database for some specific point in history.
7935 **
7936 ** In [WAL mode], multiple [database connections] that are open on the
7937 ** same database file can each be reading a different historical version
7938 ** of the database file. When a [database connection] begins a read
7939 ** transaction, that connection sees an unchanging copy of the database
7940 ** as it existed for the point in time when the transaction first started.
7941 ** Subsequent changes to the database from other connections are not seen
7942 ** by the reader until a new read transaction is started.
7943 **
7944 ** The sqlite3_snapshot object records state information about an historical
7945 ** version of the database file so that it is possible to later open a new read
7946 ** transaction that sees that historical version of the database rather than
7947 ** the most recent version.
7948 **
7949 ** The constructor for this object is [sqlite3_snapshot_get()]. The
7950 ** [sqlite3_snapshot_open()] method causes a fresh read transaction to refer
7951 ** to an historical snapshot (if possible). The destructor for
7952 ** sqlite3_snapshot objects is [sqlite3_snapshot_free()].
7953 */
7954 typedef struct sqlite3_snapshot sqlite3_snapshot;
7955
7956 /*
7957 ** CAPI3REF: Record A Database Snapshot
7958 ** EXPERIMENTAL
7959 **
7960 ** ^The [sqlite3_snapshot_get(D,S,P)] interface attempts to make a
7961 ** new [sqlite3_snapshot] object that records the current state of
7962 ** schema S in database connection D. ^On success, the
7963 ** [sqlite3_snapshot_get(D,S,P)] interface writes a pointer to the newly
7964 ** created [sqlite3_snapshot] object into *P and returns SQLITE_OK.
7965 ** ^If schema S of [database connection] D is not a [WAL mode] database
7966 ** that is in a read transaction, then [sqlite3_snapshot_get(D,S,P)]
7967 ** leaves the *P value unchanged and returns an appropriate [error code].
7968 **
7969 ** The [sqlite3_snapshot] object returned from a successful call to
7970 ** [sqlite3_snapshot_get()] must be freed using [sqlite3_snapshot_free()]
7971 ** to avoid a memory leak.
7972 **
7973 ** The [sqlite3_snapshot_get()] interface is only available when the
7974 ** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
7975 */
7976 SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_snapshot_get(
7977 sqlite3 *db,
7978 const char *zSchema,
7979 sqlite3_snapshot **ppSnapshot
7980 );
7981
7982 /*
7983 ** CAPI3REF: Start a read transaction on an historical snapshot
7984 ** EXPERIMENTAL
7985 **
7986 ** ^The [sqlite3_snapshot_open(D,S,P)] interface attempts to move the
7987 ** read transaction that is currently open on schema S of
7988 ** [database connection] D so that it refers to historical [snapshot] P.
7989 ** ^The [sqlite3_snapshot_open()] interface returns SQLITE_OK on success
7990 ** or an appropriate [error code] if it fails.
7991 **
7992 ** ^In order to succeed, a call to [sqlite3_snapshot_open(D,S,P)] must be
7993 ** the first operation, apart from other sqlite3_snapshot_open() calls,
7994 ** following the [BEGIN] that starts a new read transaction.
7995 ** ^A [snapshot] will fail to open if it has been overwritten by a
7996 ** [checkpoint].
7997 **
7998 ** The [sqlite3_snapshot_open()] interface is only available when the
7999 ** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
8000 */
8001 SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_snapshot_open(
8002 sqlite3 *db,
8003 const char *zSchema,
8004 sqlite3_snapshot *pSnapshot
8005 );
8006
8007 /*
8008 ** CAPI3REF: Destroy a snapshot
8009 ** EXPERIMENTAL
8010 **
8011 ** ^The [sqlite3_snapshot_free(P)] interface destroys [sqlite3_snapshot] P.
8012 ** The application must eventually free every [sqlite3_snapshot] object
8013 ** using this routine to avoid a memory leak.
8014 **
8015 ** The [sqlite3_snapshot_free()] interface is only available when the
8016 ** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
8017 */
8018 SQLITE_API SQLITE_EXPERIMENTAL void SQLITE_STDCALL sqlite3_snapshot_free(sqlite3 _snapshot*);
7454 8019
7455 /* 8020 /*
7456 ** Undo the hack that converts floating point types to integer for 8021 ** Undo the hack that converts floating point types to integer for
7457 ** builds on processors without floating point support. 8022 ** builds on processors without floating point support.
7458 */ 8023 */
7459 #ifdef SQLITE_OMIT_FLOATING_POINT 8024 #ifdef SQLITE_OMIT_FLOATING_POINT
7460 # undef double 8025 # undef double
7461 #endif 8026 #endif
7462 8027
7463 #ifdef __cplusplus 8028 #ifdef __cplusplus
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
7497 #else 8062 #else
7498 typedef double sqlite3_rtree_dbl; 8063 typedef double sqlite3_rtree_dbl;
7499 #endif 8064 #endif
7500 8065
7501 /* 8066 /*
7502 ** Register a geometry callback named zGeom that can be used as part of an 8067 ** Register a geometry callback named zGeom that can be used as part of an
7503 ** R-Tree geometry query as follows: 8068 ** R-Tree geometry query as follows:
7504 ** 8069 **
7505 ** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zGeom(... params ...) 8070 ** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zGeom(... params ...)
7506 */ 8071 */
7507 SQLITE_API int sqlite3_rtree_geometry_callback( 8072 SQLITE_API int SQLITE_STDCALL sqlite3_rtree_geometry_callback(
7508 sqlite3 *db, 8073 sqlite3 *db,
7509 const char *zGeom, 8074 const char *zGeom,
7510 int (*xGeom)(sqlite3_rtree_geometry*, int, sqlite3_rtree_dbl*,int*), 8075 int (*xGeom)(sqlite3_rtree_geometry*, int, sqlite3_rtree_dbl*,int*),
7511 void *pContext 8076 void *pContext
7512 ); 8077 );
7513 8078
7514 8079
7515 /* 8080 /*
7516 ** A pointer to a structure of the following type is passed as the first 8081 ** A pointer to a structure of the following type is passed as the first
7517 ** argument to callbacks registered using rtree_geometry_callback(). 8082 ** argument to callbacks registered using rtree_geometry_callback().
7518 */ 8083 */
7519 struct sqlite3_rtree_geometry { 8084 struct sqlite3_rtree_geometry {
7520 void *pContext; /* Copy of pContext passed to s_r_g_c() */ 8085 void *pContext; /* Copy of pContext passed to s_r_g_c() */
7521 int nParam; /* Size of array aParam[] */ 8086 int nParam; /* Size of array aParam[] */
7522 sqlite3_rtree_dbl *aParam; /* Parameters passed to SQL geom function */ 8087 sqlite3_rtree_dbl *aParam; /* Parameters passed to SQL geom function */
7523 void *pUser; /* Callback implementation user data */ 8088 void *pUser; /* Callback implementation user data */
7524 void (*xDelUser)(void *); /* Called by SQLite to clean up pUser */ 8089 void (*xDelUser)(void *); /* Called by SQLite to clean up pUser */
7525 }; 8090 };
7526 8091
7527 /* 8092 /*
7528 ** Register a 2nd-generation geometry callback named zScore that can be 8093 ** Register a 2nd-generation geometry callback named zScore that can be
7529 ** used as part of an R-Tree geometry query as follows: 8094 ** used as part of an R-Tree geometry query as follows:
7530 ** 8095 **
7531 ** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zQueryFunc(... params ...) 8096 ** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zQueryFunc(... params ...)
7532 */ 8097 */
7533 SQLITE_API int sqlite3_rtree_query_callback( 8098 SQLITE_API int SQLITE_STDCALL sqlite3_rtree_query_callback(
7534 sqlite3 *db, 8099 sqlite3 *db,
7535 const char *zQueryFunc, 8100 const char *zQueryFunc,
7536 int (*xQueryFunc)(sqlite3_rtree_query_info*), 8101 int (*xQueryFunc)(sqlite3_rtree_query_info*),
7537 void *pContext, 8102 void *pContext,
7538 void (*xDestructor)(void*) 8103 void (*xDestructor)(void*)
7539 ); 8104 );
7540 8105
7541 8106
7542 /* 8107 /*
7543 ** A pointer to a structure of the following type is passed as the 8108 ** A pointer to a structure of the following type is passed as the
(...skipping 13 matching lines...) Expand all
7557 sqlite3_rtree_dbl *aCoord; /* Coordinates of node or entry to check */ 8122 sqlite3_rtree_dbl *aCoord; /* Coordinates of node or entry to check */
7558 unsigned int *anQueue; /* Number of pending entries in the queue */ 8123 unsigned int *anQueue; /* Number of pending entries in the queue */
7559 int nCoord; /* Number of coordinates */ 8124 int nCoord; /* Number of coordinates */
7560 int iLevel; /* Level of current node or entry */ 8125 int iLevel; /* Level of current node or entry */
7561 int mxLevel; /* The largest iLevel value in the tree */ 8126 int mxLevel; /* The largest iLevel value in the tree */
7562 sqlite3_int64 iRowid; /* Rowid for current entry */ 8127 sqlite3_int64 iRowid; /* Rowid for current entry */
7563 sqlite3_rtree_dbl rParentScore; /* Score of parent node */ 8128 sqlite3_rtree_dbl rParentScore; /* Score of parent node */
7564 int eParentWithin; /* Visibility of parent node */ 8129 int eParentWithin; /* Visibility of parent node */
7565 int eWithin; /* OUT: Visiblity */ 8130 int eWithin; /* OUT: Visiblity */
7566 sqlite3_rtree_dbl rScore; /* OUT: Write the score here */ 8131 sqlite3_rtree_dbl rScore; /* OUT: Write the score here */
8132 /* The following fields are only available in 3.8.11 and later */
8133 sqlite3_value **apSqlParam; /* Original SQL values of parameters */
7567 }; 8134 };
7568 8135
7569 /* 8136 /*
7570 ** Allowed values for sqlite3_rtree_query.eWithin and .eParentWithin. 8137 ** Allowed values for sqlite3_rtree_query.eWithin and .eParentWithin.
7571 */ 8138 */
7572 #define NOT_WITHIN 0 /* Object completely outside of query region */ 8139 #define NOT_WITHIN 0 /* Object completely outside of query region */
7573 #define PARTLY_WITHIN 1 /* Object partially overlaps query region */ 8140 #define PARTLY_WITHIN 1 /* Object partially overlaps query region */
7574 #define FULLY_WITHIN 2 /* Object fully contained within query region */ 8141 #define FULLY_WITHIN 2 /* Object fully contained within query region */
7575 8142
7576 8143
7577 #ifdef __cplusplus 8144 #ifdef __cplusplus
7578 } /* end of the 'extern "C"' block */ 8145 } /* end of the 'extern "C"' block */
7579 #endif 8146 #endif
7580 8147
7581 #endif /* ifndef _SQLITE3RTREE_H_ */ 8148 #endif /* ifndef _SQLITE3RTREE_H_ */
7582 8149
8150 /*
8151 ** 2014 May 31
8152 **
8153 ** The author disclaims copyright to this source code. In place of
8154 ** a legal notice, here is a blessing:
8155 **
8156 ** May you do good and not evil.
8157 ** May you find forgiveness for yourself and forgive others.
8158 ** May you share freely, never taking more than you give.
8159 **
8160 ******************************************************************************
8161 **
8162 ** Interfaces to extend FTS5. Using the interfaces defined in this file,
8163 ** FTS5 may be extended with:
8164 **
8165 ** * custom tokenizers, and
8166 ** * custom auxiliary functions.
8167 */
8168
8169
8170 #ifndef _FTS5_H
8171 #define _FTS5_H
8172
8173
8174 #ifdef __cplusplus
8175 extern "C" {
8176 #endif
8177
8178 /*************************************************************************
8179 ** CUSTOM AUXILIARY FUNCTIONS
8180 **
8181 ** Virtual table implementations may overload SQL functions by implementing
8182 ** the sqlite3_module.xFindFunction() method.
8183 */
8184
8185 typedef struct Fts5ExtensionApi Fts5ExtensionApi;
8186 typedef struct Fts5Context Fts5Context;
8187 typedef struct Fts5PhraseIter Fts5PhraseIter;
8188
8189 typedef void (*fts5_extension_function)(
8190 const Fts5ExtensionApi *pApi, /* API offered by current FTS version */
8191 Fts5Context *pFts, /* First arg to pass to pApi functions */
8192 sqlite3_context *pCtx, /* Context for returning result/error */
8193 int nVal, /* Number of values in apVal[] array */
8194 sqlite3_value **apVal /* Array of trailing arguments */
8195 );
8196
8197 struct Fts5PhraseIter {
8198 const unsigned char *a;
8199 const unsigned char *b;
8200 };
8201
8202 /*
8203 ** EXTENSION API FUNCTIONS
8204 **
8205 ** xUserData(pFts):
8206 ** Return a copy of the context pointer the extension function was
8207 ** registered with.
8208 **
8209 ** xColumnTotalSize(pFts, iCol, pnToken):
8210 ** If parameter iCol is less than zero, set output variable *pnToken
8211 ** to the total number of tokens in the FTS5 table. Or, if iCol is
8212 ** non-negative but less than the number of columns in the table, return
8213 ** the total number of tokens in column iCol, considering all rows in
8214 ** the FTS5 table.
8215 **
8216 ** If parameter iCol is greater than or equal to the number of columns
8217 ** in the table, SQLITE_RANGE is returned. Or, if an error occurs (e.g.
8218 ** an OOM condition or IO error), an appropriate SQLite error code is
8219 ** returned.
8220 **
8221 ** xColumnCount(pFts):
8222 ** Return the number of columns in the table.
8223 **
8224 ** xColumnSize(pFts, iCol, pnToken):
8225 ** If parameter iCol is less than zero, set output variable *pnToken
8226 ** to the total number of tokens in the current row. Or, if iCol is
8227 ** non-negative but less than the number of columns in the table, set
8228 ** *pnToken to the number of tokens in column iCol of the current row.
8229 **
8230 ** If parameter iCol is greater than or equal to the number of columns
8231 ** in the table, SQLITE_RANGE is returned. Or, if an error occurs (e.g.
8232 ** an OOM condition or IO error), an appropriate SQLite error code is
8233 ** returned.
8234 **
8235 ** xColumnText:
8236 ** This function attempts to retrieve the text of column iCol of the
8237 ** current document. If successful, (*pz) is set to point to a buffer
8238 ** containing the text in utf-8 encoding, (*pn) is set to the size in bytes
8239 ** (not characters) of the buffer and SQLITE_OK is returned. Otherwise,
8240 ** if an error occurs, an SQLite error code is returned and the final values
8241 ** of (*pz) and (*pn) are undefined.
8242 **
8243 ** xPhraseCount:
8244 ** Returns the number of phrases in the current query expression.
8245 **
8246 ** xPhraseSize:
8247 ** Returns the number of tokens in phrase iPhrase of the query. Phrases
8248 ** are numbered starting from zero.
8249 **
8250 ** xInstCount:
8251 ** Set *pnInst to the total number of occurrences of all phrases within
8252 ** the query within the current row. Return SQLITE_OK if successful, or
8253 ** an error code (i.e. SQLITE_NOMEM) if an error occurs.
8254 **
8255 ** xInst:
8256 ** Query for the details of phrase match iIdx within the current row.
8257 ** Phrase matches are numbered starting from zero, so the iIdx argument
8258 ** should be greater than or equal to zero and smaller than the value
8259 ** output by xInstCount().
8260 **
8261 ** Returns SQLITE_OK if successful, or an error code (i.e. SQLITE_NOMEM)
8262 ** if an error occurs.
8263 **
8264 ** xRowid:
8265 ** Returns the rowid of the current row.
8266 **
8267 ** xTokenize:
8268 ** Tokenize text using the tokenizer belonging to the FTS5 table.
8269 **
8270 ** xQueryPhrase(pFts5, iPhrase, pUserData, xCallback):
8271 ** This API function is used to query the FTS table for phrase iPhrase
8272 ** of the current query. Specifically, a query equivalent to:
8273 **
8274 ** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid
8275 **
8276 ** with $p set to a phrase equivalent to the phrase iPhrase of the
8277 ** current query is executed. For each row visited, the callback function
8278 ** passed as the fourth argument is invoked. The context and API objects
8279 ** passed to the callback function may be used to access the properties of
8280 ** each matched row. Invoking Api.xUserData() returns a copy of the pointer
8281 ** passed as the third argument to pUserData.
8282 **
8283 ** If the callback function returns any value other than SQLITE_OK, the
8284 ** query is abandoned and the xQueryPhrase function returns immediately.
8285 ** If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK.
8286 ** Otherwise, the error code is propagated upwards.
8287 **
8288 ** If the query runs to completion without incident, SQLITE_OK is returned.
8289 ** Or, if some error occurs before the query completes or is aborted by
8290 ** the callback, an SQLite error code is returned.
8291 **
8292 **
8293 ** xSetAuxdata(pFts5, pAux, xDelete)
8294 **
8295 ** Save the pointer passed as the second argument as the extension functions
8296 ** "auxiliary data". The pointer may then be retrieved by the current or any
8297 ** future invocation of the same fts5 extension function made as part of
8298 ** of the same MATCH query using the xGetAuxdata() API.
8299 **
8300 ** Each extension function is allocated a single auxiliary data slot for
8301 ** each FTS query (MATCH expression). If the extension function is invoked
8302 ** more than once for a single FTS query, then all invocations share a
8303 ** single auxiliary data context.
8304 **
8305 ** If there is already an auxiliary data pointer when this function is
8306 ** invoked, then it is replaced by the new pointer. If an xDelete callback
8307 ** was specified along with the original pointer, it is invoked at this
8308 ** point.
8309 **
8310 ** The xDelete callback, if one is specified, is also invoked on the
8311 ** auxiliary data pointer after the FTS5 query has finished.
8312 **
8313 ** If an error (e.g. an OOM condition) occurs within this function, an
8314 ** the auxiliary data is set to NULL and an error code returned. If the
8315 ** xDelete parameter was not NULL, it is invoked on the auxiliary data
8316 ** pointer before returning.
8317 **
8318 **
8319 ** xGetAuxdata(pFts5, bClear)
8320 **
8321 ** Returns the current auxiliary data pointer for the fts5 extension
8322 ** function. See the xSetAuxdata() method for details.
8323 **
8324 ** If the bClear argument is non-zero, then the auxiliary data is cleared
8325 ** (set to NULL) before this function returns. In this case the xDelete,
8326 ** if any, is not invoked.
8327 **
8328 **
8329 ** xRowCount(pFts5, pnRow)
8330 **
8331 ** This function is used to retrieve the total number of rows in the table.
8332 ** In other words, the same value that would be returned by:
8333 **
8334 ** SELECT count(*) FROM ftstable;
8335 **
8336 ** xPhraseFirst()
8337 ** This function is used, along with type Fts5PhraseIter and the xPhraseNext
8338 ** method, to iterate through all instances of a single query phrase within
8339 ** the current row. This is the same information as is accessible via the
8340 ** xInstCount/xInst APIs. While the xInstCount/xInst APIs are more convenient
8341 ** to use, this API may be faster under some circumstances. To iterate
8342 ** through instances of phrase iPhrase, use the following code:
8343 **
8344 ** Fts5PhraseIter iter;
8345 ** int iCol, iOff;
8346 ** for(pApi->xPhraseFirst(pFts, iPhrase, &iter, &iCol, &iOff);
8347 ** iOff>=0;
8348 ** pApi->xPhraseNext(pFts, &iter, &iCol, &iOff)
8349 ** ){
8350 ** // An instance of phrase iPhrase at offset iOff of column iCol
8351 ** }
8352 **
8353 ** The Fts5PhraseIter structure is defined above. Applications should not
8354 ** modify this structure directly - it should only be used as shown above
8355 ** with the xPhraseFirst() and xPhraseNext() API methods.
8356 **
8357 ** xPhraseNext()
8358 ** See xPhraseFirst above.
8359 */
8360 struct Fts5ExtensionApi {
8361 int iVersion; /* Currently always set to 1 */
8362
8363 void *(*xUserData)(Fts5Context*);
8364
8365 int (*xColumnCount)(Fts5Context*);
8366 int (*xRowCount)(Fts5Context*, sqlite3_int64 *pnRow);
8367 int (*xColumnTotalSize)(Fts5Context*, int iCol, sqlite3_int64 *pnToken);
8368
8369 int (*xTokenize)(Fts5Context*,
8370 const char *pText, int nText, /* Text to tokenize */
8371 void *pCtx, /* Context passed to xToken() */
8372 int (*xToken)(void*, int, const char*, int, int, int) /* Callback */
8373 );
8374
8375 int (*xPhraseCount)(Fts5Context*);
8376 int (*xPhraseSize)(Fts5Context*, int iPhrase);
8377
8378 int (*xInstCount)(Fts5Context*, int *pnInst);
8379 int (*xInst)(Fts5Context*, int iIdx, int *piPhrase, int *piCol, int *piOff);
8380
8381 sqlite3_int64 (*xRowid)(Fts5Context*);
8382 int (*xColumnText)(Fts5Context*, int iCol, const char **pz, int *pn);
8383 int (*xColumnSize)(Fts5Context*, int iCol, int *pnToken);
8384
8385 int (*xQueryPhrase)(Fts5Context*, int iPhrase, void *pUserData,
8386 int(*)(const Fts5ExtensionApi*,Fts5Context*,void*)
8387 );
8388 int (*xSetAuxdata)(Fts5Context*, void *pAux, void(*xDelete)(void*));
8389 void *(*xGetAuxdata)(Fts5Context*, int bClear);
8390
8391 void (*xPhraseFirst)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*, int*);
8392 void (*xPhraseNext)(Fts5Context*, Fts5PhraseIter*, int *piCol, int *piOff);
8393 };
8394
8395 /*
8396 ** CUSTOM AUXILIARY FUNCTIONS
8397 *************************************************************************/
8398
8399 /*************************************************************************
8400 ** CUSTOM TOKENIZERS
8401 **
8402 ** Applications may also register custom tokenizer types. A tokenizer
8403 ** is registered by providing fts5 with a populated instance of the
8404 ** following structure. All structure methods must be defined, setting
8405 ** any member of the fts5_tokenizer struct to NULL leads to undefined
8406 ** behaviour. The structure methods are expected to function as follows:
8407 **
8408 ** xCreate:
8409 ** This function is used to allocate and inititalize a tokenizer instance.
8410 ** A tokenizer instance is required to actually tokenize text.
8411 **
8412 ** The first argument passed to this function is a copy of the (void*)
8413 ** pointer provided by the application when the fts5_tokenizer object
8414 ** was registered with FTS5 (the third argument to xCreateTokenizer()).
8415 ** The second and third arguments are an array of nul-terminated strings
8416 ** containing the tokenizer arguments, if any, specified following the
8417 ** tokenizer name as part of the CREATE VIRTUAL TABLE statement used
8418 ** to create the FTS5 table.
8419 **
8420 ** The final argument is an output variable. If successful, (*ppOut)
8421 ** should be set to point to the new tokenizer handle and SQLITE_OK
8422 ** returned. If an error occurs, some value other than SQLITE_OK should
8423 ** be returned. In this case, fts5 assumes that the final value of *ppOut
8424 ** is undefined.
8425 **
8426 ** xDelete:
8427 ** This function is invoked to delete a tokenizer handle previously
8428 ** allocated using xCreate(). Fts5 guarantees that this function will
8429 ** be invoked exactly once for each successful call to xCreate().
8430 **
8431 ** xTokenize:
8432 ** This function is expected to tokenize the nText byte string indicated
8433 ** by argument pText. pText may or may not be nul-terminated. The first
8434 ** argument passed to this function is a pointer to an Fts5Tokenizer object
8435 ** returned by an earlier call to xCreate().
8436 **
8437 ** The second argument indicates the reason that FTS5 is requesting
8438 ** tokenization of the supplied text. This is always one of the following
8439 ** four values:
8440 **
8441 ** <ul><li> <b>FTS5_TOKENIZE_DOCUMENT</b> - A document is being inserted into
8442 ** or removed from the FTS table. The tokenizer is being invoked to
8443 ** determine the set of tokens to add to (or delete from) the
8444 ** FTS index.
8445 **
8446 ** <li> <b>FTS5_TOKENIZE_QUERY</b> - A MATCH query is being executed
8447 ** against the FTS index. The tokenizer is being called to tokenize
8448 ** a bareword or quoted string specified as part of the query.
8449 **
8450 ** <li> <b>(FTS5_TOKENIZE_QUERY | FTS5_TOKENIZE_PREFIX)</b> - Same as
8451 ** FTS5_TOKENIZE_QUERY, except that the bareword or quoted string is
8452 ** followed by a "*" character, indicating that the last token
8453 ** returned by the tokenizer will be treated as a token prefix.
8454 **
8455 ** <li> <b>FTS5_TOKENIZE_AUX</b> - The tokenizer is being invoked to
8456 ** satisfy an fts5_api.xTokenize() request made by an auxiliary
8457 ** function. Or an fts5_api.xColumnSize() request made by the same
8458 ** on a columnsize=0 database.
8459 ** </ul>
8460 **
8461 ** For each token in the input string, the supplied callback xToken() must
8462 ** be invoked. The first argument to it should be a copy of the pointer
8463 ** passed as the second argument to xTokenize(). The third and fourth
8464 ** arguments are a pointer to a buffer containing the token text, and the
8465 ** size of the token in bytes. The 4th and 5th arguments are the byte offsets
8466 ** of the first byte of and first byte immediately following the text from
8467 ** which the token is derived within the input.
8468 **
8469 ** The second argument passed to the xToken() callback ("tflags") should
8470 ** normally be set to 0. The exception is if the tokenizer supports
8471 ** synonyms. In this case see the discussion below for details.
8472 **
8473 ** FTS5 assumes the xToken() callback is invoked for each token in the
8474 ** order that they occur within the input text.
8475 **
8476 ** If an xToken() callback returns any value other than SQLITE_OK, then
8477 ** the tokenization should be abandoned and the xTokenize() method should
8478 ** immediately return a copy of the xToken() return value. Or, if the
8479 ** input buffer is exhausted, xTokenize() should return SQLITE_OK. Finally,
8480 ** if an error occurs with the xTokenize() implementation itself, it
8481 ** may abandon the tokenization and return any error code other than
8482 ** SQLITE_OK or SQLITE_DONE.
8483 **
8484 ** SYNONYM SUPPORT
8485 **
8486 ** Custom tokenizers may also support synonyms. Consider a case in which a
8487 ** user wishes to query for a phrase such as "first place". Using the
8488 ** built-in tokenizers, the FTS5 query 'first + place' will match instances
8489 ** of "first place" within the document set, but not alternative forms
8490 ** such as "1st place". In some applications, it would be better to match
8491 ** all instances of "first place" or "1st place" regardless of which form
8492 ** the user specified in the MATCH query text.
8493 **
8494 ** There are several ways to approach this in FTS5:
8495 **
8496 ** <ol><li> By mapping all synonyms to a single token. In this case, the
8497 ** In the above example, this means that the tokenizer returns the
8498 ** same token for inputs "first" and "1st". Say that token is in
8499 ** fact "first", so that when the user inserts the document "I won
8500 ** 1st place" entries are added to the index for tokens "i", "won",
8501 ** "first" and "place". If the user then queries for '1st + place',
8502 ** the tokenizer substitutes "first" for "1st" and the query works
8503 ** as expected.
8504 **
8505 ** <li> By adding multiple synonyms for a single term to the FTS index.
8506 ** In this case, when tokenizing query text, the tokenizer may
8507 ** provide multiple synonyms for a single term within the document.
8508 ** FTS5 then queries the index for each synonym individually. For
8509 ** example, faced with the query:
8510 **
8511 ** <codeblock>
8512 ** ... MATCH 'first place'</codeblock>
8513 **
8514 ** the tokenizer offers both "1st" and "first" as synonyms for the
8515 ** first token in the MATCH query and FTS5 effectively runs a query
8516 ** similar to:
8517 **
8518 ** <codeblock>
8519 ** ... MATCH '(first OR 1st) place'</codeblock>
8520 **
8521 ** except that, for the purposes of auxiliary functions, the query
8522 ** still appears to contain just two phrases - "(first OR 1st)"
8523 ** being treated as a single phrase.
8524 **
8525 ** <li> By adding multiple synonyms for a single term to the FTS index.
8526 ** Using this method, when tokenizing document text, the tokenizer
8527 ** provides multiple synonyms for each token. So that when a
8528 ** document such as "I won first place" is tokenized, entries are
8529 ** added to the FTS index for "i", "won", "first", "1st" and
8530 ** "place".
8531 **
8532 ** This way, even if the tokenizer does not provide synonyms
8533 ** when tokenizing query text (it should not - to do would be
8534 ** inefficient), it doesn't matter if the user queries for
8535 ** 'first + place' or '1st + place', as there are entires in the
8536 ** FTS index corresponding to both forms of the first token.
8537 ** </ol>
8538 **
8539 ** Whether it is parsing document or query text, any call to xToken that
8540 ** specifies a <i>tflags</i> argument with the FTS5_TOKEN_COLOCATED bit
8541 ** is considered to supply a synonym for the previous token. For example,
8542 ** when parsing the document "I won first place", a tokenizer that supports
8543 ** synonyms would call xToken() 5 times, as follows:
8544 **
8545 ** <codeblock>
8546 ** xToken(pCtx, 0, "i", 1, 0, 1);
8547 ** xToken(pCtx, 0, "won", 3, 2, 5);
8548 ** xToken(pCtx, 0, "first", 5, 6, 11);
8549 ** xToken(pCtx, FTS5_TOKEN_COLOCATED, "1st", 3, 6, 11);
8550 ** xToken(pCtx, 0, "place", 5, 12, 17);
8551 **</codeblock>
8552 **
8553 ** It is an error to specify the FTS5_TOKEN_COLOCATED flag the first time
8554 ** xToken() is called. Multiple synonyms may be specified for a single token
8555 ** by making multiple calls to xToken(FTS5_TOKEN_COLOCATED) in sequence.
8556 ** There is no limit to the number of synonyms that may be provided for a
8557 ** single token.
8558 **
8559 ** In many cases, method (1) above is the best approach. It does not add
8560 ** extra data to the FTS index or require FTS5 to query for multiple terms,
8561 ** so it is efficient in terms of disk space and query speed. However, it
8562 ** does not support prefix queries very well. If, as suggested above, the
8563 ** token "first" is subsituted for "1st" by the tokenizer, then the query:
8564 **
8565 ** <codeblock>
8566 ** ... MATCH '1s*'</codeblock>
8567 **
8568 ** will not match documents that contain the token "1st" (as the tokenizer
8569 ** will probably not map "1s" to any prefix of "first").
8570 **
8571 ** For full prefix support, method (3) may be preferred. In this case,
8572 ** because the index contains entries for both "first" and "1st", prefix
8573 ** queries such as 'fi*' or '1s*' will match correctly. However, because
8574 ** extra entries are added to the FTS index, this method uses more space
8575 ** within the database.
8576 **
8577 ** Method (2) offers a midpoint between (1) and (3). Using this method,
8578 ** a query such as '1s*' will match documents that contain the literal
8579 ** token "1st", but not "first" (assuming the tokenizer is not able to
8580 ** provide synonyms for prefixes). However, a non-prefix query like '1st'
8581 ** will match against "1st" and "first". This method does not require
8582 ** extra disk space, as no extra entries are added to the FTS index.
8583 ** On the other hand, it may require more CPU cycles to run MATCH queries,
8584 ** as separate queries of the FTS index are required for each synonym.
8585 **
8586 ** When using methods (2) or (3), it is important that the tokenizer only
8587 ** provide synonyms when tokenizing document text (method (2)) or query
8588 ** text (method (3)), not both. Doing so will not cause any errors, but is
8589 ** inefficient.
8590 */
8591 typedef struct Fts5Tokenizer Fts5Tokenizer;
8592 typedef struct fts5_tokenizer fts5_tokenizer;
8593 struct fts5_tokenizer {
8594 int (*xCreate)(void*, const char **azArg, int nArg, Fts5Tokenizer **ppOut);
8595 void (*xDelete)(Fts5Tokenizer*);
8596 int (*xTokenize)(Fts5Tokenizer*,
8597 void *pCtx,
8598 int flags, /* Mask of FTS5_TOKENIZE_* flags */
8599 const char *pText, int nText,
8600 int (*xToken)(
8601 void *pCtx, /* Copy of 2nd argument to xTokenize() */
8602 int tflags, /* Mask of FTS5_TOKEN_* flags */
8603 const char *pToken, /* Pointer to buffer containing token */
8604 int nToken, /* Size of token in bytes */
8605 int iStart, /* Byte offset of token within input text */
8606 int iEnd /* Byte offset of end of token within input text */
8607 )
8608 );
8609 };
8610
8611 /* Flags that may be passed as the third argument to xTokenize() */
8612 #define FTS5_TOKENIZE_QUERY 0x0001
8613 #define FTS5_TOKENIZE_PREFIX 0x0002
8614 #define FTS5_TOKENIZE_DOCUMENT 0x0004
8615 #define FTS5_TOKENIZE_AUX 0x0008
8616
8617 /* Flags that may be passed by the tokenizer implementation back to FTS5
8618 ** as the third argument to the supplied xToken callback. */
8619 #define FTS5_TOKEN_COLOCATED 0x0001 /* Same position as prev. token */
8620
8621 /*
8622 ** END OF CUSTOM TOKENIZERS
8623 *************************************************************************/
8624
8625 /*************************************************************************
8626 ** FTS5 EXTENSION REGISTRATION API
8627 */
8628 typedef struct fts5_api fts5_api;
8629 struct fts5_api {
8630 int iVersion; /* Currently always set to 2 */
8631
8632 /* Create a new tokenizer */
8633 int (*xCreateTokenizer)(
8634 fts5_api *pApi,
8635 const char *zName,
8636 void *pContext,
8637 fts5_tokenizer *pTokenizer,
8638 void (*xDestroy)(void*)
8639 );
8640
8641 /* Find an existing tokenizer */
8642 int (*xFindTokenizer)(
8643 fts5_api *pApi,
8644 const char *zName,
8645 void **ppContext,
8646 fts5_tokenizer *pTokenizer
8647 );
8648
8649 /* Create a new auxiliary function */
8650 int (*xCreateFunction)(
8651 fts5_api *pApi,
8652 const char *zName,
8653 void *pContext,
8654 fts5_extension_function xFunction,
8655 void (*xDestroy)(void*)
8656 );
8657 };
8658
8659 /*
8660 ** END OF REGISTRATION API
8661 *************************************************************************/
8662
8663 #ifdef __cplusplus
8664 } /* end of the 'extern "C"' block */
8665 #endif
8666
8667 #endif /* _FTS5_H */
8668
8669
OLDNEW
« no previous file with comments | « third_party/sqlite/README.chromium ('k') | third_party/sqlite/patches/0001-test-SQLite-tests-compiling-on-Linux.patch » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698