1 module etc.c.sqlite3;
2 /*
3 ** 2001-09-15
4 **
5 ** The author disclaims copyright to this source code.  In place of
6 ** a legal notice, here is a blessing:
7 **
8 **    May you do good and not evil.
9 **    May you find forgiveness for yourself and forgive others.
10 **    May you share freely, never taking more than you give.
11 **
12 *************************************************************************
13 ** This header file defines the interface that the SQLite library
14 ** presents to client programs.  If a C-function, structure, datatype,
15 ** or constant definition does not appear in this file, then it is
16 ** not a published API of SQLite, is subject to change without
17 ** notice, and should not be referenced by programs that use SQLite.
18 **
19 ** Some of the definitions that are in this file are marked as
20 ** "experimental".  Experimental interfaces are normally new
21 ** features recently added to SQLite.  We do not anticipate changes
22 ** to experimental interfaces but reserve the right to make minor changes
23 ** if experience from use "in the wild" suggest such changes are prudent.
24 **
25 ** The official C-language API documentation for SQLite is derived
26 ** from comments in this file.  This file is the authoritative source
27 ** on how SQLite interfaces are suppose to operate.
28 **
29 ** The name of this file under configuration management is "sqlite.h.in".
30 ** The makefile makes some minor changes to this file (such as inserting
31 ** the version number) and changes its name to "sqlite3.h" as
32 ** part of the build process.
33 */
34 
35 import core.stdc.stdarg : va_list;
36 import core.stdc.config : c_ulong;
37 
38 extern (C) __gshared nothrow:
39 
40 /**
41 * CAPI3REF: Compile-Time Library Version Numbers
42 */
43 enum SQLITE_VERSION = "3.33.0";
44 /// Ditto
45 enum SQLITE_VERSION_NUMBER = 3033000;
46 /// Ditto
47 enum SQLITE_SOURCE_ID = "2020-08-14 13:23:32 fca8dc8b578f215a969cd899336378966156154710873e68b3d9ac5881b0ff3f";
48 
49 /**
50 * CAPI3REF: Run-Time Library Version Numbers
51 */
52 extern immutable(char)* sqlite3_version;
53 /// Ditto
54 immutable(char)* sqlite3_libversion();
55 /// Ditto
56 immutable(char)* sqlite3_sourceid();
57 /// Ditto
58 int sqlite3_libversion_number();
59 
60 /**
61 * CAPI3REF: Run-Time Library Compilation Options Diagnostics
62 */
63 int sqlite3_compileoption_used(const char *zOptName);
64 /// Ditto
65 immutable(char)* sqlite3_compileoption_get(int N);
66 
67 /**
68 * CAPI3REF: Test To See If The Library Is Threadsafe
69 */
70 int sqlite3_threadsafe();
71 
72 /**
73 * CAPI3REF: Database Connection Handle
74 */
75 struct sqlite3;
76 
77 ///
78 alias sqlite3_int64 = long;
79 ///
80 alias sqlite3_uint64 = ulong;
81 
82 /**
83 * CAPI3REF: Closing A Database Connection
84 *
85 */
86 int sqlite3_close(sqlite3 *);
87 int sqlite3_close_v2(sqlite3*);
88 
89 /**
90 * The type for a callback function.
91 * This is legacy and deprecated.  It is included for historical
92 * compatibility and is not documented.
93 */
94 alias sqlite3_callback = int function (void*,int,char**, char**);
95 
96 /**
97 * CAPI3REF: One-Step Query Execution Interface
98 */
99 int sqlite3_exec(
100     sqlite3*,                                         /** An open database */
101     const(char)*sql,                                  /** SQL to be evaluated */
102     int function (void*,int,char**,char**) callback,  /** Callback function */
103     void *,                                           /** 1st argument to callback */
104     char **errmsg                                     /** Error msg written here */
105 );
106 
107 /**
108 * CAPI3REF: Result Codes
109 */
110 enum
111 {
112     SQLITE_OK          = 0,    /** Successful result */
113 /* beginning-of-error-codes */
114 /// Ditto
115     SQLITE_ERROR       = 1,    /** Generic error */
116     SQLITE_INTERNAL    = 2,    /** Internal logic error in SQLite */
117     SQLITE_PERM        = 3,    /** Access permission denied */
118     SQLITE_ABORT       = 4,    /** Callback routine requested an abort */
119     SQLITE_BUSY        = 5,    /** The database file is locked */
120     SQLITE_LOCKED      = 6,    /** A table in the database is locked */
121     SQLITE_NOMEM       = 7,    /** A malloc() failed */
122     SQLITE_READONLY    = 8,    /** Attempt to write a readonly database */
123     SQLITE_INTERRUPT   = 9,    /** Operation terminated by sqlite3_interrupt()*/
124     SQLITE_IOERR       = 10,   /** Some kind of disk I/O error occurred */
125     SQLITE_CORRUPT     = 11,   /** The database disk image is malformed */
126     SQLITE_NOTFOUND    = 12,   /** Unknown opcode in sqlite3_file_control() */
127     SQLITE_FULL        = 13,   /** Insertion failed because database is full */
128     SQLITE_CANTOPEN    = 14,   /** Unable to open the database file */
129     SQLITE_PROTOCOL    = 15,   /** Database lock protocol error */
130     SQLITE_EMPTY       = 16,   /** Internal use only */
131     SQLITE_SCHEMA      = 17,   /** The database schema changed */
132     SQLITE_TOOBIG      = 18,   /** String or BLOB exceeds size limit */
133     SQLITE_CONSTRAINT  = 19,   /** Abort due to constraint violation */
134     SQLITE_MISMATCH    = 20,   /** Data type mismatch */
135     SQLITE_MISUSE      = 21,   /** Library used incorrectly */
136     SQLITE_NOLFS       = 22,   /** Uses OS features not supported on host */
137     SQLITE_AUTH        = 23,   /** Authorization denied */
138     SQLITE_FORMAT      = 24,   /** Not used */
139     SQLITE_RANGE       = 25,   /** 2nd parameter to sqlite3_bind out of range */
140     SQLITE_NOTADB      = 26,   /** File opened that is not a database file */
141     SQLITE_NOTICE      = 27,
142     SQLITE_WARNING     = 28,
143     SQLITE_ROW         = 100,  /** sqlite3_step() has another row ready */
144     SQLITE_DONE        = 101  /** sqlite3_step() has finished executing */
145 }
146 /* end-of-error-codes */
147 
148 /**
149 * CAPI3REF: Extended Result Codes
150 */
151 enum
152 {
153     SQLITE_ERROR_MISSING_COLLSEQ   = (SQLITE_ERROR | (1 << 8)),
154     SQLITE_ERROR_RETRY             = (SQLITE_ERROR | (2 << 8)),
155     SQLITE_ERROR_SNAPSHOT          = (SQLITE_ERROR | (3 << 8)),
156     SQLITE_IOERR_READ              = (SQLITE_IOERR | (1 << 8)),
157     SQLITE_IOERR_SHORT_READ        = (SQLITE_IOERR | (2 << 8)),
158     SQLITE_IOERR_WRITE             = (SQLITE_IOERR | (3 << 8)),
159     SQLITE_IOERR_FSYNC             = (SQLITE_IOERR | (4 << 8)),
160     SQLITE_IOERR_DIR_FSYNC         = (SQLITE_IOERR | (5 << 8)),
161     SQLITE_IOERR_TRUNCATE          = (SQLITE_IOERR | (6 << 8)),
162     SQLITE_IOERR_FSTAT             = (SQLITE_IOERR | (7 << 8)),
163     SQLITE_IOERR_UNLOCK            = (SQLITE_IOERR | (8 << 8)),
164     SQLITE_IOERR_RDLOCK            = (SQLITE_IOERR | (9 << 8)),
165     SQLITE_IOERR_DELETE            = (SQLITE_IOERR | (10 << 8)),
166     SQLITE_IOERR_BLOCKED           = (SQLITE_IOERR | (11 << 8)),
167     SQLITE_IOERR_NOMEM             = (SQLITE_IOERR | (12 << 8)),
168     SQLITE_IOERR_ACCESS            = (SQLITE_IOERR | (13 << 8)),
169     SQLITE_IOERR_CHECKRESERVEDLOCK = (SQLITE_IOERR | (14 << 8)),
170     SQLITE_IOERR_LOCK              = (SQLITE_IOERR | (15 << 8)),
171     SQLITE_IOERR_CLOSE             = (SQLITE_IOERR | (16 << 8)),
172     SQLITE_IOERR_DIR_CLOSE         = (SQLITE_IOERR | (17 << 8)),
173     SQLITE_IOERR_SHMOPEN           = (SQLITE_IOERR | (18 << 8)),
174     SQLITE_IOERR_SHMSIZE           = (SQLITE_IOERR | (19 << 8)),
175     SQLITE_IOERR_SHMLOCK           = (SQLITE_IOERR | (20 << 8)),
176     SQLITE_IOERR_SHMMAP            = (SQLITE_IOERR | (21 << 8)),
177     SQLITE_IOERR_SEEK              = (SQLITE_IOERR | (22 << 8)),
178     SQLITE_IOERR_DELETE_NOENT      = (SQLITE_IOERR | (23 << 8)),
179     SQLITE_IOERR_MMAP              = (SQLITE_IOERR | (24 << 8)),
180     SQLITE_IOERR_GETTEMPPATH       = (SQLITE_IOERR | (25 << 8)),
181     SQLITE_IOERR_CONVPATH          = (SQLITE_IOERR | (26 << 8)),
182     SQLITE_IOERR_VNODE             = (SQLITE_IOERR | (27 << 8)),
183     SQLITE_IOERR_AUTH              = (SQLITE_IOERR | (28 << 8)),
184     SQLITE_IOERR_BEGIN_ATOMIC      = (SQLITE_IOERR | (29 << 8)),
185     SQLITE_IOERR_COMMIT_ATOMIC     = (SQLITE_IOERR | (30 << 8)),
186     SQLITE_IOERR_ROLLBACK_ATOMIC   = (SQLITE_IOERR | (31 << 8)),
187     SQLITE_IOERR_DATA              = (SQLITE_IOERR | (32 << 8)),
188     SQLITE_LOCKED_SHAREDCACHE      = (SQLITE_LOCKED |  (1 << 8)),
189     SQLITE_LOCKED_VTAB             = (SQLITE_LOCKED |  (2 << 8)),
190     SQLITE_BUSY_RECOVERY           = (SQLITE_BUSY   |  (1 << 8)),
191     SQLITE_BUSY_SNAPSHOT           = (SQLITE_BUSY   |  (2 << 8)),
192     SQLITE_BUSY_TIMEOUT            = (SQLITE_BUSY   |  (3 << 8)),
193     SQLITE_CANTOPEN_NOTEMPDIR      = (SQLITE_CANTOPEN | (1 << 8)),
194     SQLITE_CANTOPEN_ISDIR          = (SQLITE_CANTOPEN | (2 << 8)),
195     SQLITE_CANTOPEN_FULLPATH       = (SQLITE_CANTOPEN | (3 << 8)),
196     SQLITE_CANTOPEN_CONVPATH       = (SQLITE_CANTOPEN | (4 << 8)),
197     SQLITE_CANTOPEN_DIRTYWAL       = (SQLITE_CANTOPEN | (5 << 8)), /* Not Used */
198     SQLITE_CANTOPEN_SYMLINK        = (SQLITE_CANTOPEN | (6 << 8)),
199     SQLITE_CORRUPT_VTAB            = (SQLITE_CORRUPT | (1 << 8)),
200     SQLITE_CORRUPT_SEQUENCE        = (SQLITE_CORRUPT | (2 << 8)),
201     SQLITE_CORRUPT_INDEX           = (SQLITE_CORRUPT | (3 << 8)),
202     SQLITE_READONLY_RECOVERY       = (SQLITE_READONLY | (1 << 8)),
203     SQLITE_READONLY_CANTLOCK       = (SQLITE_READONLY | (2 << 8)),
204     SQLITE_READONLY_ROLLBACK       = (SQLITE_READONLY | (3 << 8)),
205     SQLITE_READONLY_DBMOVED        = (SQLITE_READONLY | (4 << 8)),
206     SQLITE_READONLY_CANTINIT       = (SQLITE_READONLY | (5 << 8)),
207     SQLITE_READONLY_DIRECTORY      = (SQLITE_READONLY | (6 << 8)),
208     SQLITE_ABORT_ROLLBACK          = (SQLITE_ABORT | (2 << 8)),
209     SQLITE_CONSTRAINT_CHECK        = (SQLITE_CONSTRAINT | (1 << 8)),
210     SQLITE_CONSTRAINT_COMMITHOOK   = (SQLITE_CONSTRAINT | (2 << 8)),
211     SQLITE_CONSTRAINT_FOREIGNKEY   = (SQLITE_CONSTRAINT | (3 << 8)),
212     SQLITE_CONSTRAINT_FUNCTION     = (SQLITE_CONSTRAINT | (4 << 8)),
213     SQLITE_CONSTRAINT_NOTNULL      = (SQLITE_CONSTRAINT | (5 << 8)),
214     SQLITE_CONSTRAINT_PRIMARYKEY   = (SQLITE_CONSTRAINT | (6 << 8)),
215     SQLITE_CONSTRAINT_TRIGGER      = (SQLITE_CONSTRAINT | (7 << 8)),
216     SQLITE_CONSTRAINT_UNIQUE       = (SQLITE_CONSTRAINT | (8 << 8)),
217     SQLITE_CONSTRAINT_VTAB         = (SQLITE_CONSTRAINT | (9 << 8)),
218     SQLITE_CONSTRAINT_ROWID        = (SQLITE_CONSTRAINT |(10 << 8)),
219     QLITE_CONSTRAINT_PINNED        = (SQLITE_CONSTRAINT |(11 << 8)),
220     SQLITE_NOTICE_RECOVER_WAL      = (SQLITE_NOTICE | (1 << 8)),
221     SQLITE_NOTICE_RECOVER_ROLLBACK = (SQLITE_NOTICE | (2 << 8)),
222     SQLITE_WARNING_AUTOINDEX       = (SQLITE_WARNING | (1 << 8)),
223     SQLITE_AUTH_USER               = (SQLITE_AUTH | (1 << 8)),
224     SQLITE_OK_LOAD_PERMANENTLY     = (SQLITE_OK | (1 << 8)),
225     SQLITE_OK_SYMLINK              = (SQLITE_OK | (2 << 8))
226 }
227 
228 /**
229 * CAPI3REF: Flags For File Open Operations
230 */
231 enum
232 {
233     SQLITE_OPEN_READONLY         = 0x00000001,  /** Ok for sqlite3_open_v2() */
234     SQLITE_OPEN_READWRITE        = 0x00000002,  /** Ok for sqlite3_open_v2() */
235     SQLITE_OPEN_CREATE           = 0x00000004,  /** Ok for sqlite3_open_v2() */
236     SQLITE_OPEN_DELETEONCLOSE    = 0x00000008,  /** VFS only */
237     SQLITE_OPEN_EXCLUSIVE        = 0x00000010,  /** VFS only */
238     SQLITE_OPEN_AUTOPROXY        = 0x00000020,  /** VFS only */
239     SQLITE_OPEN_URI              = 0x00000040,  /** Ok for sqlite3_open_v2() */
240     SQLITE_OPEN_MEMORY           = 0x00000080,  /** Ok for sqlite3_open_v2() */
241     SQLITE_OPEN_MAIN_DB          = 0x00000100,  /** VFS only */
242     SQLITE_OPEN_TEMP_DB          = 0x00000200,  /** VFS only */
243     SQLITE_OPEN_TRANSIENT_DB     = 0x00000400,  /** VFS only */
244     SQLITE_OPEN_MAIN_JOURNAL     = 0x00000800,  /** VFS only */
245     SQLITE_OPEN_TEMP_JOURNAL     = 0x00001000,  /** VFS only */
246     SQLITE_OPEN_SUBJOURNAL       = 0x00002000,  /** VFS only */
247     SQLITE_OPEN_SUPER_JOURNAL    = 0x00004000,  /** VFS only */
248     SQLITE_OPEN_NOMUTEX          = 0x00008000,  /** Ok for sqlite3_open_v2() */
249     SQLITE_OPEN_FULLMUTEX        = 0x00010000,  /** Ok for sqlite3_open_v2() */
250     SQLITE_OPEN_SHAREDCACHE      = 0x00020000,  /** Ok for sqlite3_open_v2() */
251     SQLITE_OPEN_PRIVATECACHE     = 0x00040000,  /** Ok for sqlite3_open_v2() */
252     SQLITE_OPEN_WAL              = 0x00080000,  /** VFS only */
253     SQLITE_OPEN_NOFOLLOW         = 0x01000000   /** Ok for sqlite3_open_v2() */
254 }
255 
256 deprecated ("Legacy compatibility")
257 {
258     alias SQLITE_OPEN_MASTER_JOURNAL = SQLITE_OPEN_SUPER_JOURNAL;       /** VFS only */
259 }
260 
261 /**
262 * CAPI3REF: Device Characteristics
263 */
264 enum
265 {
266     SQLITE_IOCAP_ATOMIC                 = 0x00000001,
267     SQLITE_IOCAP_ATOMIC512              = 0x00000002,
268     SQLITE_IOCAP_ATOMIC1K               = 0x00000004,
269     SQLITE_IOCAP_ATOMIC2K               = 0x00000008,
270     SQLITE_IOCAP_ATOMIC4K               = 0x00000010,
271     SQLITE_IOCAP_ATOMIC8K               = 0x00000020,
272     SQLITE_IOCAP_ATOMIC16K              = 0x00000040,
273     SQLITE_IOCAP_ATOMIC32K              = 0x00000080,
274     SQLITE_IOCAP_ATOMIC64K              = 0x00000100,
275     SQLITE_IOCAP_SAFE_APPEND            = 0x00000200,
276     SQLITE_IOCAP_SEQUENTIAL             = 0x00000400,
277     SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN  = 0x00000800,
278     SQLITE_IOCAP_POWERSAFE_OVERWRITE    = 0x00001000,
279     SQLITE_IOCAP_IMMUTABLE              = 0x00002000,
280     SQLITE_IOCAP_BATCH_ATOMIC           = 0x00004000
281 }
282 
283 /**
284 * CAPI3REF: File Locking Levels
285 */
286 enum
287 {
288     SQLITE_LOCK_NONE          = 0,
289     SQLITE_LOCK_SHARED        = 1,
290     SQLITE_LOCK_RESERVED      = 2,
291     SQLITE_LOCK_PENDING       = 3,
292     SQLITE_LOCK_EXCLUSIVE     = 4
293 }
294 
295 /**
296 * CAPI3REF: Synchronization Type Flags
297 */
298 enum
299 {
300     SQLITE_SYNC_NORMAL        = 0x00002,
301     SQLITE_SYNC_FULL          = 0x00003,
302     SQLITE_SYNC_DATAONLY      = 0x00010
303 }
304 
305 /**
306 * CAPI3REF: OS Interface Open File Handle
307 */
308 struct sqlite3_file
309 {
310     const(sqlite3_io_methods)*pMethods;  /* Methods for an open file */
311 }
312 
313 /**
314 * CAPI3REF: OS Interface File Virtual Methods Object
315 */
316 
317 struct sqlite3_io_methods
318 {
319     int iVersion;
320     int  function (sqlite3_file*) xClose;
321     int  function (sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst) xRead;
322     int  function (sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst) xWrite;
323     int  function (sqlite3_file*, sqlite3_int64 size) xTruncate;
324     int  function (sqlite3_file*, int flags) xSync;
325     int  function (sqlite3_file*, sqlite3_int64 *pSize) xFileSize;
326     int  function (sqlite3_file*, int) xLock;
327     int  function (sqlite3_file*, int) xUnlock;
328     int  function (sqlite3_file*, int *pResOut) xCheckReservedLock;
329     int  function (sqlite3_file*, int op, void *pArg) xFileControl;
330     int  function (sqlite3_file*) xSectorSize;
331     int  function (sqlite3_file*) xDeviceCharacteristics;
332     /* Methods above are valid for version 1 */
333     int  function (sqlite3_file*, int iPg, int pgsz, int, void **) xShmMap;
334     int  function (sqlite3_file*, int offset, int n, int flags) xShmLock;
335     void  function (sqlite3_file*) xShmBarrier;
336     int  function (sqlite3_file*, int deleteFlag) xShmUnmap;
337     /* Methods above are valid for version 2 */
338     /* Additional methods may be added in future releases */
339     int function (sqlite3_file*, sqlite3_int64 iOfst, int iAmt, void **pp) xFetch;
340     int function (sqlite3_file*, sqlite3_int64 iOfst, void *p) xUnfetch;
341 }
342 
343 /**
344 * CAPI3REF: Standard File Control Opcodes
345 */
346 enum
347 {
348     SQLITE_FCNTL_LOCKSTATE               = 1,
349     SQLITE_FCNTL_GET_LOCKPROXYFILE       = 2,
350     SQLITE_FCNTL_SET_LOCKPROXYFILE       = 3,
351     SQLITE_FCNTL_LAST_ERRNO              = 4,
352     SQLITE_FCNTL_SIZE_HINT               = 5,
353     SQLITE_FCNTL_CHUNK_SIZE              = 6,
354     SQLITE_FCNTL_FILE_POINTER            = 7,
355     SQLITE_FCNTL_SYNC_OMITTED            = 8,
356     SQLITE_FCNTL_WIN32_AV_RETRY          = 9,
357     SQLITE_FCNTL_PERSIST_WAL             = 10,
358     SQLITE_FCNTL_OVERWRITE               = 11,
359     SQLITE_FCNTL_VFSNAME                 = 12,
360     SQLITE_FCNTL_POWERSAFE_OVERWRITE     = 13,
361     SQLITE_FCNTL_PRAGMA                  = 14,
362     SQLITE_FCNTL_BUSYHANDLER             = 15,
363     SQLITE_FCNTL_TEMPFILENAME            = 16,
364     SQLITE_FCNTL_MMAP_SIZE               = 18,
365     SQLITE_FCNTL_TRACE                   = 19,
366     SQLITE_FCNTL_HAS_MOVED               = 20,
367     SQLITE_FCNTL_SYNC                    = 21,
368     SQLITE_FCNTL_COMMIT_PHASETWO         = 22,
369     SQLITE_FCNTL_WIN32_SET_HANDLE        = 23,
370     SQLITE_FCNTL_WAL_BLOCK               = 24,
371     SQLITE_FCNTL_ZIPVFS                  = 25,
372     SQLITE_FCNTL_RBU                     = 26,
373     SQLITE_FCNTL_VFS_POINTER             = 27,
374     SQLITE_FCNTL_JOURNAL_POINTER         = 28,
375     SQLITE_FCNTL_WIN32_GET_HANDLE        = 29,
376     SQLITE_FCNTL_PDB                     = 30,
377     SQLITE_FCNTL_BEGIN_ATOMIC_WRITE      = 31,
378     SQLITE_FCNTL_COMMIT_ATOMIC_WRITE     = 32,
379     SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE   = 33,
380     SQLITE_FCNTL_LOCK_TIMEOUT            = 34,
381     SQLITE_FCNTL_DATA_VERSION            = 35,
382     SQLITE_FCNTL_SIZE_LIMIT              = 36,
383     SQLITE_FCNTL_CKPT_DONE               = 37,
384     SQLITE_FCNTL_RESERVE_BYTES           = 38,
385     SQLITE_FCNTL_CKPT_START              = 39
386 }
387 
388 deprecated ("deprecated names")
389 {
390     alias SQLITE_GET_LOCKPROXYFILE = SQLITE_FCNTL_GET_LOCKPROXYFILE;
391     alias SQLITE_SET_LOCKPROXYFILE = SQLITE_FCNTL_SET_LOCKPROXYFILE;
392     alias SQLITE_LAST_ERRNO        = SQLITE_FCNTL_LAST_ERRNO;
393 }
394 
395 /**
396 * CAPI3REF: Mutex Handle
397 */
398 struct sqlite3_mutex;
399 
400 /**
401 * CAPI3REF: Loadable Extension Thunk
402 */
403 struct sqlite3_api_routines;
404 
405 /**
406 * CAPI3REF: OS Interface Object
407 */
408 
409 alias xDlSymReturn = void * function();
410 /// Ditto
411 alias sqlite3_syscall_ptr = void function();
412 
413 struct sqlite3_vfs
414 {
415     int iVersion;            /** Structure version number (currently 2) */
416     int szOsFile;            /** Size of subclassed sqlite3_file */
417     int mxPathname;          /** Maximum file pathname length */
418     sqlite3_vfs *pNext;      /** Next registered VFS */
419     const(char)*zName;       /** Name of this virtual file system */
420     void *pAppData;          /** Pointer to application-specific data */
421     int function (sqlite3_vfs*, const char *zName, sqlite3_file*,
422                int flags, int *pOutFlags) xOpen;
423     int  function (sqlite3_vfs*, const char *zName, int syncDir) xDelete;
424     int  function (sqlite3_vfs*, const char *zName, int flags, int *pResOut) xAccess;
425     int  function (sqlite3_vfs*, const char *zName, int nOut, char *zOut) xFullPathname;
426     void* function (sqlite3_vfs*, const char *zFilename) xDlOpen;
427     void  function (sqlite3_vfs*, int nByte, char *zErrMsg) xDlError;
428     xDlSymReturn function (sqlite3_vfs*,void*, const char *zSymbol) *xDlSym;
429     void  function (sqlite3_vfs*, void*) xDlClose;
430     int  function (sqlite3_vfs*, int nByte, char *zOut) xRandomness;
431     int  function (sqlite3_vfs*, int microseconds) xSleep;
432     int  function (sqlite3_vfs*, double*) xCurrentTime;
433     int  function (sqlite3_vfs*, int, char *) xGetLastError;
434     /*
435     ** The methods above are in version 1 of the sqlite_vfs object
436     ** definition.  Those that follow are added in version 2 or later
437     */
438     int  function (sqlite3_vfs*, sqlite3_int64*) xCurrentTimeInt64;
439     /*
440     ** The methods above are in versions 1 and 2 of the sqlite_vfs object.
441     ** Those below are for version 3 and greater.
442     */
443     int function(sqlite3_vfs*, const char * zName, sqlite3_syscall_ptr) xSetSystemCall;
444     sqlite3_syscall_ptr function(sqlite3_vfs*, const char * zName) xGetSystemCall;
445     const(char)* function(sqlite3_vfs*, const char * zName) xNextSystemCall;
446     /*
447     ** The methods above are in versions 1 through 3 of the sqlite_vfs object.
448     ** New fields may be appended in figure versions.  The iVersion
449     ** value will increment whenever this happens.
450     */
451 }
452 
453 /**
454 * CAPI3REF: Flags for the xAccess VFS method
455 */
456 enum
457 {
458     SQLITE_ACCESS_EXISTS    = 0,
459 
460     SQLITE_ACCESS_READWRITE = 1,   /** Used by PRAGMA temp_store_directory */
461     SQLITE_ACCESS_READ      = 2   /** Unused */
462 }
463 
464 /**
465 * CAPI3REF: Flags for the xShmLock VFS method
466 */
467 enum
468 {
469     SQLITE_SHM_UNLOCK       = 1,
470     SQLITE_SHM_LOCK         = 2,
471     SQLITE_SHM_SHARED       = 4,
472     SQLITE_SHM_EXCLUSIVE    = 8
473 }
474 
475 /**
476 * CAPI3REF: Maximum xShmLock index
477 */
478 enum SQLITE_SHM_NLOCK        = 8;
479 
480 
481 /**
482 * CAPI3REF: Initialize The SQLite Library
483 */
484 int sqlite3_initialize();
485 /// Ditto
486 int sqlite3_shutdown();
487 /// Ditto
488 int sqlite3_os_init();
489 /// Ditto
490 int sqlite3_os_end();
491 
492 /**
493 * CAPI3REF: Configuring The SQLite Library
494 */
495 int sqlite3_config(int, ...);
496 
497 /**
498 * CAPI3REF: Configure database connections
499 */
500 int sqlite3_db_config(sqlite3*, int op, ...);
501 
502 /**
503 * CAPI3REF: Memory Allocation Routines
504 */
505 struct sqlite3_mem_methods
506 {
507     void* function (int) xMalloc;         /** Memory allocation function */
508     void function (void*) xFree;          /** Free a prior allocation */
509     void* function (void*,int) xRealloc;  /** Resize an allocation */
510     int function (void*) xSize;           /** Return the size of an allocation */
511     int function (int) xRoundup;          /** Round up request size to allocation size */
512     int function (void*) xInit;           /** Initialize the memory allocator */
513     void function (void*) xShutdown;      /** Deinitialize the memory allocator */
514     void *pAppData;                       /** Argument to xInit() and xShutdown() */
515 }
516 
517 /**
518 * CAPI3REF: Configuration Options
519 */
520 enum
521 {
522     SQLITE_CONFIG_SINGLETHREAD         = 1,  /** nil */
523     SQLITE_CONFIG_MULTITHREAD          = 2,  /** nil */
524     SQLITE_CONFIG_SERIALIZED           = 3,  /** nil */
525     SQLITE_CONFIG_MALLOC               = 4,  /** sqlite3_mem_methods* */
526     SQLITE_CONFIG_GETMALLOC            = 5,  /** sqlite3_mem_methods* */
527     SQLITE_CONFIG_SCRATCH              = 6,  /** No longer used */
528     SQLITE_CONFIG_PAGECACHE            = 7,  /** void*, int sz, int N */
529     SQLITE_CONFIG_HEAP                 = 8,  /** void*, int nByte, int min */
530     SQLITE_CONFIG_MEMSTATUS            = 9,  /** boolean */
531     SQLITE_CONFIG_MUTEX                = 10,  /** sqlite3_mutex_methods* */
532     SQLITE_CONFIG_GETMUTEX             = 11,  /** sqlite3_mutex_methods* */
533 /* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */
534     SQLITE_CONFIG_LOOKASIDE           = 13,  /** int int */
535     SQLITE_CONFIG_PCACHE               = 14,  /** no-op */
536     SQLITE_CONFIG_GETPCACHE            = 15,  /** no-op */
537     SQLITE_CONFIG_LOG                  = 16,  /** xFunc, void* */
538     SQLITE_CONFIG_URI                  = 17,  /** int */
539     SQLITE_CONFIG_PCACHE2              = 18,  /** sqlite3_pcache_methods2* */
540     SQLITE_CONFIG_GETPCACHE2           = 19,  /** sqlite3_pcache_methods2* */
541     SQLITE_CONFIG_COVERING_INDEX_SCAN  = 20,  /** int */
542     SQLITE_CONFIG_SQLLOG               = 21,  /** xSqllog, void* */
543     SQLITE_CONFIG_MMAP_SIZE            = 22,  /** sqlite3_int64, sqlite3_int64 */
544     SQLITE_CONFIG_WIN32_HEAPSIZE       = 23,  /** int nByte */
545     SQLITE_CONFIG_PCACHE_HDRSZ         = 24,  /** int *psz */
546     SQLITE_CONFIG_PMASZ                = 25,  /** unsigned int szPma */
547     SQLITE_CONFIG_STMTJRNL_SPILL       = 26,  /** int nByte */
548     SQLITE_CONFIG_SMALL_MALLOC         = 27,  /** boolean */
549     SQLITE_CONFIG_SORTERREF_SIZE       = 28,  /** int nByte */
550     SQLITE_CONFIG_MEMDB_MAXSIZE        = 29   /** sqlite3_int64 */
551 }
552 
553 /**
554 * CAPI3REF: Database Connection Configuration Options
555 */
556 enum
557 {
558     SQLITE_DBCONFIG_MAINDBNAME             = 1000,  /** const char* */
559     SQLITE_DBCONFIG_LOOKASIDE              = 1001,  /** void* int int */
560     SQLITE_DBCONFIG_ENABLE_FKEY            = 1002,  /** int int* */
561     SQLITE_DBCONFIG_ENABLE_TRIGGER         = 1003,  /** int int* */
562     SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER  = 1004,  /** int int* */
563     SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION  = 1005,  /** int int* */
564     SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE       = 1006,  /** int int* */
565     SQLITE_DBCONFIG_ENABLE_QPSG            = 1007,  /** int int* */
566     SQLITE_DBCONFIG_TRIGGER_EQP            = 1008,  /** int int* */
567     SQLITE_DBCONFIG_RESET_DATABASE         = 1009,  /** int int* */
568     SQLITE_DBCONFIG_DEFENSIVE              = 1010,  /** int int* */
569     SQLITE_DBCONFIG_WRITABLE_SCHEMA        = 1011,  /** int int* */
570     SQLITE_DBCONFIG_LEGACY_ALTER_TABLE     = 1012,  /** int int* */
571     SQLITE_DBCONFIG_DQS_DML                = 1013,  /** int int* */
572     SQLITE_DBCONFIG_DQS_DDL                = 1014,  /** int int* */
573     SQLITE_DBCONFIG_ENABLE_VIEW            = 1015,  /** int int* */
574     SQLITE_DBCONFIG_LEGACY_FILE_FORMAT     = 1016,  /** int int* */
575     SQLITE_DBCONFIG_TRUSTED_SCHEMA         = 1017,  /** int int* */
576     SQLITE_DBCONFIG_MAX                    = 1017   /** Largest DBCONFIG */
577 }
578 
579 
580 /**
581 * CAPI3REF: Enable Or Disable Extended Result Codes
582 */
583 int sqlite3_extended_result_codes(sqlite3*, int onoff);
584 
585 /**
586 * CAPI3REF: Last Insert Rowid
587 */
588 sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);
589 
590 /**
591 * CAPI3REF: Set the Last Insert Rowid value
592 */
593 void sqlite3_set_last_insert_rowid(sqlite3*,sqlite3_int64);
594 
595 /**
596 * CAPI3REF: Count The Number Of Rows Modified
597 */
598 int sqlite3_changes(sqlite3*);
599 
600 /**
601 * CAPI3REF: Total Number Of Rows Modified
602 */
603 int sqlite3_total_changes(sqlite3*);
604 
605 /**
606 * CAPI3REF: Interrupt A Long-Running Query
607 */
608 void sqlite3_interrupt(sqlite3*);
609 
610 /**
611 * CAPI3REF: Determine If An SQL Statement Is Complete
612 */
613 int sqlite3_complete(const char *sql);
614 /// Ditto
615 int sqlite3_complete16(const void *sql);
616 
617 /**
618 * CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors
619 */
620 int sqlite3_busy_handler(sqlite3*, int function (void*,int), void*);
621 
622 /**
623 * CAPI3REF: Set A Busy Timeout
624 */
625 int sqlite3_busy_timeout(sqlite3*, int ms);
626 
627 /**
628 * CAPI3REF: Convenience Routines For Running Queries
629 */
630 int sqlite3_get_table(
631     sqlite3 *db,          /** An open database */
632     const(char)*zSql,     /** SQL to be evaluated */
633     char ***pazResult,    /** Results of the query */
634     int *pnRow,           /** Number of result rows written here */
635     int *pnColumn,        /** Number of result columns written here */
636     char **pzErrmsg       /** Error msg written here */
637 );
638 ///
639 void sqlite3_free_table(char **result);
640 
641 /**
642 * CAPI3REF: Formatted String Printing Functions
643 */
644 char *sqlite3_mprintf(const char*,...);
645 char *sqlite3_vmprintf(const char*, va_list);
646 char *sqlite3_snprintf(int,char*,const char*, ...);
647 char *sqlite3_vsnprintf(int,char*,const char*, va_list);
648 
649 /**
650 * CAPI3REF: Memory Allocation Subsystem
651 */
652 void *sqlite3_malloc(int);
653 /// Ditto
654 void *sqlite3_malloc64(sqlite3_uint64);
655 /// Ditto
656 void *sqlite3_realloc(void*, int);
657 /// Ditto
658 void *sqlite3_realloc64(void*, sqlite3_uint64);
659 /// Ditto
660 void sqlite3_free(void*);
661 /// Ditto
662 sqlite3_uint64 sqlite3_msize(void*);
663 
664 /**
665 * CAPI3REF: Memory Allocator Statistics
666 */
667 sqlite3_int64 sqlite3_memory_used();
668 sqlite3_int64 sqlite3_memory_highwater(int resetFlag);
669 
670 /**
671 * CAPI3REF: Pseudo-Random Number Generator
672 */
673 void sqlite3_randomness(int N, void *P);
674 
675 /**
676 * CAPI3REF: Compile-Time Authorization Callbacks
677 */
678 int sqlite3_set_authorizer(
679     sqlite3*,
680     int function (void*,int,const char*,const char*,const char*,const char*) xAuth,
681     void *pUserData
682 );
683 
684 /**
685 * CAPI3REF: Authorizer Return Codes
686 */
687 enum
688 {
689     SQLITE_DENY   = 1,   /** Abort the SQL statement with an error */
690     SQLITE_IGNORE = 2   /** Don't allow access, but don't generate an error */
691 }
692 
693 /**
694 * CAPI3REF: Authorizer Action Codes
695 */
696 /******************************************* 3rd ************ 4th ***********/
697 enum
698 {
699     SQLITE_CREATE_INDEX         =  1,   /** Index Name      Table Name      */
700     SQLITE_CREATE_TABLE         =  2,   /** Table Name      NULL            */
701     SQLITE_CREATE_TEMP_INDEX    =  3,   /** Index Name      Table Name      */
702     SQLITE_CREATE_TEMP_TABLE    =  4,   /** Table Name      NULL            */
703     SQLITE_CREATE_TEMP_TRIGGER  =  5,   /** Trigger Name    Table Name      */
704     SQLITE_CREATE_TEMP_VIEW     =  6,   /** View Name       NULL            */
705     SQLITE_CREATE_TRIGGER       =  7,   /** Trigger Name    Table Name      */
706     SQLITE_CREATE_VIEW          =  8,   /** View Name       NULL            */
707     SQLITE_DELETE               =  9,   /** Table Name      NULL            */
708     SQLITE_DROP_INDEX           = 10,   /** Index Name      Table Name      */
709     SQLITE_DROP_TABLE           = 11,   /** Table Name      NULL            */
710     SQLITE_DROP_TEMP_INDEX      = 12,   /** Index Name      Table Name      */
711     SQLITE_DROP_TEMP_TABLE      = 13,   /** Table Name      NULL            */
712     SQLITE_DROP_TEMP_TRIGGER    = 14,   /** Trigger Name    Table Name      */
713     SQLITE_DROP_TEMP_VIEW       = 15,   /** View Name       NULL            */
714     SQLITE_DROP_TRIGGER         = 16,   /** Trigger Name    Table Name      */
715     SQLITE_DROP_VIEW            = 17,   /** View Name       NULL            */
716     SQLITE_INSERT               = 18,   /** Table Name      NULL            */
717     SQLITE_PRAGMA               = 19,   /** Pragma Name     1st arg or NULL */
718     SQLITE_READ                 = 20,   /** Table Name      Column Name     */
719     SQLITE_SELECT               = 21,   /** NULL            NULL            */
720     SQLITE_TRANSACTION          = 22,   /** Operation       NULL            */
721     SQLITE_UPDATE               = 23,   /** Table Name      Column Name     */
722     SQLITE_ATTACH               = 24,   /** Filename        NULL            */
723     SQLITE_DETACH               = 25,   /** Database Name   NULL            */
724     SQLITE_ALTER_TABLE          = 26,   /** Database Name   Table Name      */
725     SQLITE_REINDEX              = 27,   /** Index Name      NULL            */
726     SQLITE_ANALYZE              = 28,   /** Table Name      NULL            */
727     SQLITE_CREATE_VTABLE        = 29,   /** Table Name      Module Name     */
728     SQLITE_DROP_VTABLE          = 30,   /** Table Name      Module Name     */
729     SQLITE_FUNCTION             = 31,   /** NULL            Function Name   */
730     SQLITE_SAVEPOINT            = 32,   /** Operation       Savepoint Name  */
731     SQLITE_COPY                 =  0,   /** No longer used */
732     SQLITE_RECURSIVE            = 33    /** NULL            NULL            */
733 }
734 
735 /**
736 * CAPI3REF: Tracing And Profiling Functions
737 */
738 deprecated void *sqlite3_trace(sqlite3*, void function (void*,const char*) xTrace, void*);
739 /// Ditto
740 deprecated void *sqlite3_profile(sqlite3*, void function (void*,const char*,sqlite3_uint64) xProfile, void*);
741 
742 /**
743 * CAPI3REF: SQL Trace Event Codes
744 */
745 enum
746 {
747     SQLITE_TRACE_STMT           = 0x01,
748     SQLITE_TRACE_PROFILE        = 0x02,
749     SQLITE_TRACE_ROW            = 0x04,
750     SQLITE_TRACE_CLOSE          = 0x08
751 }
752 
753 /**
754 * CAPI3REF: SQL Trace Hook
755 */
756 int sqlite3_trace_v2(
757     sqlite3*,
758     uint uMask,
759     int function (uint, void*, void*, void*) xCallback,
760     void* pCtx
761 );
762 
763 /**
764 * CAPI3REF: Query Progress Callbacks
765 */
766 void sqlite3_progress_handler(sqlite3*, int, int function (void*), void*);
767 
768 /**
769 * CAPI3REF: Opening A New Database Connection
770 */
771 int sqlite3_open(
772     const(char)*filename,   /** Database filename (UTF-8) */
773     sqlite3 **ppDb          /** OUT: SQLite db handle */
774 );
775 /// Ditto
776 int sqlite3_open16(
777     const(void)*filename,   /** Database filename (UTF-16) */
778     sqlite3 **ppDb          /** OUT: SQLite db handle */
779 );
780 /// Ditto
781 int sqlite3_open_v2(
782     const(char)*filename,   /** Database filename (UTF-8) */
783     sqlite3 **ppDb,         /** OUT: SQLite db handle */
784     int flags,              /** Flags */
785     const(char)*zVfs        /** Name of VFS module to use */
786 );
787 
788 /*
789 * CAPI3REF: Obtain Values For URI Parameters
790 */
791 const(char)* sqlite3_uri_parameter(const(char)* zFilename, const(char)* zParam);
792 /// Ditto
793 int sqlite3_uri_boolean(const(char)* zFile, const(char)* zParam, int bDefault);
794 /// Ditto
795 sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int64);
796 /// Ditto
797 const(char)* sqlite3_uri_key(const(char)* zFilename, int N);
798 
799 /*
800 * CAPI3REF: Translate filenames
801 */
802 const(char)* sqlite3_filename_database(const(char)*);
803 /// Ditto
804 const(char)* sqlite3_filename_journal(const(char)*);
805 /// Ditto
806 const(char)* sqlite3_filename_wal(const(char)*);
807 
808 /*
809 * CAPI3REF: Database File Corresponding To A Journal
810 */
811 sqlite3_file* sqlite3_database_file_object(const(char)*);
812 
813 /*
814 * CAPI3REF: Create and Destroy VFS Filenames
815 */
816 char* sqlite3_create_filename(
817     const(char)* zDatabase,
818     const(char)* zJournal,
819     const(char)* zWal,
820     int nParam,
821     const(char*)* azParam
822 );
823 /// Ditto
824 void sqlite3_free_filename(char*);
825 
826 /**
827 * CAPI3REF: Error Codes And Messages
828 */
829 int sqlite3_errcode(sqlite3 *db);
830 /// Ditto
831 int sqlite3_extended_errcode(sqlite3 *db);
832 /// Ditto
833 const(char)* sqlite3_errmsg(sqlite3*);
834 /// Ditto
835 const(void)* sqlite3_errmsg16(sqlite3*);
836 /// Ditto
837 const(char)* sqlite3_errstr(int);
838 
839 /**
840 * CAPI3REF: SQL Statement Object
841 */
842 struct sqlite3_stmt;
843 
844 /**
845 * CAPI3REF: Run-time Limits
846 */
847 int sqlite3_limit(sqlite3*, int id, int newVal);
848 
849 /**
850 * CAPI3REF: Run-Time Limit Categories
851 */
852 enum
853 {
854     SQLITE_LIMIT_LENGTH                    = 0,
855     SQLITE_LIMIT_SQL_LENGTH                = 1,
856     SQLITE_LIMIT_COLUMN                    = 2,
857     SQLITE_LIMIT_EXPR_DEPTH                = 3,
858     SQLITE_LIMIT_COMPOUND_SELECT           = 4,
859     SQLITE_LIMIT_VDBE_OP                   = 5,
860     SQLITE_LIMIT_FUNCTION_ARG              = 6,
861     SQLITE_LIMIT_ATTACHED                  = 7,
862     SQLITE_LIMIT_LIKE_PATTERN_LENGTH       = 8,
863     SQLITE_LIMIT_VARIABLE_NUMBER           = 9,
864     SQLITE_LIMIT_TRIGGER_DEPTH             = 10,
865     SQLITE_LIMIT_WORKER_THREADS            = 11
866 }
867 
868 /**
869 * CAPI3REF: Prepare Flags
870 */
871 enum
872 {
873     SQLITE_PREPARE_PERSISTENT              = 0x01,
874     SQLITE_PREPARE_NORMALIZE               = 0x02,
875     SQLITE_PREPARE_NO_VTAB                 = 0x04
876 }
877 
878 /**
879 * CAPI3REF: Compiling An SQL Statement
880 */
881 int sqlite3_prepare(
882     sqlite3 *db,            /** Database handle */
883     const(char)*zSql,       /** SQL statement, UTF-8 encoded */
884     int nByte,              /** Maximum length of zSql in bytes. */
885     sqlite3_stmt **ppStmt,  /** OUT: Statement handle */
886     const(char*)*pzTail     /** OUT: Pointer to unused portion of zSql */
887 );
888 /// Ditto
889 int sqlite3_prepare_v2(
890     sqlite3 *db,            /** Database handle */
891     const(char)*zSql,       /** SQL statement, UTF-8 encoded */
892     int nByte,              /** Maximum length of zSql in bytes. */
893     sqlite3_stmt **ppStmt,  /** OUT: Statement handle */
894     const(char*)*pzTail     /** OUT: Pointer to unused portion of zSql */
895 );
896 /// Ditto
897 int sqlite3_prepare_v3(
898     sqlite3 *db,            /** Database handle */
899     const(char)* zSql,      /** SQL statement, UTF-8 encoded */
900     int nByte,              /** Maximum length of zSql in bytes. */
901     uint prepFlags,         /** Zero or more SQLITE_PREPARE_ flags */
902     sqlite3_stmt **ppStmt,  /* OUT: Statement handle */
903     const(char*)*pzTail     /* OUT: Pointer to unused portion of zSql */
904 );
905 /// Ditto
906 int sqlite3_prepare16(
907     sqlite3 *db,            /** Database handle */
908     const(void)*zSql,       /** SQL statement, UTF-16 encoded */
909     int nByte,              /** Maximum length of zSql in bytes. */
910     sqlite3_stmt **ppStmt,  /** OUT: Statement handle */
911     const(void*)*pzTail     /** OUT: Pointer to unused portion of zSql */
912 );
913 /// Ditto
914 int sqlite3_prepare16_v2(
915     sqlite3 *db,            /** Database handle */
916     const(void)*zSql,       /** SQL statement, UTF-16 encoded */
917     int nByte,              /** Maximum length of zSql in bytes. */
918     sqlite3_stmt **ppStmt,  /** OUT: Statement handle */
919     const(void*)*pzTail     /** OUT: Pointer to unused portion of zSql */
920 );
921 /// Ditto
922 int sqlite3_prepare16_v3(
923     sqlite3 *db,            /** Database handle */
924     const(void)*zSql,       /** SQL statement, UTF-16 encoded */
925     int nByte,              /** Maximum length of zSql in bytes. */
926     uint prepFlags,         /** Zero or more SQLITE_PREPARE_ flags */
927     sqlite3_stmt **ppStmt,  /** OUT: Statement handle */
928     const(void*)*pzTail     /** OUT: Pointer to unused portion of zSql */
929 );
930 
931 /**
932 * CAPI3REF: Retrieving Statement SQL
933 */
934 const(char)* sqlite3_sql(sqlite3_stmt *pStmt);
935 /// Ditto
936 char* sqlite3_expanded_sql(sqlite3_stmt *pStmt);
937 const(char)* sqlite3_normalized_sql(sqlite3_stmt *pStmt);
938 
939 /*
940 * CAPI3REF: Determine If An SQL Statement Writes The Database
941 */
942 int sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
943 
944 /*
945 * CAPI3REF: Query The EXPLAIN Setting For A Prepared Statement
946 */
947 int sqlite3_stmt_isexplain(sqlite3_stmt *pStmt);
948 
949 /**
950 * CAPI3REF: Determine If A Prepared Statement Has Been Reset
951 */
952 int sqlite3_stmt_busy(sqlite3_stmt*);
953 
954 
955 /**
956 * CAPI3REF: Dynamically Typed Value Object
957 */
958 struct sqlite3_value;
959 
960 /**
961 * CAPI3REF: SQL Function Context Object
962 */
963 struct sqlite3_context;
964 
965 /**
966 * CAPI3REF: Binding Values To Prepared Statements
967 */
968 int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void function (void*));
969 /// Ditto
970 int sqlite3_bind_blob64(sqlite3_stmt*, int, const void*, sqlite3_uint64,void function (void*));
971 /// Ditto
972 int sqlite3_bind_double(sqlite3_stmt*, int, double);
973 /// Ditto
974 int sqlite3_bind_int(sqlite3_stmt*, int, int);
975 /// Ditto
976 int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64);
977 /// Ditto
978 int sqlite3_bind_null(sqlite3_stmt*, int);
979 /// Ditto
980 int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int n, void function (void*));
981 /// Ditto
982 int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void function (void*));
983 /// Ditto
984 int sqlite3_bind_text64(sqlite3_stmt*, int, const char*, sqlite3_uint64,void function (void*), ubyte encoding);
985 /// Ditto
986 int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
987 /// Ditto
988 int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
989 /// Ditto
990 int sqlite3_bind_zeroblob64(sqlite3_stmt*, int, sqlite3_uint64 n);
991 
992 /**
993 * CAPI3REF: Number Of SQL Parameters
994 */
995 int sqlite3_bind_parameter_count(sqlite3_stmt*);
996 
997 /**
998 * CAPI3REF: Name Of A Host Parameter
999 */
1000 const(char)* sqlite3_bind_parameter_name(sqlite3_stmt*, int);
1001 
1002 /**
1003 * CAPI3REF: Index Of A Parameter With A Given Name
1004 */
1005 int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName);
1006 
1007 /**
1008 * CAPI3REF: Reset All Bindings On A Prepared Statement
1009 */
1010 int sqlite3_clear_bindings(sqlite3_stmt*);
1011 
1012 /**
1013 * CAPI3REF: Number Of Columns In A Result Set
1014 */
1015 int sqlite3_column_count(sqlite3_stmt *pStmt);
1016 
1017 /**
1018 * CAPI3REF: Column Names In A Result Set
1019 */
1020 const(char)* sqlite3_column_name(sqlite3_stmt*, int N);
1021 /// Ditto
1022 const(void)* sqlite3_column_name16(sqlite3_stmt*, int N);
1023 
1024 /**
1025 * CAPI3REF: Source Of Data In A Query Result
1026 */
1027 const(char)* sqlite3_column_database_name(sqlite3_stmt*,int);
1028 /// Ditto
1029 const(void)* sqlite3_column_database_name16(sqlite3_stmt*,int);
1030 /// Ditto
1031 const(char)* sqlite3_column_table_name(sqlite3_stmt*,int);
1032 /// Ditto
1033 const (void)* sqlite3_column_table_name16(sqlite3_stmt*,int);
1034 /// Ditto
1035 const (char)* sqlite3_column_origin_name(sqlite3_stmt*,int);
1036 /// Ditto
1037 const (void)* sqlite3_column_origin_name16(sqlite3_stmt*,int);
1038 
1039 /**
1040 * CAPI3REF: Declared Datatype Of A Query Result
1041 */
1042 const (char)* sqlite3_column_decltype(sqlite3_stmt*,int);
1043 /// Ditto
1044 const (void)* sqlite3_column_decltype16(sqlite3_stmt*,int);
1045 
1046 /**
1047 * CAPI3REF: Evaluate An SQL Statement
1048 */
1049 int sqlite3_step(sqlite3_stmt*);
1050 
1051 /**
1052 * CAPI3REF: Number of columns in a result set
1053 */
1054 int sqlite3_data_count(sqlite3_stmt *pStmt);
1055 
1056 /**
1057 * CAPI3REF: Fundamental Datatypes
1058 */
1059 enum
1060 {
1061     SQLITE_INTEGER  = 1,
1062     SQLITE_FLOAT    = 2,
1063     SQLITE_BLOB     = 4,
1064     SQLITE_NULL     = 5,
1065     SQLITE3_TEXT    = 3
1066 }
1067 
1068 /**
1069 * CAPI3REF: Result Values From A Query
1070 */
1071 const (void)* sqlite3_column_blob(sqlite3_stmt*, int iCol);
1072 /// Ditto
1073 double sqlite3_column_double(sqlite3_stmt*, int iCol);
1074 /// Ditto
1075 int sqlite3_column_int(sqlite3_stmt*, int iCol);
1076 /// Ditto
1077 sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol);
1078 /// Ditto
1079 const (char)* sqlite3_column_text(sqlite3_stmt*, int iCol);
1080 /// Ditto
1081 const (void)* sqlite3_column_text16(sqlite3_stmt*, int iCol);
1082 /// Ditto
1083 sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol);
1084 /// Ditto
1085 int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
1086 /// Ditto
1087 int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
1088 /// Ditto
1089 int sqlite3_column_type(sqlite3_stmt*, int iCol);
1090 
1091 /**
1092 * CAPI3REF: Destroy A Prepared Statement Object
1093 */
1094 int sqlite3_finalize(sqlite3_stmt *pStmt);
1095 
1096 /**
1097 * CAPI3REF: Reset A Prepared Statement Object
1098 */
1099 int sqlite3_reset(sqlite3_stmt *pStmt);
1100 
1101 /**
1102 * CAPI3REF: Create Or Redefine SQL Functions
1103 */
1104 int sqlite3_create_function(
1105     sqlite3 *db,
1106     const(char)*zFunctionName,
1107     int nArg,
1108     int eTextRep,
1109     void *pApp,
1110     void function (sqlite3_context*,int,sqlite3_value**) xFunc,
1111     void function (sqlite3_context*,int,sqlite3_value**) xStep,
1112     void function (sqlite3_context*) xFinal
1113 );
1114 /// Ditto
1115 int sqlite3_create_function16(
1116     sqlite3 *db,
1117     const(void)*zFunctionName,
1118     int nArg,
1119     int eTextRep,
1120     void *pApp,
1121     void function (sqlite3_context*,int,sqlite3_value**) xFunc,
1122     void function (sqlite3_context*,int,sqlite3_value**) xStep,
1123     void function (sqlite3_context*) xFinal
1124 );
1125 /// Ditto
1126 int sqlite3_create_function_v2(
1127     sqlite3 *db,
1128     const(char)*zFunctionName,
1129     int nArg,
1130     int eTextRep,
1131     void *pApp,
1132     void function (sqlite3_context*,int,sqlite3_value**) xFunc,
1133     void function (sqlite3_context*,int,sqlite3_value**) xStep,
1134     void function (sqlite3_context*) xFinal,
1135     void function (void*) xDestroy
1136 );
1137 /// Ditto
1138 int sqlite3_create_window_function(
1139     sqlite3 *db,
1140     const(char)*zFunctionName,
1141     int nArg,
1142     int eTextRep,
1143     void *pApp,
1144     void function (sqlite3_context*,int,sqlite3_value**) xStep,
1145     void function (sqlite3_context*) xFinal,
1146     void function (sqlite3_context*) xValue,
1147     void function (sqlite3_context*,int,sqlite3_value**) xInverse,
1148     void function (void*) xDestroy
1149 );
1150 
1151 /**
1152 * CAPI3REF: Text Encodings
1153 *
1154 * These constant define integer codes that represent the various
1155 * text encodings supported by SQLite.
1156 */
1157 enum
1158 {
1159     SQLITE_UTF8           = 1,    /** IMP: R-37514-35566 */
1160     SQLITE_UTF16LE        = 2,    /** IMP: R-03371-37637 */
1161     SQLITE_UTF16BE        = 3,    /** IMP: R-51971-34154 */
1162     SQLITE_UTF16          = 4,    /** Use native byte order */
1163     SQLITE_ANY            = 5,    /** sqlite3_create_function only */
1164     SQLITE_UTF16_ALIGNED  = 8    /** sqlite3_create_collation only */
1165 }
1166 
1167 /**
1168 * CAPI3REF: Function Flags
1169 */
1170 enum SQLITE_DETERMINISTIC = 0x000000800;
1171 enum SQLITE_DIRECTONLY    = 0x000080000;
1172 enum SQLITE_SUBTYPE       = 0x000100000;
1173 enum SQLITE_INNOCUOUS     = 0x000200000;
1174 
1175 /**
1176 * CAPI3REF: Deprecated Functions
1177 */
1178 deprecated int sqlite3_aggregate_count(sqlite3_context*);
1179 deprecated int sqlite3_expired(sqlite3_stmt*);
1180 deprecated int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*);
1181 deprecated int sqlite3_global_recover();
1182 deprecated void sqlite3_thread_cleanup();
1183 deprecated int sqlite3_memory_alarm(void function(void*,sqlite3_int64,int),void*,sqlite3_int64);
1184 
1185 /**
1186 * CAPI3REF: Obtaining SQL Function Parameter Values
1187 */
1188 const (void)* sqlite3_value_blob(sqlite3_value*);
1189 /// Ditto
1190 int sqlite3_value_bytes(sqlite3_value*);
1191 /// Ditto
1192 int sqlite3_value_bytes16(sqlite3_value*);
1193 /// Ditto
1194 double sqlite3_value_double(sqlite3_value*);
1195 /// Ditto
1196 int sqlite3_value_int(sqlite3_value*);
1197 /// Ditto
1198 sqlite3_int64 sqlite3_value_int64(sqlite3_value*);
1199 /// Ditto
1200 const (char)* sqlite3_value_text(sqlite3_value*);
1201 /// Ditto
1202 const (void)* sqlite3_value_text16(sqlite3_value*);
1203 /// Ditto
1204 const (void)* sqlite3_value_text16le(sqlite3_value*);
1205 /// Ditto
1206 const (void)* sqlite3_value_text16be(sqlite3_value*);
1207 /// Ditto
1208 int sqlite3_value_type(sqlite3_value*);
1209 /// Ditto
1210 int sqlite3_value_numeric_type(sqlite3_value*);
1211 /// Ditto
1212 int sqlite3_value_nochange(sqlite3_value*);
1213 /// Ditto
1214 int sqlite3_value_frombind(sqlite3_value*);
1215 
1216 /*
1217 * CAPI3REF: Finding The Subtype Of SQL Values
1218 */
1219 uint sqlite3_value_subtype(sqlite3_value*);
1220 
1221 /*
1222 * CAPI3REF: Copy And Free SQL Values
1223 */
1224 sqlite3_value* sqlite3_value_dup(const sqlite3_value*);
1225 void sqlite3_value_free(sqlite3_value*);
1226 
1227 /**
1228 * CAPI3REF: Obtain Aggregate Function Context
1229 */
1230 void *sqlite3_aggregate_context(sqlite3_context*, int nBytes);
1231 
1232 /**
1233 * CAPI3REF: User Data For Functions
1234 */
1235 void *sqlite3_user_data(sqlite3_context*);
1236 
1237 /**
1238 * CAPI3REF: Database Connection For Functions
1239 */
1240 sqlite3 *sqlite3_context_db_handle(sqlite3_context*);
1241 
1242 /**
1243 * CAPI3REF: Function Auxiliary Data
1244 */
1245 void *sqlite3_get_auxdata(sqlite3_context*, int N);
1246 /// Ditto
1247 void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void function (void*));
1248 
1249 
1250 /**
1251 * CAPI3REF: Constants Defining Special Destructor Behavior
1252 */
1253 alias sqlite3_destructor_type = void function (void*);
1254 /// Ditto
1255 enum
1256 {
1257     SQLITE_STATIC      = (cast(sqlite3_destructor_type) 0),
1258     SQLITE_TRANSIENT   = (cast (sqlite3_destructor_type) -1)
1259 }
1260 
1261 /**
1262 * CAPI3REF: Setting The Result Of An SQL Function
1263 */
1264 void sqlite3_result_blob(sqlite3_context*, const void*, int, void function(void*));
1265 /// Ditto
1266 void sqlite3_result_blob64(sqlite3_context*,const void*,sqlite3_uint64,void function(void*));
1267 /// Ditto
1268 void sqlite3_result_double(sqlite3_context*, double);
1269 /// Ditto
1270 void sqlite3_result_error(sqlite3_context*, const char*, int);
1271 /// Ditto
1272 void sqlite3_result_error16(sqlite3_context*, const void*, int);
1273 /// Ditto
1274 void sqlite3_result_error_toobig(sqlite3_context*);
1275 /// Ditto
1276 void sqlite3_result_error_nomem(sqlite3_context*);
1277 /// Ditto
1278 void sqlite3_result_error_code(sqlite3_context*, int);
1279 /// Ditto
1280 void sqlite3_result_int(sqlite3_context*, int);
1281 /// Ditto
1282 void sqlite3_result_int64(sqlite3_context*, sqlite3_int64);
1283 /// Ditto
1284 void sqlite3_result_null(sqlite3_context*);
1285 /// Ditto
1286 void sqlite3_result_text(sqlite3_context*, const char*, int, void function(void*));
1287 /// Ditto
1288 void sqlite3_result_text64(sqlite3_context*, const char*,sqlite3_uint64,void function(void*), ubyte encoding);
1289 /// Ditto
1290 void sqlite3_result_text16(sqlite3_context*, const void*, int, void function(void*));
1291 /// Ditto
1292 void sqlite3_result_text16le(sqlite3_context*, const void*, int, void function(void*));
1293 /// Ditto
1294 void sqlite3_result_text16be(sqlite3_context*, const void*, int, void function(void*));
1295 /// Ditto
1296 void sqlite3_result_value(sqlite3_context*, sqlite3_value*);
1297 /// Ditto
1298 void sqlite3_result_zeroblob(sqlite3_context*, int n);
1299 /// Ditto
1300 int sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n);
1301 
1302 /*
1303 * CAPI3REF: Setting The Subtype Of An SQL Function
1304 */
1305 void sqlite3_result_subtype(sqlite3_context*,uint);
1306 
1307 /**
1308 * CAPI3REF: Define New Collating Sequences
1309 */
1310 int sqlite3_create_collation(
1311     sqlite3*,
1312     const(char)*zName,
1313     int eTextRep,
1314     void *pArg,
1315     int function (void*,int,const void*,int,const void*) xCompare
1316 );
1317 /// Ditto
1318 int sqlite3_create_collation_v2(
1319     sqlite3*,
1320     const(char)*zName,
1321     int eTextRep,
1322     void *pArg,
1323     int function (void*,int,const void*,int,const void*) xCompare,
1324     void function (void*) xDestroy
1325 );
1326 /// Ditto
1327 int sqlite3_create_collation16(
1328     sqlite3*,
1329     const(void)*zName,
1330     int eTextRep,
1331     void *pArg,
1332     int function (void*,int,const void*,int,const void*) xCompare
1333 );
1334 
1335 /**
1336 * CAPI3REF: Collation Needed Callbacks
1337 */
1338 int sqlite3_collation_needed(
1339     sqlite3*,
1340     void*,
1341     void function (void*,sqlite3*,int eTextRep,const char*)
1342 );
1343 /// Ditto
1344 int sqlite3_collation_needed16(
1345     sqlite3*,
1346     void*,
1347     void function (void*,sqlite3*,int eTextRep,const void*)
1348 );
1349 
1350 /**
1351 * Specify the activation key for a CEROD database.  Unless
1352 * activated, none of the CEROD routines will work.
1353 */
1354 void sqlite3_activate_cerod(
1355     const(char)*zPassPhrase        /** Activation phrase */
1356 );
1357 
1358 /**
1359 * CAPI3REF: Suspend Execution For A Short Time
1360 */
1361 int sqlite3_sleep(int);
1362 
1363 /**
1364 * CAPI3REF: Name Of The Folder Holding Temporary Files
1365 */
1366 extern char *sqlite3_temp_directory;
1367 
1368 /**
1369 * CAPI3REF: Name Of The Folder Holding Database Files
1370 */
1371 extern char *sqlite3_data_directory;
1372 
1373 /**
1374 * CAPI3REF: Win32 Specific Interface
1375 */
1376 int sqlite3_win32_set_directory(
1377     c_ulong type,        /** Identifier for directory being set or reset */
1378     void* zValue        /** New value for directory being set or reset */
1379 );
1380 /// Ditto
1381 int sqlite3_win32_set_directory8(
1382     c_ulong type,        /** Identifier for directory being set or reset */
1383     void* zValue        /** New value for directory being set or reset */
1384 );
1385 /// Ditto
1386 int sqlite3_win32_set_directory16(
1387     c_ulong type,        /** Identifier for directory being set or reset */
1388     void* zValue        /** New value for directory being set or reset */
1389 );
1390 
1391 /**
1392 * CAPI3REF: Win32 Directory Types
1393 */
1394 enum
1395 {
1396     SQLITE_WIN32_DATA_DIRECTORY_TYPE       = 1,
1397     SQLITE_WIN32_TEMP_DIRECTORY_TYPE       = 2
1398 }
1399 
1400 /**
1401 * CAPI3REF: Test For Auto-Commit Mode
1402 */
1403 int sqlite3_get_autocommit(sqlite3*);
1404 
1405 /**
1406 * CAPI3REF: Find The Database Handle Of A Prepared Statement
1407 */
1408 sqlite3 *sqlite3_db_handle(sqlite3_stmt*);
1409 
1410 /**
1411 * CAPI3REF: Return The Filename For A Database Connection
1412 */
1413 const(char)* sqlite3_db_filename(sqlite3 *db, const char* zDbName);
1414 
1415 /**
1416 * CAPI3REF: Determine if a database is read-only
1417 */
1418 int sqlite3_db_readonly(sqlite3 *db, const char * zDbName);
1419 
1420 /*
1421 * CAPI3REF: Find the next prepared statement
1422 */
1423 sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt);
1424 
1425 /**
1426 * CAPI3REF: Commit And Rollback Notification Callbacks
1427 */
1428 void *sqlite3_commit_hook(sqlite3*, int function (void*), void*);
1429 /// Ditto
1430 void *sqlite3_rollback_hook(sqlite3*, void function (void *), void*);
1431 
1432 /**
1433 * CAPI3REF: Data Change Notification Callbacks
1434 */
1435 void *sqlite3_update_hook(
1436     sqlite3*,
1437     void function (void *,int ,char *, char *, sqlite3_int64),
1438     void*
1439 );
1440 
1441 /**
1442 * CAPI3REF: Enable Or Disable Shared Pager Cache
1443 */
1444 int sqlite3_enable_shared_cache(int);
1445 
1446 /**
1447 * CAPI3REF: Attempt To Free Heap Memory
1448 */
1449 int sqlite3_release_memory(int);
1450 
1451 /**
1452 * CAPI3REF: Free Memory Used By A Database Connection
1453 */
1454 int sqlite3_db_release_memory(sqlite3*);
1455 
1456 /*
1457 * CAPI3REF: Impose A Limit On Heap Size
1458 */
1459 sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N);
1460 sqlite3_int64 sqlite3_hard_heap_limit64(sqlite3_int64 N);
1461 
1462 /**
1463 * CAPI3REF: Deprecated Soft Heap Limit Interface
1464 */
1465 deprecated void sqlite3_soft_heap_limit(int N);
1466 
1467 /**
1468 * CAPI3REF: Extract Metadata About A Column Of A Table
1469 */
1470 int sqlite3_table_column_metadata(
1471     sqlite3 *db,                /** Connection handle */
1472     const(char)*zDbName,        /** Database name or NULL */
1473     const(char)*zTableName,     /** Table name */
1474     const(char)*zColumnName,    /** Column name */
1475     char **pzDataType,    /** OUTPUT: Declared data type */
1476     char **pzCollSeq,     /** OUTPUT: Collation sequence name */
1477     int *pNotNull,              /** OUTPUT: True if NOT NULL constraint exists */
1478     int *pPrimaryKey,           /** OUTPUT: True if column part of PK */
1479     int *pAutoinc               /** OUTPUT: True if column is auto-increment */
1480 );
1481 
1482 /**
1483 * CAPI3REF: Load An Extension
1484 */
1485 int sqlite3_load_extension(
1486     sqlite3 *db,          /** Load the extension into this database connection */
1487     const(char)*zFile,    /** Name of the shared library containing extension */
1488     const(char)*zProc,    /** Entry point.  Derived from zFile if 0 */
1489     char **pzErrMsg       /** Put error message here if not 0 */
1490 );
1491 
1492 /**
1493 * CAPI3REF: Enable Or Disable Extension Loading
1494 */
1495 int sqlite3_enable_load_extension(sqlite3 *db, int onoff);
1496 
1497 /**
1498 * CAPI3REF: Automatically Load Statically Linked Extensions
1499 */
1500 int sqlite3_auto_extension(void function () xEntryPoint);
1501 
1502 /**
1503 * CAPI3REF: Cancel Automatic Extension Loading
1504 */
1505 int sqlite3_cancel_auto_extension(void function() xEntryPoint);
1506 
1507 /**
1508 * CAPI3REF: Reset Automatic Extension Loading
1509 */
1510 void sqlite3_reset_auto_extension();
1511 
1512 /**
1513 * The interface to the virtual-table mechanism is currently considered
1514 * to be experimental.  The interface might change in incompatible ways.
1515 * If this is a problem for you, do not use the interface at this time.
1516 *
1517 * When the virtual-table mechanism stabilizes, we will declare the
1518 * interface fixed, support it indefinitely, and remove this comment.
1519 */
1520 
1521 /**
1522 * CAPI3REF: Virtual Table Object
1523 */
1524 
1525 alias mapFunction = void function (sqlite3_context*,int,sqlite3_value**);
1526 
1527 /// Ditto
1528 struct sqlite3_module
1529 {
1530     int iVersion;
1531     int function (sqlite3*, void *pAux,
1532                int argc, const char **argv,
1533                sqlite3_vtab **ppVTab, char**) xCreate;
1534     int function (sqlite3*, void *pAux,
1535                int argc, const char **argv,
1536                sqlite3_vtab **ppVTab, char**) xConnect;
1537     int function (sqlite3_vtab *pVTab, sqlite3_index_info*) xBestIndex;
1538     int function (sqlite3_vtab *pVTab) xDisconnect;
1539     int function (sqlite3_vtab *pVTab) xDestroy;
1540     int function (sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor) xOpen;
1541     int function (sqlite3_vtab_cursor*) xClose;
1542     int function (sqlite3_vtab_cursor*, int idxNum, const char *idxStr,
1543                 int argc, sqlite3_value **argv) xFilter;
1544     int function (sqlite3_vtab_cursor*) xNext;
1545     int function (sqlite3_vtab_cursor*) xEof;
1546     int function (sqlite3_vtab_cursor*, sqlite3_context*, int) xColumn;
1547     int function (sqlite3_vtab_cursor*, sqlite3_int64 *pRowid) xRowid;
1548     int function (sqlite3_vtab *, int, sqlite3_value **, sqlite3_int64 *) xUpdate;
1549     int function (sqlite3_vtab *pVTab) xBegin;
1550     int function (sqlite3_vtab *pVTab) xSync;
1551     int function (sqlite3_vtab *pVTab) xCommit;
1552     int function (sqlite3_vtab *pVTab) xRollback;
1553     int function (sqlite3_vtab *pVtab, int nArg, const char *zName,
1554                        mapFunction*,
1555                        void **ppArg) xFindFunction;
1556     int function (sqlite3_vtab *pVtab, const char *zNew) xRename;
1557     int function (sqlite3_vtab *pVTab, int) xSavepoint;
1558     int function (sqlite3_vtab *pVTab, int) xRelease;
1559     int function (sqlite3_vtab *pVTab, int) xRollbackTo;
1560     int function (const char*) xShadowName;
1561 }
1562 
1563 /**
1564 * CAPI3REF: Virtual Table Indexing Information
1565 */
1566 struct sqlite3_index_info
1567 {
1568     struct sqlite3_index_constraint
1569     {
1570         int iColumn;            /** constrained.  -1 for ROWID */
1571         char op;                /** Constraint operator */
1572         char usable;            /** True if this constraint is usable */
1573         int iTermOffset;        /** Used internally - xBestIndex should ignore */
1574     }
1575     struct sqlite3_index_orderby
1576     {
1577         int iColumn;            /** Column number */
1578         char desc;              /** True for DESC.  False for ASC. */
1579     }
1580     struct sqlite3_index_constraint_usage
1581     {
1582         int argvIndex;           /** if >0, constraint is part of argv to xFilter */
1583         char omit;               /** Do not code a test for this constraint */
1584     }
1585     /* Inputs */
1586     int nConstraint;           /** Number of entries in aConstraint */
1587     sqlite3_index_constraint* aConstraint;  /** Table of WHERE clause constraints */
1588     int nOrderBy;              /** Number of terms in the ORDER BY clause */
1589     sqlite3_index_orderby *aOrderBy; /** The ORDER BY clause */
1590     /* Outputs */
1591     sqlite3_index_constraint_usage *aConstraintUsage;
1592     int idxNum;                /** Number used to identify the index */
1593     char *idxStr;              /** String, possibly obtained from sqlite3_malloc */
1594     int needToFreeIdxStr;      /** Free idxStr using sqlite3_free() if true */
1595     int orderByConsumed;       /** True if output is already ordered */
1596     double estimatedCost;      /** Estimated cost of using this index */
1597     sqlite3_int64 estimatedRows;
1598     int idxFlags;
1599     sqlite3_uint64 colUsed;
1600 }
1601 
1602 /**
1603 * CAPI3REF: Virtual Table Scan Flags
1604 */
1605 enum
1606 {
1607     SQLITE_INDEX_SCAN_UNIQUE       = 1
1608 }
1609 
1610 /**
1611 * CAPI3REF: Virtual Table Constraint Operator Codes
1612 */
1613 enum
1614 {
1615     SQLITE_INDEX_CONSTRAINT_EQ         = 2,
1616     SQLITE_INDEX_CONSTRAINT_GT         = 4,
1617     SQLITE_INDEX_CONSTRAINT_LE         = 8,
1618     SQLITE_INDEX_CONSTRAINT_LT         = 16,
1619     SQLITE_INDEX_CONSTRAINT_GE         = 32,
1620     SQLITE_INDEX_CONSTRAINT_MATCH      = 64,
1621     SQLITE_INDEX_CONSTRAINT_LIKE       = 65,
1622     SQLITE_INDEX_CONSTRAINT_GLOB       = 66,
1623     SQLITE_INDEX_CONSTRAINT_REGEXP     = 67,
1624     SQLITE_INDEX_CONSTRAINT_NE         = 68,
1625     SQLITE_INDEX_CONSTRAINT_ISNOT      = 69,
1626     SQLITE_INDEX_CONSTRAINT_ISNOTNULL  = 70,
1627     SQLITE_INDEX_CONSTRAINT_ISNULL     = 71,
1628     SQLITE_INDEX_CONSTRAINT_IS         = 72,
1629     SQLITE_INDEX_CONSTRAINT_FUNCTION   = 150
1630 }
1631 
1632 /**
1633 * CAPI3REF: Register A Virtual Table Implementation
1634 */
1635 int sqlite3_create_module(
1636     sqlite3 *db,                    /* SQLite connection to register module with */
1637     const(char)*zName,              /* Name of the module */
1638     const(sqlite3_module)*p,        /* Methods for the module */
1639     void *pClientData               /* Client data for xCreate/xConnect */
1640 );
1641 /// Ditto
1642 int sqlite3_create_module_v2(
1643     sqlite3 *db,                    /* SQLite connection to register module with */
1644     const(char)*zName,              /* Name of the module */
1645     const(sqlite3_module)*p,        /* Methods for the module */
1646     void *pClientData,              /* Client data for xCreate/xConnect */
1647     void function (void*) xDestroy  /* Module destructor function */
1648 );
1649 
1650 /**
1651 * CAPI3REF: Remove Unnecessary Virtual Table Implementations
1652 */
1653 int sqlite3_drop_modules(
1654     sqlite3 *db,                    /* Remove modules from this connection */
1655     const(char*)* azKeep            /* Except, do not remove the ones named here */
1656 );
1657 
1658 /**
1659 * CAPI3REF: Virtual Table Instance Object
1660 */
1661 struct sqlite3_vtab
1662 {
1663     const(sqlite3_module)*pModule;  /** The module for this virtual table */
1664     int nRef;                       /** NO LONGER USED */
1665     char *zErrMsg;                  /** Error message from sqlite3_mprintf() */
1666     /* Virtual table implementations will typically add additional fields */
1667 }
1668 
1669 /**
1670 * CAPI3REF: Virtual Table Cursor Object
1671 */
1672 struct sqlite3_vtab_cursor
1673 {
1674     sqlite3_vtab *pVtab;      /** Virtual table of this cursor */
1675     /* Virtual table implementations will typically add additional fields */
1676 }
1677 
1678 /**
1679 * CAPI3REF: Declare The Schema Of A Virtual Table
1680 */
1681 int sqlite3_declare_vtab(sqlite3*, const char *zSQL);
1682 
1683 /**
1684 * CAPI3REF: Overload A Function For A Virtual Table
1685 */
1686 int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg);
1687 
1688 /**
1689 * The interface to the virtual-table mechanism defined above (back up
1690 * to a comment remarkably similar to this one) is currently considered
1691 * to be experimental.  The interface might change in incompatible ways.
1692 * If this is a problem for you, do not use the interface at this time.
1693 *
1694 * When the virtual-table mechanism stabilizes, we will declare the
1695 * interface fixed, support it indefinitely, and remove this comment.
1696 */
1697 
1698 /*
1699 * CAPI3REF: A Handle To An Open BLOB
1700 */
1701 struct sqlite3_blob;
1702 
1703 /**
1704 * CAPI3REF: Open A BLOB For Incremental I/O
1705 */
1706 int sqlite3_blob_open(
1707     sqlite3*,
1708     const(char)* zDb,
1709     const(char)* zTable,
1710     const(char)* zColumn,
1711     sqlite3_int64 iRow,
1712     int flags,
1713     sqlite3_blob **ppBlob
1714 );
1715 
1716 /**
1717 * CAPI3REF: Move a BLOB Handle to a New Row
1718 */
1719 int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64);
1720 
1721 /**
1722 * CAPI3REF: Close A BLOB Handle
1723 */
1724 int sqlite3_blob_close(sqlite3_blob *);
1725 
1726 /**
1727 * CAPI3REF: Return The Size Of An Open BLOB
1728 */
1729 int sqlite3_blob_bytes(sqlite3_blob *);
1730 
1731 /**
1732 * CAPI3REF: Read Data From A BLOB Incrementally
1733 */
1734 int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
1735 
1736 /**
1737 * CAPI3REF: Write Data Into A BLOB Incrementally
1738 */
1739 int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset);
1740 
1741 /**
1742 * CAPI3REF: Virtual File System Objects
1743 */
1744 sqlite3_vfs *sqlite3_vfs_find(const char *zVfsName);
1745 /// Ditto
1746 int sqlite3_vfs_register(sqlite3_vfs*, int makeDflt);
1747 /// Ditto
1748 int sqlite3_vfs_unregister(sqlite3_vfs*);
1749 
1750 /**
1751 * CAPI3REF: Mutexes
1752 */
1753 sqlite3_mutex *sqlite3_mutex_alloc(int);
1754 /// Ditto
1755 void sqlite3_mutex_free(sqlite3_mutex*);
1756 /// Ditto
1757 void sqlite3_mutex_enter(sqlite3_mutex*);
1758 /// Ditto
1759 int sqlite3_mutex_try(sqlite3_mutex*);
1760 /// Ditto
1761 void sqlite3_mutex_leave(sqlite3_mutex*);
1762 
1763 /**
1764 * CAPI3REF: Mutex Methods Object
1765 */
1766 struct sqlite3_mutex_methods
1767 {
1768     int  function () xMutexInit;
1769     int  function () xMutexEnd;
1770     sqlite3_mutex* function (int) xMutexAlloc;
1771     void  function (sqlite3_mutex *) xMutexFree;
1772     void  function (sqlite3_mutex *) xMutexEnter;
1773     int  function (sqlite3_mutex *) xMutexTry;
1774     void  function (sqlite3_mutex *) xMutexLeave;
1775     int  function (sqlite3_mutex *) xMutexHeld;
1776     int  function (sqlite3_mutex *) xMutexNotheld;
1777 }
1778 
1779 /**
1780 * CAPI3REF: Mutex Verification Routines
1781 */
1782 
1783 //#ifndef NDEBUG
1784 int sqlite3_mutex_held(sqlite3_mutex*);
1785 /// Ditto
1786 int sqlite3_mutex_notheld(sqlite3_mutex*);
1787 //#endif
1788 
1789 /**
1790 * CAPI3REF: Mutex Types
1791 */
1792 enum
1793 {
1794     SQLITE_MUTEX_FAST             = 0,
1795     SQLITE_MUTEX_RECURSIVE        = 1,
1796     SQLITE_MUTEX_STATIC_MAIN      = 2,
1797     SQLITE_MUTEX_STATIC_MEM       = 3,  /** sqlite3_malloc() */
1798     SQLITE_MUTEX_STATIC_MEM2      = 4,  /** NOT USED */
1799     SQLITE_MUTEX_STATIC_OPEN      = 4,  /** sqlite3BtreeOpen() */
1800     SQLITE_MUTEX_STATIC_PRNG      = 5,  /** sqlite3_randomness() */
1801     SQLITE_MUTEX_STATIC_LRU       = 6,  /** lru page list */
1802     SQLITE_MUTEX_STATIC_LRU2      = 7,  /** NOT USED */
1803     SQLITE_MUTEX_STATIC_PMEM      = 7,  /** sqlite3PageMalloc() */
1804     SQLITE_MUTEX_STATIC_APP1      = 8,  /** For use by application */
1805     SQLITE_MUTEX_STATIC_APP2      = 9,  /** For use by application */
1806     SQLITE_MUTEX_STATIC_APP3      = 10, /** For use by application */
1807     SQLITE_MUTEX_STATIC_VFS1      = 11, /** For use by built-in VFS */
1808     SQLITE_MUTEX_STATIC_VFS2      = 12, /** For use by extension VFS */
1809     SQLITE_MUTEX_STATIC_VFS3      = 13, /** For use by application VFS */
1810 }
1811 
1812 deprecated ("Legacy compatibility")
1813 {
1814     alias SQLITE_MUTEX_STATIC_MASTER = SQLITE_MUTEX_STATIC_MAIN;
1815 }
1816 
1817 /**
1818 * CAPI3REF: Retrieve the mutex for a database connection
1819 */
1820 sqlite3_mutex *sqlite3_db_mutex(sqlite3*);
1821 
1822 /**
1823 * CAPI3REF: Low-Level Control Of Database Files
1824 */
1825 int sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*);
1826 
1827 /**
1828 * CAPI3REF: Testing Interface
1829 */
1830 int sqlite3_test_control(int op, ...);
1831 
1832 /**
1833 * CAPI3REF: Testing Interface Operation Codes
1834 */
1835 enum
1836 {
1837     SQLITE_TESTCTRL_FIRST                   = 5,
1838     SQLITE_TESTCTRL_PRNG_SAVE               = 5,
1839     SQLITE_TESTCTRL_PRNG_RESTORE            = 6,
1840     SQLITE_TESTCTRL_PRNG_RESET              = 7,  /** NOT USED */
1841     SQLITE_TESTCTRL_BITVEC_TEST             = 8,
1842     SQLITE_TESTCTRL_FAULT_INSTALL           = 9,
1843     SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS     = 10,
1844     SQLITE_TESTCTRL_PENDING_BYTE            = 11,
1845     SQLITE_TESTCTRL_ASSERT                  = 12,
1846     SQLITE_TESTCTRL_ALWAYS                  = 13,
1847     SQLITE_TESTCTRL_RESERVE                 = 14,  /** NOT USED */
1848     SQLITE_TESTCTRL_OPTIMIZATIONS           = 15,
1849     SQLITE_TESTCTRL_ISKEYWORD               = 16,  /** NOT USED */
1850     SQLITE_TESTCTRL_SCRATCHMALLOC           = 17,  /** NOT USED */
1851     SQLITE_TESTCTRL_INTERNAL_FUNCTIONS      = 17,
1852     SQLITE_TESTCTRL_LOCALTIME_FAULT         = 18,
1853     SQLITE_TESTCTRL_EXPLAIN_STMT            = 19,  /** NOT USED */
1854     SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD    = 19,
1855     SQLITE_TESTCTRL_NEVER_CORRUPT           = 20,
1856     SQLITE_TESTCTRL_VDBE_COVERAGE           = 21,
1857     SQLITE_TESTCTRL_BYTEORDER               = 22,
1858     SQLITE_TESTCTRL_ISINIT                  = 23,
1859     SQLITE_TESTCTRL_SORTER_MMAP             = 24,
1860     SQLITE_TESTCTRL_IMPOSTER                = 25,
1861     SQLITE_TESTCTRL_PARSER_COVERAGE         = 26,
1862     SQLITE_TESTCTRL_RESULT_INTREAL          = 27,
1863     SQLITE_TESTCTRL_PRNG_SEED               = 28,
1864     SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS     = 29,
1865     SQLITE_TESTCTRL_LAST                    = 29,  /** Largest TESTCTRL */
1866 }
1867 
1868 /**
1869 * CAPI3REF: SQL Keyword Checking
1870 */
1871 int sqlite3_keyword_count();
1872 /// Ditto
1873 int sqlite3_keyword_name(int, const(char*)*, int*);
1874 /// Ditto
1875 int sqlite3_keyword_check(const(char)*, int);
1876 
1877 /**
1878 * CAPI3REF: Dynamic String Object
1879 */
1880 struct sqlite3_str;
1881 
1882 /**
1883 * CAPI3REF: Create A New Dynamic String Object
1884 */
1885 sqlite3_str* sqlite3_str_new(sqlite3*);
1886 
1887 /**
1888 * CAPI3REF: Finalize A Dynamic String
1889 */
1890 char* sqlite3_str_finish(sqlite3_str*);
1891 
1892 /**
1893 * CAPI3REF: Add Content To A Dynamic String
1894 */
1895 void sqlite3_str_appendf(sqlite3_str*, const(char)* zFormat, ...);
1896 /// Ditto
1897 void sqlite3_str_vappendf(sqlite3_str*, const(char)* zFormat, va_list);
1898 /// Ditto
1899 void sqlite3_str_append(sqlite3_str*, const(char)* zIn, int N);
1900 /// Ditto
1901 void sqlite3_str_appendall(sqlite3_str*, const(char)* zIn);
1902 /// Ditto
1903 void sqlite3_str_appendchar(sqlite3_str*, int N, char C);
1904 /// Ditto
1905 void sqlite3_str_reset(sqlite3_str*);
1906 
1907 /**
1908 * CAPI3REF: Status Of A Dynamic String
1909 */
1910 int sqlite3_str_errcode(sqlite3_str*);
1911 int sqlite3_str_length(sqlite3_str*);
1912 char* sqlite3_str_value(sqlite3_str*);
1913 
1914 /**
1915 * CAPI3REF: SQLite Runtime Status
1916 */
1917 int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag);
1918 /// Ditto
1919 int  sqlite3_status64(int op, long *pCurrent, long *pHighwater, int resetFlag);
1920 
1921 /**
1922 * CAPI3REF: Status Parameters
1923 */
1924 enum
1925 {
1926     SQLITE_STATUS_MEMORY_USED          = 0,
1927     SQLITE_STATUS_PAGECACHE_USED       = 1,
1928     SQLITE_STATUS_PAGECACHE_OVERFLOW   = 2,
1929     SQLITE_STATUS_SCRATCH_USED         = 3,  /** NOT USED */
1930     SQLITE_STATUS_SCRATCH_OVERFLOW     = 4,  /** NOT USED */
1931     SQLITE_STATUS_MALLOC_SIZE          = 5,
1932     SQLITE_STATUS_PARSER_STACK         = 6,
1933     SQLITE_STATUS_PAGECACHE_SIZE       = 7,
1934     SQLITE_STATUS_SCRATCH_SIZE         = 8,  /** NOT USED */
1935     SQLITE_STATUS_MALLOC_COUNT         = 9
1936 }
1937 
1938 /**
1939 * CAPI3REF: Database Connection Status
1940 */
1941 int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
1942 
1943 /**
1944 * CAPI3REF: Status Parameters for database connections
1945 */
1946 enum
1947 {
1948     SQLITE_DBSTATUS_LOOKASIDE_USED      = 0,
1949     SQLITE_DBSTATUS_CACHE_USED          = 1,
1950     SQLITE_DBSTATUS_SCHEMA_USED         = 2,
1951     SQLITE_DBSTATUS_STMT_USED           = 3,
1952     SQLITE_DBSTATUS_LOOKASIDE_HIT       = 4,
1953     SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE = 5,
1954     SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL = 6,
1955     SQLITE_DBSTATUS_CACHE_HIT           = 7,
1956     SQLITE_DBSTATUS_CACHE_MISS          = 8,
1957     SQLITE_DBSTATUS_CACHE_WRITE         = 9,
1958     SQLITE_DBSTATUS_DEFERRED_FKS        = 10,
1959     SQLITE_DBSTATUS_CACHE_USED_SHARED   = 11,
1960     SQLITE_DBSTATUS_CACHE_SPILL         = 12,
1961     SQLITE_DBSTATUS_MAX                 = 12   /** Largest defined DBSTATUS */
1962 }
1963 
1964 /**
1965 * CAPI3REF: Prepared Statement Status
1966 */
1967 int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
1968 
1969 /**
1970 * CAPI3REF: Status Parameters for prepared statements
1971 */
1972 enum
1973 {
1974     SQLITE_STMTSTATUS_FULLSCAN_STEP     = 1,
1975     SQLITE_STMTSTATUS_SORT              = 2,
1976     SQLITE_STMTSTATUS_AUTOINDEX         = 3,
1977     SQLITE_STMTSTATUS_VM_STEP           = 4,
1978     SQLITE_STMTSTATUS_REPREPARE         = 5,
1979     SQLITE_STMTSTATUS_RUN               = 6,
1980     SQLITE_STMTSTATUS_MEMUSED           = 99
1981 }
1982 
1983 /**
1984 * CAPI3REF: Custom Page Cache Object
1985 */
1986 struct sqlite3_pcache;
1987 
1988 /**
1989 * CAPI3REF: Custom Page Cache Object
1990 */
1991 struct sqlite3_pcache_page
1992 {
1993     void *pBuf;        /* The content of the page */
1994     void *pExtra;      /* Extra information associated with the page */
1995 }
1996 
1997 /**
1998 * CAPI3REF: Application Defined Page Cache.
1999 */
2000 struct sqlite3_pcache_methods2
2001 {
2002     int iVersion;
2003     void *pArg;
2004     int function(void*) xInit;
2005     void function(void*) xShutdown;
2006     sqlite3_pcache * function(int szPage, int szExtra, int bPurgeable) xCreate;
2007     void function(sqlite3_pcache*, int nCachesize) xCachesize;
2008     int function(sqlite3_pcache*) xPagecount;
2009     sqlite3_pcache_page * function(sqlite3_pcache*, uint key, int createFlag) xFetch;
2010     void function(sqlite3_pcache*, sqlite3_pcache_page*, int discard) xUnpin;
2011     void function(sqlite3_pcache*, sqlite3_pcache_page*,
2012      uint oldKey, uint newKey) xRekey;
2013     void function(sqlite3_pcache*, uint iLimit) xTruncate;
2014     void function(sqlite3_pcache*) xDestroy;
2015     void function(sqlite3_pcache*) xShrink;
2016 }
2017 
2018 struct sqlite3_pcache_methods
2019 {
2020     void *pArg;
2021     int  function (void*) xInit;
2022     void  function (void*) xShutdown;
2023     sqlite3_pcache* function (int szPage, int bPurgeable) xCreate;
2024     void  function (sqlite3_pcache*, int nCachesize) xCachesize;
2025     int  function (sqlite3_pcache*) xPagecount;
2026     void* function (sqlite3_pcache*, uint key, int createFlag) xFetch;
2027     void  function (sqlite3_pcache*, void*, int discard) xUnpin;
2028     void  function (sqlite3_pcache*, void*, uint oldKey, uint newKey) xRekey;
2029     void  function (sqlite3_pcache*, uint iLimit) xTruncate;
2030     void  function (sqlite3_pcache*) xDestroy;
2031 }
2032 
2033 /**
2034 * CAPI3REF: Online Backup Object
2035 */
2036 struct sqlite3_backup;
2037 
2038 /**
2039 * CAPI3REF: Online Backup API.
2040 */
2041 sqlite3_backup *sqlite3_backup_init(
2042     sqlite3 *pDest,                        /** Destination database handle */
2043     const(char)*zDestName,                 /** Destination database name */
2044     sqlite3 *pSource,                      /** Source database handle */
2045     const(char)*zSourceName                /** Source database name */
2046 );
2047 /// Ditto
2048 int sqlite3_backup_step(sqlite3_backup *p, int nPage);
2049 /// Ditto
2050 int sqlite3_backup_finish(sqlite3_backup *p);
2051 /// Ditto
2052 int sqlite3_backup_remaining(sqlite3_backup *p);
2053 /// Ditto
2054 int sqlite3_backup_pagecount(sqlite3_backup *p);
2055 
2056 /**
2057 * CAPI3REF: Unlock Notification
2058 */
2059 int sqlite3_unlock_notify(
2060     sqlite3 *pBlocked,                               /** Waiting connection */
2061     void function (void **apArg, int nArg) xNotify,  /** Callback function to invoke */
2062     void *pNotifyArg                                 /** Argument to pass to xNotify */
2063 );
2064 
2065 /**
2066 * CAPI3REF: String Comparison
2067 */
2068 int sqlite3_stricmp(const char * , const char * );
2069 int sqlite3_strnicmp(const char * , const char * , int);
2070 
2071 /*
2072 * CAPI3REF: String Globbing
2073 *
2074 */
2075 int sqlite3_strglob(const(char)* zGlob, const(char)* zStr);
2076 
2077 /*
2078 * CAPI3REF: String LIKE Matching
2079 */
2080 int sqlite3_strlike(const(char)* zGlob, const(char)* zStr, uint cEsc);
2081 
2082 /**
2083 * CAPI3REF: Error Logging Interface
2084 */
2085 void sqlite3_log(int iErrCode, const char *zFormat, ...);
2086 
2087 /**
2088 * CAPI3REF: Write-Ahead Log Commit Hook
2089 */
2090 void *sqlite3_wal_hook(
2091     sqlite3*,
2092     int function (void *,sqlite3*,const char*,int),
2093     void*
2094 );
2095 
2096 /**
2097 * CAPI3REF: Configure an auto-checkpoint
2098 */
2099 int sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
2100 
2101 /**
2102 * CAPI3REF: Checkpoint a database
2103 */
2104 int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
2105 
2106 /**
2107 * CAPI3REF: Checkpoint a database
2108 */
2109 int sqlite3_wal_checkpoint_v2(
2110     sqlite3 *db,                    /** Database handle */
2111     const(char)*zDb,                /** Name of attached database (or NULL) */
2112     int eMode,                      /** SQLITE_CHECKPOINT_* value */
2113     int *pnLog,                     /** OUT: Size of WAL log in frames */
2114     int *pnCkpt                     /** OUT: Total number of frames checkpointed */
2115 );
2116 
2117 /**
2118 * CAPI3REF: Checkpoint operation parameters
2119 */
2120 enum
2121 {
2122     SQLITE_CHECKPOINT_PASSIVE  = 0,
2123     SQLITE_CHECKPOINT_FULL     = 1,
2124     SQLITE_CHECKPOINT_RESTART  = 2,
2125     SQLITE_CHECKPOINT_TRUNCATE = 3,
2126 }
2127 
2128 /*
2129 * CAPI3REF: Virtual Table Interface Configuration
2130 */
2131 int sqlite3_vtab_config(sqlite3*, int op, ...);
2132 
2133 /**
2134 * CAPI3REF: Virtual Table Configuration Options
2135 */
2136 enum SQLITE_VTAB_CONSTRAINT_SUPPORT = 1;
2137 enum SQLITE_VTAB_INNOCUOUS          = 2;
2138 enum SQLITE_VTAB_DIRECTONLY         = 3;
2139 
2140 /*
2141 * 2010 August 30
2142 *
2143 * The author disclaims copyright to this source code.  In place of
2144 * a legal notice, here is a blessing:
2145 *
2146 *    May you do good and not evil.
2147 *    May you find forgiveness for yourself and forgive others.
2148 *    May you share freely, never taking more than you give.
2149 *
2150 ************************************************************************
2151 */
2152 
2153 //#ifndef _SQLITE3RTREE_H_
2154 //#define _SQLITE3RTREE_H_
2155 
2156 
2157 /*
2158 * CAPI3REF: Determine The Virtual Table Conflict Policy
2159 */
2160 int sqlite3_vtab_on_conflict(sqlite3 *);
2161 
2162 /*
2163 * CAPI3REF: Determine If Virtual Table Column Access Is For UPDATE
2164 */
2165 int sqlite3_vtab_nochange(sqlite3_context*);
2166 
2167 /*
2168 * CAPI3REF: Determine The Collation For a Virtual Table Constraint
2169 */
2170 const(char)* sqlite3_vtab_collation (sqlite3_index_info*, int);
2171 
2172 /*
2173 * CAPI3REF: Conflict resolution modes
2174 */
2175 enum
2176 {
2177     SQLITE_ROLLBACK = 1,
2178     SQLITE_FAIL     = 3,
2179     SQLITE_REPLACE  = 5
2180 }
2181 
2182 /*
2183 * CAPI3REF: Prepared Statement Scan Status Opcodes
2184 */
2185 enum
2186 {
2187     SQLITE_SCANSTAT_NLOOP    = 0,
2188     SQLITE_SCANSTAT_NVISIT   = 1,
2189     SQLITE_SCANSTAT_EST      = 2,
2190     SQLITE_SCANSTAT_NAME     = 3,
2191     SQLITE_SCANSTAT_EXPLAIN  = 4,
2192     SQLITE_SCANSTAT_SELECTID = 5,
2193 }
2194 
2195 /*
2196 * CAPI3REF: Prepared Statement Scan Status
2197 */
2198 int sqlite3_stmt_scanstatus(sqlite3_stmt *pStmt, int idx, int iScanStatusOp, void *pOut);
2199 
2200 /*
2201 * CAPI3REF: Zero Scan-Status Counters
2202 */
2203 void sqlite3_stmt_scanstatus_reset(sqlite3_stmt *);
2204 
2205 /*
2206 * CAPI3REF: Flush caches to disk mid-transaction
2207 */
2208 int sqlite3_db_cacheflush(sqlite3 *);
2209 
2210 /*
2211 * CAPI3REF: The pre-update hook
2212 */
2213 void* sqlite3_preupdate_hook(
2214     sqlite3* db,
2215     void function(
2216         void* pCtx,
2217         sqlite3* db,                  /** Database handle */
2218         int op,                       /** SQLITE_UPDATE, DELETE or INSERT */
2219         const(char)* zDb,             /** Database name */
2220         const(char)* zName,           /** Table name */
2221         sqlite3_int64 iKey1,          /** Rowid of row about to be deleted/updated */
2222         sqlite3_int64 iKey2
2223     ) xPreUpdate,
2224     void*
2225 );
2226 /// Ditto
2227 int sqlite3_preupdate_old(sqlite3*, int, sqlite3_value**);
2228 /// Ditto
2229 int sqlite3_preupdate_count(sqlite3*);
2230 /// Ditto
2231 int sqlite3_preupdate_depth(sqlite3*);
2232 /// Ditto
2233 int sqlite3_preupdate_new(sqlite3*, int, sqlite3_value**);
2234 
2235 /*
2236 * CAPI3REF: Database Snapshot
2237 */
2238 struct sqlite3_snapshot
2239 {
2240     ubyte[48] hidden;
2241 }
2242 
2243 /*
2244 * CAPI3REF: Record A Database Snapshot
2245 */
2246 int sqlite3_snapshot_get(sqlite3 *db, char *zSchema, sqlite3_snapshot **ppSnapshot);
2247 
2248 /*
2249 * CAPI3REF: Start a read transaction on an historical snapshot
2250 */
2251 int sqlite3_snapshot_open(sqlite3 *db, char *zSchema, sqlite3_snapshot *pSnapshot);
2252 
2253 /*
2254 * CAPI3REF: Destroy a snapshot
2255 */
2256 void sqlite3_snapshot_free(sqlite3_snapshot *);
2257 
2258 /*
2259 * CAPI3REF: Compare the ages of two snapshot handles
2260 */
2261 int sqlite3_snapshot_cmp(sqlite3_snapshot* p1, sqlite3_snapshot* p2);
2262 
2263 /*
2264 * CAPI3REF: Recover snapshots from a wal file
2265 */
2266 int sqlite3_snapshot_recover (sqlite3* db, const(char)* zDb);
2267 
2268 /*
2269 * CAPI3REF: Serialize a database
2270 */
2271 ubyte* sqlite3_serialize(
2272     sqlite3* db,
2273     const(char)* zSchema,
2274     sqlite3_int64* piSize,
2275     uint mFlags
2276 );
2277 
2278 /*
2279 * CAPI3REF: Serialize a database
2280 */
2281 enum
2282 {
2283     SQLITE_SERIALIZE_NOCOPY     = 0x001
2284 }
2285 
2286 /*
2287 * CAPI3REF: Deserialize a database
2288 */
2289 int sqlite3_deserialize (
2290     sqlite3* db,
2291     const(char)* zSchema,
2292     ubyte* pData,
2293     sqlite3_int64 szDb,
2294     sqlite3_int64 szBuf,
2295     uint mFlags
2296 );
2297 
2298 /*
2299 * CAPI3REF: Flags for sqlite3_deserialize()
2300 */
2301 enum
2302 {
2303     SQLITE_DESERIALIZE_FREEONCLOSE     = 1,
2304     SQLITE_DESERIALIZE_RESIZEABLE      = 2,
2305     SQLITE_DESERIALIZE_READONLY        = 4
2306 }
2307 
2308 /**
2309 * Register a geometry callback named zGeom that can be used as part of an
2310 * R-Tree geometry query as follows:
2311 *
2312 *   SELECT ... FROM $(LT)rtree$(GT) WHERE $(LT)rtree col$(GT) MATCH $zGeom(... params ...)
2313 */
2314 int sqlite3_rtree_geometry_callback(
2315     sqlite3 *db,
2316     const(char)*zGeom,
2317     int function (sqlite3_rtree_geometry *, int nCoord, double *aCoord, int *pRes) xGeom,
2318     void *pContext
2319 );
2320 
2321 /**
2322 * A pointer to a structure of the following type is passed as the first
2323 * argument to callbacks registered using rtree_geometry_callback().
2324 */
2325 struct sqlite3_rtree_geometry
2326 {
2327     void *pContext;                   /** Copy of pContext passed to s_r_g_c() */
2328     int nParam;                       /** Size of array aParam[] */
2329     double *aParam;                   /** Parameters passed to SQL geom function */
2330     void *pUser;                      /** Callback implementation user data */
2331     void function (void *) xDelUser;  /** Called by SQLite to clean up pUser */
2332 }
2333 
2334 int sqlite3_rtree_query_callback(
2335     sqlite3 *db,
2336     const(char)* zQueryFunc,
2337     int function(sqlite3_rtree_query_info*) xQueryFunc,
2338     void *pContext,
2339     void function(void*) xDestructor
2340 );
2341 
2342 struct sqlite3_rtree_query_info
2343 {
2344     void *pContext;                   /* pContext from when function registered */
2345     int nParam;                       /* Number of function parameters */
2346     double*aParam;        /* value of function parameters */
2347     void *pUser;                      /* callback can use this, if desired */
2348     void function(void*) xDelUser;          /* function to free pUser */
2349     double*aCoord;        /* Coordinates of node or entry to check */
2350     uint *anQueue;            /* Number of pending entries in the queue */
2351     int nCoord;                       /* Number of coordinates */
2352     int iLevel;                       /* Level of current node or entry */
2353     int mxLevel;                      /* The largest iLevel value in the tree */
2354     sqlite3_int64 iRowid;             /* Rowid for current entry */
2355     double rParentScore;   /* Score of parent node */
2356     int eParentWithin;                /* Visibility of parent node */
2357     int eWithin;                      /* OUT: Visibility */
2358     double rScore;         /* OUT: Write the score here */
2359     sqlite3_value **apSqlParam;       /* Original SQL values of parameters */
2360 }
2361 
2362 enum
2363 {
2364     NOT_WITHIN    = 0,       /** Object completely outside of query region */
2365     PARTLY_WITHIN = 1,       /** Object partially overlaps query region */
2366     FULLY_WITHIN  = 2        /** Object fully contained within query region */
2367 }
2368 
2369 /*
2370 * CAPI3REF: Session Object Handle
2371 */
2372 struct sqlite3_session;
2373 
2374 /*
2375 * CAPI3REF: Session Object Handle
2376 */
2377 struct sqlite3_changeset_iter;
2378 
2379 /*
2380 * CAPI3REF: Create A New Session Object
2381 */
2382 int sqlite3session_create (
2383     sqlite3* db,
2384     const(char)* zDb,
2385     sqlite3_session** ppSession
2386 );
2387 
2388 /*
2389 * CAPI3REF: Delete A Session Object
2390 */
2391 void sqlite3session_delete(sqlite3_session* pSession);
2392 
2393 /*
2394 * CAPI3REF: Enable Or Disable A Session Object
2395 */
2396 int sqlite3session_enable(sqlite3_session* pSession, int bEnable);
2397 
2398 /*
2399 * CAPI3REF: Set Or Clear the Indirect Change Flag
2400 */
2401 int sqlite3session_indirect(sqlite3_session* pSession, int bIndirect);
2402 
2403 /*
2404 * CAPI3REF: Attach A Table To A Session Object
2405 */
2406 int sqlite3session_attach(sqlite3_session* pSession, const(char)* zTab);
2407 
2408 /*
2409 * CAPI3REF: Set a table filter on a Session Object
2410 */
2411 void sqlite3session_table_filter(
2412     sqlite3_session* pSession,
2413     int function (void* pCtx, const(char)* zTab) xFilter,
2414     void* pCtx
2415 );
2416 
2417 /*
2418 * CAPI3REF: Generate A Changeset From A Session Object
2419 */
2420 int sqlite3session_changeset(
2421     sqlite3_session* pSession,
2422     int* pnChangeset,
2423     void** ppChangeset
2424 );
2425 
2426 /*
2427 * CAPI3REF: Load The Difference Between Tables Into A Session
2428 */
2429 int sqlite3session_diff(
2430     sqlite3_session* pSession,
2431     const(char)* zFromDb,
2432     const(char)* zTbl,
2433     char** pzErrMsg
2434 );
2435 
2436 /*
2437 * CAPI3REF: Generate A Patchset From A Session Object
2438 */
2439 int sqlite3session_patchset(
2440     sqlite3_session* pSession,
2441     int* pnPatchset,
2442     void** ppPatchset
2443 );
2444 
2445 /*
2446 * CAPI3REF: Test if a changeset has recorded any changes
2447 */
2448 int sqlite3session_isempty (sqlite3_session* pSession);
2449 
2450 /*
2451 * CAPI3REF: Create An Iterator To Traverse A Changeset
2452 */
2453 int sqlite3changeset_start(
2454     sqlite3_changeset_iter** pp,
2455     int nChangeset,
2456     void* pChangeset
2457 );
2458 /// Ditto
2459 int sqlite3changeset_start_v2(
2460     sqlite3_changeset_iter** pp,
2461     int nChangeset,
2462     void* pChangeset,
2463     int flags
2464 );
2465 
2466 /*
2467 * CAPI3REF: Flags for sqlite3changeset_start_v2
2468 */
2469 enum
2470 {
2471     SQLITE_CHANGESETSTART_INVERT        = 0x0002
2472 }
2473 
2474 /*
2475 * CAPI3REF: Advance A Changeset Iterator
2476 */
2477 int sqlite3changeset_next(sqlite3_changeset_iter* pIter);
2478 
2479 /*
2480 * CAPI3REF: Obtain The Current Operation From A Changeset Iterator
2481 */
2482 int sqlite3changeset_op(
2483     sqlite3_changeset_iter* pIter,
2484     const(char*)* pzTab,
2485     int* pnCol,
2486     int* pOp,
2487     int* pbIndirect
2488 );
2489 
2490 /*
2491 * CAPI3REF: Obtain The Primary Key Definition Of A Table
2492 */
2493 int sqlite3changeset_pk(
2494     sqlite3_changeset_iter* pIter,
2495     ubyte** pabPK,
2496     int* pnCol
2497 );
2498 
2499 /*
2500 * CAPI3REF: Obtain old.* Values From A Changeset Iterator
2501 */
2502 int sqlite3changeset_old(
2503     sqlite3_changeset_iter* pIter,
2504     int iVal,
2505     sqlite3_value** ppValue
2506 );
2507 
2508 /*
2509 * CAPI3REF: Obtain new.* Values From A Changeset Iterator
2510 */
2511 int sqlite3changeset_new(
2512     sqlite3_changeset_iter* pIter,
2513     int iVal,
2514     sqlite3_value** ppValue
2515 );
2516 
2517 /*
2518 * CAPI3REF: Obtain Conflicting Row Values From A Changeset Iterator
2519 */
2520 int sqlite3changeset_conflict(
2521     sqlite3_changeset_iter* pIter,
2522     int iVal,
2523     sqlite3_value** ppValue
2524 );
2525 
2526 /*
2527 * CAPI3REF: Determine The Number Of Foreign Key Constraint Violations
2528 */
2529 int sqlite3changeset_fk_conflicts(sqlite3_changeset_iter* pIter, int* pnOut);
2530 
2531 /*
2532 * CAPI3REF: Finalize A Changeset Iterator
2533 */
2534 int sqlite3changeset_finalize (sqlite3_changeset_iter* pIter);
2535 
2536 /*
2537 * CAPI3REF: Invert A Changeset
2538 */
2539 int sqlite3changeset_invert(
2540     int nIn,
2541     const(void)* pIn,
2542     int* pnOut,
2543     void** ppOut
2544 );
2545 
2546 /*
2547 * CAPI3REF: Concatenate Two Changeset Objects
2548 */
2549 int sqlite3changeset_concat(
2550     int nA,
2551     void* pA,
2552     int nB,
2553     void* pB,
2554     int* pnOut,
2555     void** ppOut
2556 );
2557 
2558 /*
2559 * CAPI3REF: Changegroup Handle
2560 */
2561 struct sqlite3_changegroup;
2562 
2563 /*
2564 * CAPI3REF: Create A New Changegroup Object
2565 */
2566 int sqlite3changegroup_new(sqlite3_changegroup** pp);
2567 
2568 /*
2569 * CAPI3REF: Add A Changeset To A Changegroup
2570 */
2571 int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void* pData);
2572 
2573 /*
2574 * CAPI3REF: Obtain A Composite Changeset From A Changegroup
2575 */
2576 int sqlite3changegroup_output(
2577     sqlite3_changegroup*,
2578     int* pnData,
2579     void** ppData
2580 );
2581 
2582 /*
2583 * CAPI3REF: Delete A Changegroup Object
2584 */
2585 void sqlite3changegroup_delete (sqlite3_changegroup*);
2586 
2587 /*
2588 * CAPI3REF: Apply A Changeset To A Database
2589 */
2590 int sqlite3changeset_apply(
2591     sqlite3* db,
2592     int nChangeset,
2593     void* pChangeset,
2594     int function(void* pCtx, const(char)* zTab) xFilter,
2595     int function(void* pCtx, int eConflict, sqlite3_changeset_iter* p) xConflict,
2596     void* pCtx
2597 );
2598 /// Ditto
2599 int sqlite3changeset_apply_v2(
2600     sqlite3* db,
2601     int nChangeset,
2602     void* pChangeset,
2603     int function(void* pCtx, const(char)* zTab) xFilter,
2604     int function(void* pCtx, int eConflict, sqlite3_changeset_iter* p) xConflict,
2605     void* pCtx,
2606     void** ppRebase,
2607     int* pnRebase,
2608     int flags
2609 );
2610 
2611 /*
2612 * CAPI3REF: Flags for sqlite3changeset_apply_v2
2613 */
2614 enum
2615 {
2616     SQLITE_CHANGESETAPPLY_NOSAVEPOINT        = 0x0001,
2617     SQLITE_CHANGESETAPPLY_INVERT             = 0x0002
2618 }
2619 
2620 /*
2621 * CAPI3REF: Constants Passed To The Conflict Handler
2622 */
2623 enum
2624 {
2625     SQLITE_CHANGESET_DATA               = 1,
2626     SQLITE_CHANGESET_NOTFOUND           = 2,
2627     SQLITE_CHANGESET_CONFLICT           = 3,
2628     SQLITE_CHANGESET_CONSTRAINT         = 4,
2629     SQLITE_CHANGESET_FOREIGN_KEY        = 5
2630 }
2631 
2632 /*
2633 * CAPI3REF: Constants Returned By The Conflict Handler
2634 */
2635 enum
2636 {
2637     SQLITE_CHANGESET_OMIT           = 0,
2638     SQLITE_CHANGESET_REPLACE        = 1,
2639     SQLITE_CHANGESET_ABORT          = 2
2640 }
2641 
2642 /*
2643 * CAPI3REF: Rebasing changesets
2644 */
2645 struct sqlite3_rebaser;
2646 
2647 /*
2648 * CAPI3REF: Create a changeset rebaser object
2649 */
2650 int sqlite3rebaser_create(sqlite3_rebaser** ppNew);
2651 
2652 /*
2653 * CAPI3REF: Configure a changeset rebaser object
2654 */
2655 int sqlite3rebaser_configure(
2656     sqlite3_rebaser*,
2657     int nRebase,
2658     const(void)* pRebase
2659 );
2660 
2661 /*
2662 * CAPI3REF: Rebase a changeset
2663 */
2664 int sqlite3rebaser_rebase(
2665     sqlite3_rebaser*,
2666     int nIn,
2667     const(void)* pIn,
2668     int* pnOut,
2669     void** ppOut
2670 );
2671 
2672 /*
2673 * CAPI3REF: Delete a changeset rebaser object
2674 */
2675 void sqlite3rebaser_delete(sqlite3_rebaser* p);
2676 
2677 /*
2678 * CAPI3REF: Streaming Versions of API functions
2679 */
2680 int sqlite3changeset_apply_strm(
2681     sqlite3* db,
2682     int function (void* pIn, void* pData, int* pnData) xInput,
2683     void* pIn,
2684     int function (void* pCtx, const(char)* zTab) xFilter,
2685     int function (void* pCtx, int eConflict, sqlite3_changeset_iter* p) xConflict,
2686     void* pCtx
2687 );
2688 /// Ditto
2689 int sqlite3changeset_apply_v2_strm(
2690     sqlite3* db,
2691     int function (void* pIn, void* pData, int* pnData) xInput,
2692     void* pIn,
2693     int function (void* pCtx, const(char)* zTab) xFilter,
2694     int function (void* pCtx, int eConflict, sqlite3_changeset_iter* p) xConflict,
2695     void* pCtx,
2696     void** ppRebase,
2697     int* pnRebase,
2698     int flags
2699 );
2700 /// Ditto
2701 int sqlite3changeset_concat_strm(
2702     int function (void* pIn, void* pData, int* pnData) xInputA,
2703     void* pInA,
2704     int function (void* pIn, void* pData, int* pnData) xInputB,
2705     void* pInB,
2706     int function (void* pOut, const(void)* pData, int nData) xOutput,
2707     void* pOut
2708 );
2709 /// Ditto
2710 int sqlite3changeset_invert_strm(
2711     int function (void* pIn, void* pData, int* pnData) xInput,
2712     void* pIn,
2713     int function (void* pOut, const(void)* pData, int nData) xOutput,
2714     void* pOut
2715 );
2716 /// Ditto
2717 int sqlite3changeset_start_strm(
2718     sqlite3_changeset_iter** pp,
2719     int function (void* pIn, void* pData, int* pnData) xInput,
2720     void* pIn
2721 );
2722 /// Ditto
2723 int sqlite3changeset_start_v2_strm(
2724     sqlite3_changeset_iter** pp,
2725     int function (void* pIn, void* pData, int* pnData) xInput,
2726     void* pIn,
2727     int flags
2728 );
2729 /// Ditto
2730 int sqlite3session_changeset_strm(
2731     sqlite3_session* pSession,
2732     int function (void* pOut, const(void)* pData, int nData) xOutput,
2733     void* pOut
2734 );
2735 /// Ditto
2736 int sqlite3session_patchset_strm(
2737     sqlite3_session* pSession,
2738     int function (void* pOut, const(void)* pData, int nData) xOutput,
2739     void* pOut
2740 );
2741 /// Ditto
2742 int sqlite3changegroup_add_strm(
2743     sqlite3_changegroup*,
2744     int function (void* pIn, void* pData, int* pnData) xInput,
2745     void* pIn
2746 );
2747 /// Ditto
2748 int sqlite3changegroup_output_strm(
2749     sqlite3_changegroup*,
2750     int function (void* pOut, const(void)* pData, int nData) xOutput,
2751     void* pOut
2752 );
2753 /// Ditto
2754 int sqlite3rebaser_rebase_strm(
2755     sqlite3_rebaser* pRebaser,
2756     int function (void* pIn, void* pData, int* pnData) xInput,
2757     void* pIn,
2758     int function (void* pOut, const(void)* pData, int nData) xOutput,
2759     void* pOut
2760 );
2761 
2762 /*
2763 * CAPI3REF: Configure global parameters
2764 */
2765 int sqlite3session_config(int op, void* pArg);
2766 
2767 /*
2768 * CAPI3REF: Values for sqlite3session_config()
2769 */
2770 enum
2771 {
2772     SQLITE_SESSION_CONFIG_STRMSIZE           = 1
2773 }
2774 
2775 /******************************************************************************
2776 * Interfaces to extend FTS5.
2777 */
2778 struct Fts5Context;
2779 /// Ditto
2780 alias fts5_extension_function = void function(
2781     const Fts5ExtensionApi *pApi,
2782     Fts5Context *pFts,
2783     sqlite3_context *pCtx,
2784     int nVal,
2785     sqlite3_value **apVal
2786 );
2787 /// Ditto
2788 struct Fts5PhraseIter
2789 {
2790     const(ubyte) *a;
2791     const(ubyte) *b;
2792 }
2793 /// Ditto
2794 struct Fts5ExtensionApi
2795 {
2796     int iVersion;        /** Currently always set to 3 */
2797     void* function(Fts5Context*) xUserData;
2798     int function(Fts5Context*) xColumnCount;
2799     int function(Fts5Context*, sqlite3_int64 *pnRow) xRowCount;
2800     int function(Fts5Context*, int iCol, sqlite3_int64 *pnToken) xColumnTotalSize;
2801     int function(Fts5Context*,
2802         const char *pText, int nText,
2803         void *pCtx,
2804         int function(void*, int, const char*, int, int, int) xToken
2805     ) xTokenize;
2806     int function(Fts5Context*) xPhraseCount;
2807     int function(Fts5Context*, int iPhrase) xPhraseSize;
2808     int function(Fts5Context*, int *pnInst) xInstCount;
2809     int function(Fts5Context*, int iIdx, int *piPhrase, int *piCol, int *piOff) xInst;
2810     sqlite3_int64 function(Fts5Context*) xRowid;
2811     int function(Fts5Context*, int iCol, const char **pz, int *pn) xColumnText;
2812     int function(Fts5Context*, int iCol, int *pnToken) xColumnSize;
2813     int function(Fts5Context*, int iPhrase, void *pUserData,
2814         int function(const Fts5ExtensionApi*,Fts5Context*,void*)
2815     ) xQueryPhrase;
2816     int function(Fts5Context*, void *pAux, void function(void*) xDelete) xSetAuxdata;
2817     void* function(Fts5Context*, int bClear) xGetAuxdata;
2818     int function(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*, int*) xPhraseFirst;
2819     void function(Fts5Context*, Fts5PhraseIter*, int *piCol, int *piOff) xPhraseNext;
2820     int function(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*) xPhraseFirstColumn;
2821     void function(Fts5Context*, Fts5PhraseIter*, int* piCol) xPhraseNextColumn;
2822 }
2823 /// Ditto
2824 struct Fts5Tokenizer;
2825 struct fts5_tokenizer
2826 {
2827     int function(void*, const char **azArg, int nArg, Fts5Tokenizer **ppOut) xCreate;
2828     void function(Fts5Tokenizer*) xDelete;
2829     int function(Fts5Tokenizer*,
2830         void *pCtx,
2831         int flags,
2832         const char *pText, int nText,
2833         int function(
2834             void *pCtx,
2835             int tflags,
2836             const char *pToken,
2837             int nToken,
2838             int iStart,
2839             int iEnd
2840         ) xToken
2841     ) xTokenize;
2842 }
2843 /// Ditto
2844 enum FTS5_TOKENIZE_QUERY     = 0x0001;
2845 /// Ditto
2846 enum FTS5_TOKENIZE_PREFIX    = 0x0002;
2847 /// Ditto
2848 enum FTS5_TOKENIZE_DOCUMENT  = 0x0004;
2849 /// Ditto
2850 enum FTS5_TOKENIZE_AUX       = 0x0008;
2851 /// Ditto
2852 enum FTS5_TOKEN_COLOCATED    = 0x0001;
2853 /// Ditto
2854 struct fts5_api
2855 {
2856     int iVersion;
2857 
2858     int function(
2859         fts5_api *pApi,
2860         const char *zName,
2861         void *pContext,
2862         fts5_tokenizer *pTokenizer,
2863         void function(void*) xDestroy
2864     ) xCreateTokenizer;
2865 
2866     int function(
2867         fts5_api *pApi,
2868         const char *zName,
2869         void **ppContext,
2870         fts5_tokenizer *pTokenizer
2871     ) xFindTokenizer;
2872 
2873     int function(
2874         fts5_api *pApi,
2875         const char *zName,
2876         void *pContext,
2877         fts5_extension_function xFunction,
2878         void function(void*) xDestroy
2879     ) xCreateFunction;
2880 }