1 module etc.c.sqlite3;
2 /*
3 ** 2001 September 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 
37 extern (C) __gshared nothrow:
38 
39 /**
40 ** CAPI3REF: Compile-Time Library Version Numbers
41 */
42 enum SQLITE_VERSION = "3.10.2";
43 /// Ditto
44 enum SQLITE_VERSION_NUMBER = 3_010_002;
45 /// Ditto
46 enum SQLITE_SOURCE_ID = "2016-01-20 15:27:19 17efb4209f97fb4971656086b138599a91a75ff9";
47 
48 /**
49 ** CAPI3REF: Run-Time Library Version Numbers
50 */
51 extern immutable(char)* sqlite3_version;
52 /// Ditto
53 immutable(char)* sqlite3_libversion();
54 /// Ditto
55 immutable(char)* sqlite3_sourceid();
56 /// Ditto
57 int sqlite3_libversion_number();
58 
59 /**
60 ** CAPI3REF: Run-Time Library Compilation Options Diagnostics
61 */
62 int sqlite3_compileoption_used(const char *zOptName);
63 /// Ditto
64 immutable(char)* sqlite3_compileoption_get(int N);
65 
66 /**
67 ** CAPI3REF: Test To See If The Library Is Threadsafe
68 */
69 int sqlite3_threadsafe();
70 
71 /**
72 ** CAPI3REF: Database Connection Handle
73 */
74 struct sqlite3;
75 
76 ///
77 alias sqlite3_int64 = long;
78 ///
79 alias sqlite3_uint64 = ulong;
80 
81 /**
82 ** CAPI3REF: Closing A Database Connection
83 **
84 */
85 int sqlite3_close(sqlite3 *);
86 int sqlite3_close_v2(sqlite3*);
87 
88 /**
89 ** The type for a callback function.
90 ** This is legacy and deprecated.  It is included for historical
91 ** compatibility and is not documented.
92 */
93 alias sqlite3_callback = int function (void*,int,char**, char**);
94 
95 /**
96 ** CAPI3REF: One-Step Query Execution Interface
97 */
98 int sqlite3_exec(
99     sqlite3*,                                         /** An open database */
100     const(char)*sql,                                  /** SQL to be evaluated */
101     int function (void*,int,char**,char**) callback,  /** Callback function */
102     void *,                                           /** 1st argument to callback */
103     char **errmsg                                     /** Error msg written here */
104 );
105 
106 /**
107 ** CAPI3REF: Result Codes
108 */
109 enum
110 {
111     SQLITE_OK          = 0,    /** Successful result */
112 /* beginning-of-error-codes */
113 /// Ditto
114     SQLITE_ERROR       = 1,    /** SQL error or missing database */
115     SQLITE_INTERNAL    = 2,    /** Internal logic error in SQLite */
116     SQLITE_PERM        = 3,    /** Access permission denied */
117     SQLITE_ABORT       = 4,    /** Callback routine requested an abort */
118     SQLITE_BUSY        = 5,    /** The database file is locked */
119     SQLITE_LOCKED      = 6,    /** A table in the database is locked */
120     SQLITE_NOMEM       = 7,    /** A malloc() failed */
121     SQLITE_READONLY    = 8,    /** Attempt to write a readonly database */
122     SQLITE_INTERRUPT   = 9,    /** Operation terminated by sqlite3_interrupt()*/
123     SQLITE_IOERR       = 10,   /** Some kind of disk I/O error occurred */
124     SQLITE_CORRUPT     = 11,   /** The database disk image is malformed */
125     SQLITE_NOTFOUND    = 12,   /** Unknown opcode in sqlite3_file_control() */
126     SQLITE_FULL        = 13,   /** Insertion failed because database is full */
127     SQLITE_CANTOPEN    = 14,   /** Unable to open the database file */
128     SQLITE_PROTOCOL    = 15,   /** Database lock protocol error */
129     SQLITE_EMPTY       = 16,   /** Database is empty */
130     SQLITE_SCHEMA      = 17,   /** The database schema changed */
131     SQLITE_TOOBIG      = 18,   /** String or BLOB exceeds size limit */
132     SQLITE_CONSTRAINT  = 19,   /** Abort due to constraint violation */
133     SQLITE_MISMATCH    = 20,   /** Data type mismatch */
134     SQLITE_MISUSE      = 21,   /** Library used incorrectly */
135     SQLITE_NOLFS       = 22,   /** Uses OS features not supported on host */
136     SQLITE_AUTH        = 23,   /** Authorization denied */
137     SQLITE_FORMAT      = 24,   /** Auxiliary database format error */
138     SQLITE_RANGE       = 25,   /** 2nd parameter to sqlite3_bind out of range */
139     SQLITE_NOTADB      = 26,   /** File opened that is not a database file */
140     SQLITE_NOTICE      = 27,
141     SQLITE_WARNING     = 28,
142     SQLITE_ROW         = 100,  /** sqlite3_step() has another row ready */
143     SQLITE_DONE        = 101  /** sqlite3_step() has finished executing */
144 }
145 /* end-of-error-codes */
146 
147 /**
148 ** CAPI3REF: Extended Result Codes
149 */
150 enum
151 {
152     SQLITE_IOERR_READ              = (SQLITE_IOERR | (1 << 8)),
153     SQLITE_IOERR_SHORT_READ        = (SQLITE_IOERR | (2 << 8)),
154     SQLITE_IOERR_WRITE             = (SQLITE_IOERR | (3 << 8)),
155     SQLITE_IOERR_FSYNC             = (SQLITE_IOERR | (4 << 8)),
156     SQLITE_IOERR_DIR_FSYNC         = (SQLITE_IOERR | (5 << 8)),
157     SQLITE_IOERR_TRUNCATE          = (SQLITE_IOERR | (6 << 8)),
158     SQLITE_IOERR_FSTAT             = (SQLITE_IOERR | (7 << 8)),
159     SQLITE_IOERR_UNLOCK            = (SQLITE_IOERR | (8 << 8)),
160     SQLITE_IOERR_RDLOCK            = (SQLITE_IOERR | (9 << 8)),
161     SQLITE_IOERR_DELETE            = (SQLITE_IOERR | (10 << 8)),
162     SQLITE_IOERR_BLOCKED           = (SQLITE_IOERR | (11 << 8)),
163     SQLITE_IOERR_NOMEM             = (SQLITE_IOERR | (12 << 8)),
164     SQLITE_IOERR_ACCESS            = (SQLITE_IOERR | (13 << 8)),
165     SQLITE_IOERR_CHECKRESERVEDLOCK = (SQLITE_IOERR | (14 << 8)),
166     SQLITE_IOERR_LOCK              = (SQLITE_IOERR | (15 << 8)),
167     SQLITE_IOERR_CLOSE             = (SQLITE_IOERR | (16 << 8)),
168     SQLITE_IOERR_DIR_CLOSE         = (SQLITE_IOERR | (17 << 8)),
169     SQLITE_IOERR_SHMOPEN           = (SQLITE_IOERR | (18 << 8)),
170     SQLITE_IOERR_SHMSIZE           = (SQLITE_IOERR | (19 << 8)),
171     SQLITE_IOERR_SHMLOCK           = (SQLITE_IOERR | (20 << 8)),
172     SQLITE_IOERR_SHMMAP            = (SQLITE_IOERR | (21 << 8)),
173     SQLITE_IOERR_SEEK              = (SQLITE_IOERR | (22 << 8)),
174     SQLITE_IOERR_DELETE_NOENT      = (SQLITE_IOERR | (23 << 8)),
175     SQLITE_IOERR_MMAP              = (SQLITE_IOERR | (24 << 8)),
176     SQLITE_LOCKED_SHAREDCACHE      = (SQLITE_LOCKED |  (1 << 8)),
177     SQLITE_BUSY_RECOVERY           = (SQLITE_BUSY   |  (1 << 8)),
178     SQLITE_CANTOPEN_NOTEMPDIR      = (SQLITE_CANTOPEN | (1 << 8)),
179     SQLITE_IOERR_GETTEMPPATH       = (SQLITE_IOERR | (25 << 8)),
180     SQLITE_IOERR_CONVPATH          = (SQLITE_IOERR | (26 << 8)),
181     SQLITE_BUSY_SNAPSHOT           = (SQLITE_BUSY   |  (2 << 8)),
182     SQLITE_CANTOPEN_ISDIR          = (SQLITE_CANTOPEN | (2 << 8)),
183     SQLITE_CANTOPEN_FULLPATH       = (SQLITE_CANTOPEN | (3 << 8)),
184     SQLITE_CANTOPEN_CONVPATH       = (SQLITE_CANTOPEN | (4 << 8)),
185     SQLITE_CORRUPT_VTAB            = (SQLITE_CORRUPT | (1 << 8)),
186     SQLITE_READONLY_RECOVERY       = (SQLITE_READONLY | (1 << 8)),
187     SQLITE_READONLY_CANTLOCK       = (SQLITE_READONLY | (2 << 8)),
188     SQLITE_READONLY_ROLLBACK       = (SQLITE_READONLY | (3 << 8)),
189     SQLITE_READONLY_DBMOVED        = (SQLITE_READONLY | (4 << 8)),
190     SQLITE_ABORT_ROLLBACK          = (SQLITE_ABORT | (2 << 8)),
191     SQLITE_CONSTRAINT_CHECK        = (SQLITE_CONSTRAINT | (1 << 8)),
192     SQLITE_CONSTRAINT_COMMITHOOK   = (SQLITE_CONSTRAINT | (2 << 8)),
193     SQLITE_CONSTRAINT_FOREIGNKEY   = (SQLITE_CONSTRAINT | (3 << 8)),
194     SQLITE_CONSTRAINT_FUNCTION     = (SQLITE_CONSTRAINT | (4 << 8)),
195     SQLITE_CONSTRAINT_NOTNULL      = (SQLITE_CONSTRAINT | (5 << 8)),
196     SQLITE_CONSTRAINT_PRIMARYKEY   = (SQLITE_CONSTRAINT | (6 << 8)),
197     SQLITE_CONSTRAINT_TRIGGER      = (SQLITE_CONSTRAINT | (7 << 8)),
198     SQLITE_CONSTRAINT_UNIQUE       = (SQLITE_CONSTRAINT | (8 << 8)),
199     SQLITE_CONSTRAINT_VTAB         = (SQLITE_CONSTRAINT | (9 << 8)),
200     SQLITE_CONSTRAINT_ROWID        = (SQLITE_CONSTRAINT |(10 << 8)),
201     SQLITE_NOTICE_RECOVER_WAL      = (SQLITE_NOTICE | (1 << 8)),
202     SQLITE_NOTICE_RECOVER_ROLLBACK = (SQLITE_NOTICE | (2 << 8)),
203     SQLITE_WARNING_AUTOINDEX       = (SQLITE_WARNING | (1 << 8)),
204     SQLITE_AUTH_USER               = (SQLITE_AUTH | (1 << 8))
205 }
206 
207 /**
208 ** CAPI3REF: Flags For File Open Operations
209 */
210 enum
211 {
212     SQLITE_OPEN_READONLY         = 0x00000001,  /** Ok for sqlite3_open_v2() */
213     SQLITE_OPEN_READWRITE        = 0x00000002,  /** Ok for sqlite3_open_v2() */
214     SQLITE_OPEN_CREATE           = 0x00000004,  /** Ok for sqlite3_open_v2() */
215     SQLITE_OPEN_DELETEONCLOSE    = 0x00000008,  /** VFS only */
216     SQLITE_OPEN_EXCLUSIVE        = 0x00000010,  /** VFS only */
217     SQLITE_OPEN_AUTOPROXY        = 0x00000020,  /** VFS only */
218     SQLITE_OPEN_URI              = 0x00000040,  /** Ok for sqlite3_open_v2() */
219     SQLITE_OPEN_MEMORY           = 0x00000080,  /** Ok for sqlite3_open_v2() */
220     SQLITE_OPEN_MAIN_DB          = 0x00000100,  /** VFS only */
221     SQLITE_OPEN_TEMP_DB          = 0x00000200,  /** VFS only */
222     SQLITE_OPEN_TRANSIENT_DB     = 0x00000400,  /** VFS only */
223     SQLITE_OPEN_MAIN_JOURNAL     = 0x00000800,  /** VFS only */
224     SQLITE_OPEN_TEMP_JOURNAL     = 0x00001000,  /** VFS only */
225     SQLITE_OPEN_SUBJOURNAL       = 0x00002000,  /** VFS only */
226     SQLITE_OPEN_MASTER_JOURNAL   = 0x00004000,  /** VFS only */
227     SQLITE_OPEN_NOMUTEX          = 0x00008000,  /** Ok for sqlite3_open_v2() */
228     SQLITE_OPEN_FULLMUTEX        = 0x00010000,  /** Ok for sqlite3_open_v2() */
229     SQLITE_OPEN_SHAREDCACHE      = 0x00020000,  /** Ok for sqlite3_open_v2() */
230     SQLITE_OPEN_PRIVATECACHE     = 0x00040000,  /** Ok for sqlite3_open_v2() */
231     SQLITE_OPEN_WAL              = 0x00080000  /** VFS only */
232 }
233 
234 /**
235 ** CAPI3REF: Device Characteristics
236 */
237 enum
238 {
239     SQLITE_IOCAP_ATOMIC                 = 0x00000001,
240     SQLITE_IOCAP_ATOMIC512              = 0x00000002,
241     SQLITE_IOCAP_ATOMIC1K               = 0x00000004,
242     SQLITE_IOCAP_ATOMIC2K               = 0x00000008,
243     SQLITE_IOCAP_ATOMIC4K               = 0x00000010,
244     SQLITE_IOCAP_ATOMIC8K               = 0x00000020,
245     SQLITE_IOCAP_ATOMIC16K              = 0x00000040,
246     SQLITE_IOCAP_ATOMIC32K              = 0x00000080,
247     SQLITE_IOCAP_ATOMIC64K              = 0x00000100,
248     SQLITE_IOCAP_SAFE_APPEND            = 0x00000200,
249     SQLITE_IOCAP_SEQUENTIAL             = 0x00000400,
250     SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN  = 0x00000800,
251     SQLITE_IOCAP_POWERSAFE_OVERWRITE    = 0x00001000,
252     SQLITE_IOCAP_IMMUTABLE              = 0x00002000
253 }
254 
255 /**
256 ** CAPI3REF: File Locking Levels
257 */
258 enum
259 {
260     SQLITE_LOCK_NONE          = 0,
261     SQLITE_LOCK_SHARED        = 1,
262     SQLITE_LOCK_RESERVED      = 2,
263     SQLITE_LOCK_PENDING       = 3,
264     SQLITE_LOCK_EXCLUSIVE     = 4
265 }
266 
267 /**
268 ** CAPI3REF: Synchronization Type Flags
269 */
270 enum
271 {
272     SQLITE_SYNC_NORMAL        = 0x00002,
273     SQLITE_SYNC_FULL          = 0x00003,
274     SQLITE_SYNC_DATAONLY      = 0x00010
275 }
276 
277 /**
278 ** CAPI3REF: OS Interface Open File Handle
279 */
280 struct sqlite3_file
281 {
282     const(sqlite3_io_methods)*pMethods;  /* Methods for an open file */
283 }
284 
285 /**
286 ** CAPI3REF: OS Interface File Virtual Methods Object
287 */
288 
289 struct sqlite3_io_methods
290 {
291     int iVersion;
292     int  function (sqlite3_file*) xClose;
293     int  function (sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst) xRead;
294     int  function (sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst) xWrite;
295     int  function (sqlite3_file*, sqlite3_int64 size) xTruncate;
296     int  function (sqlite3_file*, int flags) xSync;
297     int  function (sqlite3_file*, sqlite3_int64 *pSize) xFileSize;
298     int  function (sqlite3_file*, int) xLock;
299     int  function (sqlite3_file*, int) xUnlock;
300     int  function (sqlite3_file*, int *pResOut) xCheckReservedLock;
301     int  function (sqlite3_file*, int op, void *pArg) xFileControl;
302     int  function (sqlite3_file*) xSectorSize;
303     int  function (sqlite3_file*) xDeviceCharacteristics;
304     /* Methods above are valid for version 1 */
305     int  function (sqlite3_file*, int iPg, int pgsz, int, void **) xShmMap;
306     int  function (sqlite3_file*, int offset, int n, int flags) xShmLock;
307     void  function (sqlite3_file*) xShmBarrier;
308     int  function (sqlite3_file*, int deleteFlag) xShmUnmap;
309     /* Methods above are valid for version 2 */
310     /* Additional methods may be added in future releases */
311     int function (sqlite3_file*, sqlite3_int64 iOfst, int iAmt, void **pp) xFetch;
312     int function (sqlite3_file*, sqlite3_int64 iOfst, void *p) xUnfetch;
313 }
314 
315 /**
316 ** CAPI3REF: Standard File Control Opcodes
317 */
318 enum
319 {
320     SQLITE_FCNTL_LOCKSTATE           = 1,
321     SQLITE_GET_LOCKPROXYFILE         = 2,
322     SQLITE_SET_LOCKPROXYFILE         = 3,
323     SQLITE_LAST_ERRNO                = 4,
324     SQLITE_FCNTL_SIZE_HINT           = 5,
325     SQLITE_FCNTL_CHUNK_SIZE          = 6,
326     SQLITE_FCNTL_FILE_POINTER        = 7,
327     SQLITE_FCNTL_SYNC_OMITTED        = 8,
328     SQLITE_FCNTL_WIN32_AV_RETRY      = 9,
329     SQLITE_FCNTL_PERSIST_WAL         = 10,
330     SQLITE_FCNTL_OVERWRITE           = 11,
331     SQLITE_FCNTL_VFSNAME             = 12,
332     SQLITE_FCNTL_POWERSAFE_OVERWRITE = 13,
333     SQLITE_FCNTL_PRAGMA              = 14,
334     SQLITE_FCNTL_BUSYHANDLER         = 15,
335     SQLITE_FCNTL_TEMPFILENAME        = 16,
336     SQLITE_FCNTL_MMAP_SIZE           = 18,
337     SQLITE_FCNTL_TRACE               = 19,
338     SQLITE_FCNTL_HAS_MOVED           = 20,
339     SQLITE_FCNTL_SYNC                = 21,
340     SQLITE_FCNTL_COMMIT_PHASETWO     = 22,
341     SQLITE_FCNTL_WIN32_SET_HANDLE    = 23,
342     SQLITE_FCNTL_WAL_BLOCK           = 24,
343     SQLITE_FCNTL_ZIPVFS              = 25,
344     SQLITE_FCNTL_RBU                 = 26,
345     SQLITE_FCNTL_VFS_POINTER         = 27,
346 }
347 
348 /**
349 ** CAPI3REF: Mutex Handle
350 */
351 struct sqlite3_mutex;
352 
353 /**
354 ** CAPI3REF: OS Interface Object
355 */
356 
357 alias xDlSymReturn = void * function();
358 /// Ditto
359 alias sqlite3_syscall_ptr = void function();
360 
361 struct sqlite3_vfs
362 {
363     int iVersion;            /** Structure version number (currently 2) */
364     int szOsFile;            /** Size of subclassed sqlite3_file */
365     int mxPathname;          /** Maximum file pathname length */
366     sqlite3_vfs *pNext;      /** Next registered VFS */
367     const(char)*zName;       /** Name of this virtual file system */
368     void *pAppData;          /** Pointer to application-specific data */
369     int function (sqlite3_vfs*, const char *zName, sqlite3_file*,
370                int flags, int *pOutFlags) xOpen;
371     int  function (sqlite3_vfs*, const char *zName, int syncDir) xDelete;
372     int  function (sqlite3_vfs*, const char *zName, int flags, int *pResOut) xAccess;
373     int  function (sqlite3_vfs*, const char *zName, int nOut, char *zOut) xFullPathname;
374     void* function (sqlite3_vfs*, const char *zFilename) xDlOpen;
375     void  function (sqlite3_vfs*, int nByte, char *zErrMsg) xDlError;
376     xDlSymReturn function (sqlite3_vfs*,void*, const char *zSymbol) *xDlSym;
377     void  function (sqlite3_vfs*, void*) xDlClose;
378     int  function (sqlite3_vfs*, int nByte, char *zOut) xRandomness;
379     int  function (sqlite3_vfs*, int microseconds) xSleep;
380     int  function (sqlite3_vfs*, double*) xCurrentTime;
381     int  function (sqlite3_vfs*, int, char *) xGetLastError;
382     /*
383     ** The methods above are in version 1 of the sqlite_vfs object
384     ** definition.  Those that follow are added in version 2 or later
385     */
386     int  function (sqlite3_vfs*, sqlite3_int64*) xCurrentTimeInt64;
387     /*
388     ** The methods above are in versions 1 and 2 of the sqlite_vfs object.
389     ** Those below are for version 3 and greater.
390     */
391     int function(sqlite3_vfs*, const char * zName, sqlite3_syscall_ptr) xSetSystemCall;
392     sqlite3_syscall_ptr function(sqlite3_vfs*, const char * zName) xGetSystemCall;
393     const(char)* function(sqlite3_vfs*, const char * zName) xNextSystemCall;
394     /*
395     ** The methods above are in versions 1 through 3 of the sqlite_vfs object.
396     ** New fields may be appended in figure versions.  The iVersion
397     ** value will increment whenever this happens.
398     */
399 }
400 
401 /**
402 ** CAPI3REF: Flags for the xAccess VFS method
403 */
404 enum
405 {
406     SQLITE_ACCESS_EXISTS    = 0,
407 
408     SQLITE_ACCESS_READWRITE = 1,   /** Used by PRAGMA temp_store_directory */
409     SQLITE_ACCESS_READ      = 2   /** Unused */
410 }
411 
412 /**
413 ** CAPI3REF: Flags for the xShmLock VFS method
414 */
415 enum
416 {
417     SQLITE_SHM_UNLOCK       = 1,
418     SQLITE_SHM_LOCK         = 2,
419     SQLITE_SHM_SHARED       = 4,
420     SQLITE_SHM_EXCLUSIVE    = 8
421 }
422 
423 /**
424 ** CAPI3REF: Maximum xShmLock index
425 */
426 enum SQLITE_SHM_NLOCK        = 8;
427 
428 
429 /**
430 ** CAPI3REF: Initialize The SQLite Library
431 */
432 int sqlite3_initialize();
433 /// Ditto
434 int sqlite3_shutdown();
435 /// Ditto
436 int sqlite3_os_init();
437 /// Ditto
438 int sqlite3_os_end();
439 
440 /**
441 ** CAPI3REF: Configuring The SQLite Library
442 */
443 int sqlite3_config(int, ...);
444 
445 /**
446 ** CAPI3REF: Configure database connections
447 */
448 int sqlite3_db_config(sqlite3*, int op, ...);
449 
450 /**
451 ** CAPI3REF: Memory Allocation Routines
452 */
453 struct sqlite3_mem_methods
454 {
455     void* function (int) xMalloc;         /** Memory allocation function */
456     void function (void*) xFree;          /** Free a prior allocation */
457     void* function (void*,int) xRealloc;  /** Resize an allocation */
458     int function (void*) xSize;           /** Return the size of an allocation */
459     int function (int) xRoundup;          /** Round up request size to allocation size */
460     int function (void*) xInit;           /** Initialize the memory allocator */
461     void function (void*) xShutdown;      /** Deinitialize the memory allocator */
462     void *pAppData;                       /** Argument to xInit() and xShutdown() */
463 }
464 
465 /**
466 ** CAPI3REF: Configuration Options
467 */
468 enum
469 {
470     SQLITE_CONFIG_SINGLETHREAD         = 1,  /** nil */
471     SQLITE_CONFIG_MULTITHREAD          = 2,  /** nil */
472     SQLITE_CONFIG_SERIALIZED           = 3,  /** nil */
473     SQLITE_CONFIG_MALLOC               = 4,  /** sqlite3_mem_methods* */
474     SQLITE_CONFIG_GETMALLOC            = 5,  /** sqlite3_mem_methods* */
475     SQLITE_CONFIG_SCRATCH              = 6,  /** void*, int sz, int N */
476     SQLITE_CONFIG_PAGECACHE            = 7,  /** void*, int sz, int N */
477     SQLITE_CONFIG_HEAP                 = 8,  /** void*, int nByte, int min */
478     SQLITE_CONFIG_MEMSTATUS            = 9,  /** boolean */
479     SQLITE_CONFIG_MUTEX                = 10,  /** sqlite3_mutex_methods* */
480     SQLITE_CONFIG_GETMUTEX             = 11,  /** sqlite3_mutex_methods* */
481 /* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */
482     SQLITE_CONFIG_LOOKASIDE            = 13,  /** int int */
483     SQLITE_CONFIG_PCACHE               = 14,  /** sqlite3_pcache_methods* */
484     SQLITE_CONFIG_GETPCACHE            = 15,  /** sqlite3_pcache_methods* */
485     SQLITE_CONFIG_LOG                  = 16,  /** xFunc, void* */
486     SQLITE_CONFIG_URI                  = 17,
487     SQLITE_CONFIG_PCACHE2              = 18,
488     SQLITE_CONFIG_GETPCACHE2           = 19,
489     SQLITE_CONFIG_COVERING_INDEX_SCAN  = 20,
490     SQLITE_CONFIG_SQLLOG               = 21,
491     SQLITE_CONFIG_MMAP_SIZE            = 22,
492     SQLITE_CONFIG_WIN32_HEAPSIZE       = 23,
493     SQLITE_CONFIG_PCACHE_HDRSZ         = 24,
494     SQLITE_CONFIG_PMASZ                = 25,
495 }
496 
497 /**
498 ** CAPI3REF: Database Connection Configuration Options
499 */
500 enum
501 {
502     SQLITE_DBCONFIG_LOOKASIDE      = 1001,  /** void* int int */
503     SQLITE_DBCONFIG_ENABLE_FKEY    = 1002,  /** int int* */
504     SQLITE_DBCONFIG_ENABLE_TRIGGER = 1003  /** int int* */
505 }
506 
507 
508 /**
509 ** CAPI3REF: Enable Or Disable Extended Result Codes
510 */
511 int sqlite3_extended_result_codes(sqlite3*, int onoff);
512 
513 /**
514 ** CAPI3REF: Last Insert Rowid
515 */
516 sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);
517 
518 /**
519 ** CAPI3REF: Count The Number Of Rows Modified
520 */
521 int sqlite3_changes(sqlite3*);
522 
523 /**
524 ** CAPI3REF: Total Number Of Rows Modified
525 */
526 int sqlite3_total_changes(sqlite3*);
527 
528 /**
529 ** CAPI3REF: Interrupt A Long-Running Query
530 */
531 void sqlite3_interrupt(sqlite3*);
532 
533 /**
534 ** CAPI3REF: Determine If An SQL Statement Is Complete
535 */
536 int sqlite3_complete(const char *sql);
537 /// Ditto
538 int sqlite3_complete16(const void *sql);
539 
540 /**
541 ** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors
542 */
543 int sqlite3_busy_handler(sqlite3*, int function (void*,int), void*);
544 
545 /**
546 ** CAPI3REF: Set A Busy Timeout
547 */
548 int sqlite3_busy_timeout(sqlite3*, int ms);
549 
550 /**
551 ** CAPI3REF: Convenience Routines For Running Queries
552 */
553 int sqlite3_get_table(
554     sqlite3 *db,          /** An open database */
555     const(char)*zSql,     /** SQL to be evaluated */
556     char ***pazResult,    /** Results of the query */
557     int *pnRow,           /** Number of result rows written here */
558     int *pnColumn,        /** Number of result columns written here */
559     char **pzErrmsg       /** Error msg written here */
560 );
561 ///
562 void sqlite3_free_table(char **result);
563 
564 /**
565 ** CAPI3REF: Formatted String Printing Functions
566 */
567 char *sqlite3_mprintf(const char*,...);
568 char *sqlite3_vmprintf(const char*, va_list);
569 char *sqlite3_snprintf(int,char*,const char*, ...);
570 char *sqlite3_vsnprintf(int,char*,const char*, va_list);
571 
572 /**
573 ** CAPI3REF: Memory Allocation Subsystem
574 */
575 void *sqlite3_malloc(int);
576 /// Ditto
577 void *sqlite3_malloc64(sqlite3_uint64);
578 /// Ditto
579 void *sqlite3_realloc(void*, int);
580 /// Ditto
581 void *sqlite3_realloc64(void*, sqlite3_uint64);
582 /// Ditto
583 void sqlite3_free(void*);
584 /// Ditto
585 sqlite3_uint64 sqlite3_msize(void*);
586 
587 /**
588 ** CAPI3REF: Memory Allocator Statistics
589 */
590 sqlite3_int64 sqlite3_memory_used();
591 sqlite3_int64 sqlite3_memory_highwater(int resetFlag);
592 
593 /**
594 ** CAPI3REF: Pseudo-Random Number Generator
595 */
596 void sqlite3_randomness(int N, void *P);
597 
598 /**
599 ** CAPI3REF: Compile-Time Authorization Callbacks
600 */
601 int sqlite3_set_authorizer(
602     sqlite3*,
603     int function (void*,int,const char*,const char*,const char*,const char*) xAuth,
604     void *pUserData
605 );
606 
607 /**
608 ** CAPI3REF: Authorizer Return Codes
609 */
610 enum
611 {
612     SQLITE_DENY   = 1,   /** Abort the SQL statement with an error */
613     SQLITE_IGNORE = 2   /** Don't allow access, but don't generate an error */
614 }
615 
616 /**
617 ** CAPI3REF: Authorizer Action Codes
618 */
619 /******************************************* 3rd ************ 4th ***********/
620 enum
621 {
622     SQLITE_CREATE_INDEX         =  1,   /** Index Name      Table Name      */
623     SQLITE_CREATE_TABLE         =  2,   /** Table Name      NULL            */
624     SQLITE_CREATE_TEMP_INDEX    =  3,   /** Index Name      Table Name      */
625     SQLITE_CREATE_TEMP_TABLE    =  4,   /** Table Name      NULL            */
626     SQLITE_CREATE_TEMP_TRIGGER  =  5,   /** Trigger Name    Table Name      */
627     SQLITE_CREATE_TEMP_VIEW     =  6,   /** View Name       NULL            */
628     SQLITE_CREATE_TRIGGER       =  7,   /** Trigger Name    Table Name      */
629     SQLITE_CREATE_VIEW          =  8,   /** View Name       NULL            */
630     SQLITE_DELETE               =  9,   /** Table Name      NULL            */
631     SQLITE_DROP_INDEX           = 10,   /** Index Name      Table Name      */
632     SQLITE_DROP_TABLE           = 11,   /** Table Name      NULL            */
633     SQLITE_DROP_TEMP_INDEX      = 12,   /** Index Name      Table Name      */
634     SQLITE_DROP_TEMP_TABLE      = 13,   /** Table Name      NULL            */
635     SQLITE_DROP_TEMP_TRIGGER    = 14,   /** Trigger Name    Table Name      */
636     SQLITE_DROP_TEMP_VIEW       = 15,   /** View Name       NULL            */
637     SQLITE_DROP_TRIGGER         = 16,   /** Trigger Name    Table Name      */
638     SQLITE_DROP_VIEW            = 17,   /** View Name       NULL            */
639     SQLITE_INSERT               = 18,   /** Table Name      NULL            */
640     SQLITE_PRAGMA               = 19,   /** Pragma Name     1st arg or NULL */
641     SQLITE_READ                 = 20,   /** Table Name      Column Name     */
642     SQLITE_SELECT               = 21,   /** NULL            NULL            */
643     SQLITE_TRANSACTION          = 22,   /** Operation       NULL            */
644     SQLITE_UPDATE               = 23,   /** Table Name      Column Name     */
645     SQLITE_ATTACH               = 24,   /** Filename        NULL            */
646     SQLITE_DETACH               = 25,   /** Database Name   NULL            */
647     SQLITE_ALTER_TABLE          = 26,   /** Database Name   Table Name      */
648     SQLITE_REINDEX              = 27,   /** Index Name      NULL            */
649     SQLITE_ANALYZE              = 28,   /** Table Name      NULL            */
650     SQLITE_CREATE_VTABLE        = 29,   /** Table Name      Module Name     */
651     SQLITE_DROP_VTABLE          = 30,   /** Table Name      Module Name     */
652     SQLITE_FUNCTION             = 31,   /** NULL            Function Name   */
653     SQLITE_SAVEPOINT            = 32,   /** Operation       Savepoint Name  */
654     SQLITE_COPY                 =  0,   /** No longer used */
655     SQLITE_RECURSIVE            = 33
656 }
657 
658 /**
659 ** CAPI3REF: Tracing And Profiling Functions
660 */
661 void *sqlite3_trace(sqlite3*, void function (void*,const char*) xTrace, void*);
662 /// Ditto
663 void *sqlite3_profile(sqlite3*, void function (void*,const char*,sqlite3_uint64) xProfile, void*);
664 
665 /**
666 ** CAPI3REF: Query Progress Callbacks
667 */
668 void sqlite3_progress_handler(sqlite3*, int, int function (void*), void*);
669 
670 /**
671 ** CAPI3REF: Opening A New Database Connection
672 */
673 int sqlite3_open(
674     const(char)*filename,   /** Database filename (UTF-8) */
675     sqlite3 **ppDb          /** OUT: SQLite db handle */
676 );
677 /// Ditto
678 int sqlite3_open16(
679     const(void)*filename,   /** Database filename (UTF-16) */
680     sqlite3 **ppDb          /** OUT: SQLite db handle */
681 );
682 /// Ditto
683 int sqlite3_open_v2(
684     const(char)*filename,   /** Database filename (UTF-8) */
685     sqlite3 **ppDb,         /** OUT: SQLite db handle */
686     int flags,              /** Flags */
687     const(char)*zVfs        /** Name of VFS module to use */
688 );
689 
690 /*
691 ** CAPI3REF: Obtain Values For URI Parameters
692 */
693 const(char)* sqlite3_uri_parameter(const(char)* zFilename, const(char)* zParam);
694 /// Ditto
695 int sqlite3_uri_boolean(const(char)* zFile, const(char)* zParam, int bDefault);
696 /// Ditto
697 sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int64);
698 
699 /**
700 ** CAPI3REF: Error Codes And Messages
701 */
702 int sqlite3_errcode(sqlite3 *db);
703 /// Ditto
704 int sqlite3_extended_errcode(sqlite3 *db);
705 /// Ditto
706 const(char)* sqlite3_errmsg(sqlite3*);
707 /// Ditto
708 const(void)* sqlite3_errmsg16(sqlite3*);
709 /// Ditto
710 const(char)* sqlite3_errstr(int);
711 
712 /**
713 ** CAPI3REF: SQL Statement Object
714 */
715 struct sqlite3_stmt;
716 
717 /**
718 ** CAPI3REF: Run-time Limits
719 */
720 int sqlite3_limit(sqlite3*, int id, int newVal);
721 
722 /**
723 ** CAPI3REF: Run-Time Limit Categories
724 */
725 enum
726 {
727     SQLITE_LIMIT_LENGTH                    = 0,
728     SQLITE_LIMIT_SQL_LENGTH                = 1,
729     SQLITE_LIMIT_COLUMN                    = 2,
730     SQLITE_LIMIT_EXPR_DEPTH                = 3,
731     SQLITE_LIMIT_COMPOUND_SELECT           = 4,
732     SQLITE_LIMIT_VDBE_OP                   = 5,
733     SQLITE_LIMIT_FUNCTION_ARG              = 6,
734     SQLITE_LIMIT_ATTACHED                  = 7,
735     SQLITE_LIMIT_LIKE_PATTERN_LENGTH       = 8,
736     SQLITE_LIMIT_VARIABLE_NUMBER           = 9,
737     SQLITE_LIMIT_TRIGGER_DEPTH             = 10,
738     SQLITE_LIMIT_WORKER_THREADS            = 11,
739 }
740 
741 /**
742 ** CAPI3REF: Compiling An SQL Statement
743 */
744 int sqlite3_prepare(
745     sqlite3 *db,            /** Database handle */
746     const(char)*zSql,       /** SQL statement, UTF-8 encoded */
747     int nByte,              /** Maximum length of zSql in bytes. */
748     sqlite3_stmt **ppStmt,  /** OUT: Statement handle */
749     const(char*)*pzTail     /** OUT: Pointer to unused portion of zSql */
750 );
751 /// Ditto
752 int sqlite3_prepare_v2(
753     sqlite3 *db,            /** Database handle */
754     const(char)*zSql,       /** SQL statement, UTF-8 encoded */
755     int nByte,              /** Maximum length of zSql in bytes. */
756     sqlite3_stmt **ppStmt,  /** OUT: Statement handle */
757     const(char*)*pzTail     /** OUT: Pointer to unused portion of zSql */
758 );
759 /// Ditto
760 int sqlite3_prepare16(
761     sqlite3 *db,            /** Database handle */
762     const(void)*zSql,       /** SQL statement, UTF-16 encoded */
763     int nByte,              /** Maximum length of zSql in bytes. */
764     sqlite3_stmt **ppStmt,  /** OUT: Statement handle */
765     const(void*)*pzTail     /** OUT: Pointer to unused portion of zSql */
766 );
767 /// Ditto
768 int sqlite3_prepare16_v2(
769     sqlite3 *db,            /** Database handle */
770     const(void)*zSql,       /** SQL statement, UTF-16 encoded */
771     int nByte,              /** Maximum length of zSql in bytes. */
772     sqlite3_stmt **ppStmt,  /** OUT: Statement handle */
773     const(void*)*pzTail     /** OUT: Pointer to unused portion of zSql */
774 );
775 
776 /**
777 ** CAPI3REF: Retrieving Statement SQL
778 */
779 const(char)* sqlite3_sql(sqlite3_stmt *pStmt);
780 
781 /*
782 ** CAPI3REF: Determine If An SQL Statement Writes The Database
783 */
784 int sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
785 
786 /**
787 ** CAPI3REF: Determine If A Prepared Statement Has Been Reset
788 */
789 int sqlite3_stmt_busy(sqlite3_stmt*);
790 
791 
792 /**
793 ** CAPI3REF: Dynamically Typed Value Object
794 */
795 struct sqlite3_value;
796 
797 /**
798 ** CAPI3REF: SQL Function Context Object
799 */
800 struct sqlite3_context;
801 
802 /**
803 ** CAPI3REF: Binding Values To Prepared Statements
804 */
805 int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void function (void*));
806 /// Ditto
807 int sqlite3_bind_blob64(sqlite3_stmt*, int, const void*, sqlite3_uint64,void function (void*));
808 /// Ditto
809 int sqlite3_bind_double(sqlite3_stmt*, int, double);
810 /// Ditto
811 int sqlite3_bind_int(sqlite3_stmt*, int, int);
812 /// Ditto
813 int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64);
814 /// Ditto
815 int sqlite3_bind_null(sqlite3_stmt*, int);
816 /// Ditto
817 int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int n, void function (void*));
818 /// Ditto
819 int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void function (void*));
820 /// Ditto
821 int sqlite3_bind_text64(sqlite3_stmt*, int, const char*, sqlite3_uint64,void function (void*), ubyte encoding);
822 /// Ditto
823 int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
824 /// Ditto
825 int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
826 /// Ditto
827 int sqlite3_bind_zeroblob64(sqlite3_stmt*, int, sqlite3_uint64 n);
828 
829 /**
830 ** CAPI3REF: Number Of SQL Parameters
831 */
832 int sqlite3_bind_parameter_count(sqlite3_stmt*);
833 
834 /**
835 ** CAPI3REF: Name Of A Host Parameter
836 */
837 const(char)* sqlite3_bind_parameter_name(sqlite3_stmt*, int);
838 
839 /**
840 ** CAPI3REF: Index Of A Parameter With A Given Name
841 */
842 int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName);
843 
844 /**
845 ** CAPI3REF: Reset All Bindings On A Prepared Statement
846 */
847 int sqlite3_clear_bindings(sqlite3_stmt*);
848 
849 /**
850 ** CAPI3REF: Number Of Columns In A Result Set
851 */
852 int sqlite3_column_count(sqlite3_stmt *pStmt);
853 
854 /**
855 ** CAPI3REF: Column Names In A Result Set
856 */
857 const(char)* sqlite3_column_name(sqlite3_stmt*, int N);
858 /// Ditto
859 const(void)* sqlite3_column_name16(sqlite3_stmt*, int N);
860 
861 /**
862 ** CAPI3REF: Source Of Data In A Query Result
863 */
864 const(char)* sqlite3_column_database_name(sqlite3_stmt*,int);
865 /// Ditto
866 const(void)* sqlite3_column_database_name16(sqlite3_stmt*,int);
867 /// Ditto
868 const(char)* sqlite3_column_table_name(sqlite3_stmt*,int);
869 /// Ditto
870 const (void)* sqlite3_column_table_name16(sqlite3_stmt*,int);
871 /// Ditto
872 const (char)* sqlite3_column_origin_name(sqlite3_stmt*,int);
873 /// Ditto
874 const (void)* sqlite3_column_origin_name16(sqlite3_stmt*,int);
875 
876 /**
877 ** CAPI3REF: Declared Datatype Of A Query Result
878 */
879 const (char)* sqlite3_column_decltype(sqlite3_stmt*,int);
880 /// Ditto
881 const (void)* sqlite3_column_decltype16(sqlite3_stmt*,int);
882 
883 /**
884 ** CAPI3REF: Evaluate An SQL Statement
885 */
886 int sqlite3_step(sqlite3_stmt*);
887 
888 /**
889 ** CAPI3REF: Number of columns in a result set
890 */
891 int sqlite3_data_count(sqlite3_stmt *pStmt);
892 
893 /**
894 ** CAPI3REF: Fundamental Datatypes
895 */
896 enum
897 {
898     SQLITE_INTEGER  = 1,
899     SQLITE_FLOAT    = 2,
900     SQLITE_BLOB     = 4,
901     SQLITE_NULL     = 5,
902     SQLITE3_TEXT    = 3
903 }
904 
905 /**
906 ** CAPI3REF: Result Values From A Query
907 */
908 const (void)* sqlite3_column_blob(sqlite3_stmt*, int iCol);
909 /// Ditto
910 int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
911 /// Ditto
912 int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
913 /// Ditto
914 double sqlite3_column_double(sqlite3_stmt*, int iCol);
915 /// Ditto
916 int sqlite3_column_int(sqlite3_stmt*, int iCol);
917 /// Ditto
918 sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol);
919 /// Ditto
920 const (char)* sqlite3_column_text(sqlite3_stmt*, int iCol);
921 /// Ditto
922 const (void)* sqlite3_column_text16(sqlite3_stmt*, int iCol);
923 /// Ditto
924 int sqlite3_column_type(sqlite3_stmt*, int iCol);
925 /// Ditto
926 sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol);
927 
928 /**
929 ** CAPI3REF: Destroy A Prepared Statement Object
930 */
931 int sqlite3_finalize(sqlite3_stmt *pStmt);
932 
933 /**
934 ** CAPI3REF: Reset A Prepared Statement Object
935 */
936 int sqlite3_reset(sqlite3_stmt *pStmt);
937 
938 /**
939 ** CAPI3REF: Create Or Redefine SQL Functions
940 */
941 int sqlite3_create_function(
942     sqlite3 *db,
943     const(char)*zFunctionName,
944     int nArg,
945     int eTextRep,
946     void *pApp,
947     void function (sqlite3_context*,int,sqlite3_value**) xFunc,
948     void function (sqlite3_context*,int,sqlite3_value**) xStep,
949     void function (sqlite3_context*) xFinal
950 );
951 /// Ditto
952 int sqlite3_create_function16(
953     sqlite3 *db,
954     const(void)*zFunctionName,
955     int nArg,
956     int eTextRep,
957     void *pApp,
958     void function (sqlite3_context*,int,sqlite3_value**) xFunc,
959     void function (sqlite3_context*,int,sqlite3_value**) xStep,
960     void function (sqlite3_context*) xFinal
961 );
962 /// Ditto
963 int sqlite3_create_function_v2(
964     sqlite3 *db,
965     const(char)*zFunctionName,
966     int nArg,
967     int eTextRep,
968     void *pApp,
969     void function (sqlite3_context*,int,sqlite3_value**) xFunc,
970     void function (sqlite3_context*,int,sqlite3_value**) xStep,
971     void function (sqlite3_context*) xFinal,
972     void function (void*) xDestroy
973 );
974 
975 /**
976 ** CAPI3REF: Text Encodings
977 **
978 ** These constant define integer codes that represent the various
979 ** text encodings supported by SQLite.
980 */
981 enum
982 {
983     SQLITE_UTF8           = 1,
984     SQLITE_UTF16LE        = 2,
985     SQLITE_UTF16BE        = 3
986 }
987 /// Ditto
988 enum
989 {
990     SQLITE_UTF16          = 4,    /** Use native byte order */
991     SQLITE_ANY            = 5,    /** sqlite3_create_function only */
992     SQLITE_UTF16_ALIGNED  = 8    /** sqlite3_create_collation only */
993 }
994 
995 /**
996 ** CAPI3REF: Function Flags
997 */
998 enum SQLITE_DETERMINISTIC = 0x800;
999 
1000 /**
1001 ** CAPI3REF: Deprecated Functions
1002 */
1003 deprecated int sqlite3_aggregate_count(sqlite3_context*);
1004 deprecated int sqlite3_expired(sqlite3_stmt*);
1005 deprecated int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*);
1006 deprecated int sqlite3_global_recover();
1007 deprecated void sqlite3_thread_cleanup();
1008 deprecated int sqlite3_memory_alarm(void function(void*,sqlite3_int64,int),void*,sqlite3_int64);
1009 
1010 /**
1011 ** CAPI3REF: Obtaining SQL Function Parameter Values
1012 */
1013 const (void)* sqlite3_value_blob(sqlite3_value*);
1014 /// Ditto
1015 int sqlite3_value_bytes(sqlite3_value*);
1016 /// Ditto
1017 int sqlite3_value_bytes16(sqlite3_value*);
1018 /// Ditto
1019 double sqlite3_value_double(sqlite3_value*);
1020 /// Ditto
1021 int sqlite3_value_int(sqlite3_value*);
1022 /// Ditto
1023 sqlite3_int64 sqlite3_value_int64(sqlite3_value*);
1024 /// Ditto
1025 const (char)* sqlite3_value_text(sqlite3_value*);
1026 /// Ditto
1027 const (void)* sqlite3_value_text16(sqlite3_value*);
1028 /// Ditto
1029 const (void)* sqlite3_value_text16le(sqlite3_value*);
1030 /// Ditto
1031 const (void)* sqlite3_value_text16be(sqlite3_value*);
1032 /// Ditto
1033 int sqlite3_value_type(sqlite3_value*);
1034 /// Ditto
1035 int sqlite3_value_numeric_type(sqlite3_value*);
1036 
1037 /*
1038 ** CAPI3REF: Finding The Subtype Of SQL Values
1039 */
1040 uint sqlite3_value_subtype(sqlite3_value*);
1041 
1042 /*
1043 ** CAPI3REF: Copy And Free SQL Values
1044 */
1045 sqlite3_value* sqlite3_value_dup(const sqlite3_value*);
1046 void sqlite3_value_free(sqlite3_value*);
1047 
1048 /**
1049 ** CAPI3REF: Obtain Aggregate Function Context
1050 */
1051 void *sqlite3_aggregate_context(sqlite3_context*, int nBytes);
1052 
1053 /**
1054 ** CAPI3REF: User Data For Functions
1055 */
1056 void *sqlite3_user_data(sqlite3_context*);
1057 
1058 /**
1059 ** CAPI3REF: Database Connection For Functions
1060 */
1061 sqlite3 *sqlite3_context_db_handle(sqlite3_context*);
1062 
1063 /**
1064 ** CAPI3REF: Function Auxiliary Data
1065 */
1066 void *sqlite3_get_auxdata(sqlite3_context*, int N);
1067 /// Ditto
1068 void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void function (void*));
1069 
1070 
1071 /**
1072 ** CAPI3REF: Constants Defining Special Destructor Behavior
1073 */
1074 alias sqlite3_destructor_type = void function (void*);
1075 /// Ditto
1076 enum
1077 {
1078     SQLITE_STATIC      = (cast(sqlite3_destructor_type) 0),
1079     SQLITE_TRANSIENT   = (cast (sqlite3_destructor_type) -1)
1080 }
1081 
1082 /**
1083 ** CAPI3REF: Setting The Result Of An SQL Function
1084 */
1085 void sqlite3_result_blob(sqlite3_context*, const void*, int, void function(void*));
1086 /// Ditto
1087 void sqlite3_result_blob64(sqlite3_context*,const void*,sqlite3_uint64,void function(void*));
1088 /// Ditto
1089 void sqlite3_result_double(sqlite3_context*, double);
1090 /// Ditto
1091 void sqlite3_result_error(sqlite3_context*, const char*, int);
1092 /// Ditto
1093 void sqlite3_result_error16(sqlite3_context*, const void*, int);
1094 /// Ditto
1095 void sqlite3_result_error_toobig(sqlite3_context*);
1096 /// Ditto
1097 void sqlite3_result_error_nomem(sqlite3_context*);
1098 /// Ditto
1099 void sqlite3_result_error_code(sqlite3_context*, int);
1100 /// Ditto
1101 void sqlite3_result_int(sqlite3_context*, int);
1102 /// Ditto
1103 void sqlite3_result_int64(sqlite3_context*, sqlite3_int64);
1104 /// Ditto
1105 void sqlite3_result_null(sqlite3_context*);
1106 /// Ditto
1107 void sqlite3_result_text(sqlite3_context*, const char*, int, void function(void*));
1108 /// Ditto
1109 void sqlite3_result_text64(sqlite3_context*, const char*,sqlite3_uint64,void function(void*), ubyte encoding);
1110 /// Ditto
1111 void sqlite3_result_text16(sqlite3_context*, const void*, int, void function(void*));
1112 /// Ditto
1113 void sqlite3_result_text16le(sqlite3_context*, const void*, int, void function(void*));
1114 /// Ditto
1115 void sqlite3_result_text16be(sqlite3_context*, const void*, int, void function(void*));
1116 /// Ditto
1117 void sqlite3_result_value(sqlite3_context*, sqlite3_value*);
1118 /// Ditto
1119 void sqlite3_result_zeroblob(sqlite3_context*, int n);
1120 /// Ditto
1121 int sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n);
1122 
1123 /*
1124 ** CAPI3REF: Setting The Subtype Of An SQL Function
1125 */
1126 void sqlite3_result_subtype(sqlite3_context*,uint);
1127 
1128 /**
1129 ** CAPI3REF: Define New Collating Sequences
1130 */
1131 int sqlite3_create_collation(
1132     sqlite3*,
1133     const(char)*zName,
1134     int eTextRep,
1135     void *pArg,
1136     int function (void*,int,const void*,int,const void*) xCompare
1137 );
1138 /// Ditto
1139 int sqlite3_create_collation_v2(
1140     sqlite3*,
1141     const(char)*zName,
1142     int eTextRep,
1143     void *pArg,
1144     int function (void*,int,const void*,int,const void*) xCompare,
1145     void function (void*) xDestroy
1146 );
1147 /// Ditto
1148 int sqlite3_create_collation16(
1149     sqlite3*,
1150     const(void)*zName,
1151     int eTextRep,
1152     void *pArg,
1153     int function (void*,int,const void*,int,const void*) xCompare
1154 );
1155 
1156 /**
1157 ** CAPI3REF: Collation Needed Callbacks
1158 */
1159 int sqlite3_collation_needed(
1160     sqlite3*,
1161     void*,
1162     void function (void*,sqlite3*,int eTextRep,const char*)
1163 );
1164 /// Ditto
1165 int sqlite3_collation_needed16(
1166     sqlite3*,
1167     void*,
1168     void function (void*,sqlite3*,int eTextRep,const void*)
1169 );
1170 
1171 ///
1172 int sqlite3_key(
1173     sqlite3 *db,                   /** Database to be rekeyed */
1174     const(void)*pKey, int nKey     /** The key */
1175 );
1176 /// Ditto
1177 int sqlite3_key_v2(
1178     sqlite3 *db,                   /* Database to be rekeyed */
1179     const(char)* zDbName,           /* Name of the database */
1180     const(void)* pKey, int nKey     /* The key */
1181 );
1182 
1183 /**
1184 ** Change the key on an open database.  If the current database is not
1185 ** encrypted, this routine will encrypt it.  If pNew == 0 or nNew == 0, the
1186 ** database is decrypted.
1187 **
1188 ** The code to implement this API is not available in the public release
1189 ** of SQLite.
1190 */
1191 int sqlite3_rekey(
1192     sqlite3 *db,                   /** Database to be rekeyed */
1193     const(void)*pKey, int nKey     /** The new key */
1194 );
1195 int sqlite3_rekey_v2(
1196     sqlite3 *db,                   /* Database to be rekeyed */
1197     const(char)* zDbName,           /* Name of the database */
1198     const(void)* pKey, int nKey     /* The new key */
1199 );
1200 
1201 /**
1202 ** Specify the activation key for a SEE database.  Unless
1203 ** activated, none of the SEE routines will work.
1204 */
1205 void sqlite3_activate_see(
1206     const(char)*zPassPhrase        /** Activation phrase */
1207 );
1208 
1209 /**
1210 ** Specify the activation key for a CEROD database.  Unless
1211 ** activated, none of the CEROD routines will work.
1212 */
1213 void sqlite3_activate_cerod(
1214     const(char)*zPassPhrase        /** Activation phrase */
1215 );
1216 
1217 /**
1218 ** CAPI3REF: Suspend Execution For A Short Time
1219 */
1220 int sqlite3_sleep(int);
1221 
1222 /**
1223 ** CAPI3REF: Name Of The Folder Holding Temporary Files
1224 */
1225 extern char *sqlite3_temp_directory;
1226 
1227 /**
1228 ** CAPI3REF: Name Of The Folder Holding Database Files
1229 */
1230 extern char *sqlite3_data_directory;
1231 
1232 /**
1233 ** CAPI3REF: Test For Auto-Commit Mode
1234 */
1235 int sqlite3_get_autocommit(sqlite3*);
1236 
1237 /**
1238 ** CAPI3REF: Find The Database Handle Of A Prepared Statement
1239 */
1240 sqlite3 *sqlite3_db_handle(sqlite3_stmt*);
1241 
1242 /**
1243 ** CAPI3REF: Return The Filename For A Database Connection
1244 */
1245 const(char)* sqlite3_db_filename(sqlite3 *db, const char* zDbName);
1246 
1247 /**
1248 ** CAPI3REF: Determine if a database is read-only
1249 */
1250 int sqlite3_db_readonly(sqlite3 *db, const char * zDbName);
1251 
1252 /*
1253 ** CAPI3REF: Find the next prepared statement
1254 */
1255 sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt);
1256 
1257 /**
1258 ** CAPI3REF: Commit And Rollback Notification Callbacks
1259 */
1260 void *sqlite3_commit_hook(sqlite3*, int function (void*), void*);
1261 /// Ditto
1262 void *sqlite3_rollback_hook(sqlite3*, void function (void *), void*);
1263 
1264 /**
1265 ** CAPI3REF: Data Change Notification Callbacks
1266 */
1267 void *sqlite3_update_hook(
1268     sqlite3*,
1269     void function (void *,int ,char *, char *, sqlite3_int64),
1270     void*
1271 );
1272 
1273 /**
1274 ** CAPI3REF: Enable Or Disable Shared Pager Cache
1275 */
1276 int sqlite3_enable_shared_cache(int);
1277 
1278 /**
1279 ** CAPI3REF: Attempt To Free Heap Memory
1280 */
1281 int sqlite3_release_memory(int);
1282 
1283 /**
1284 ** CAPI3REF: Free Memory Used By A Database Connection
1285 */
1286 int sqlite3_db_release_memory(sqlite3*);
1287 
1288 /*
1289 ** CAPI3REF: Impose A Limit On Heap Size
1290 */
1291 sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N);
1292 
1293 /**
1294 ** CAPI3REF: Deprecated Soft Heap Limit Interface
1295 */
1296 deprecated void sqlite3_soft_heap_limit(int N);
1297 
1298 /**
1299 ** CAPI3REF: Extract Metadata About A Column Of A Table
1300 */
1301 int sqlite3_table_column_metadata(
1302     sqlite3 *db,                /** Connection handle */
1303     const(char)*zDbName,        /** Database name or NULL */
1304     const(char)*zTableName,     /** Table name */
1305     const(char)*zColumnName,    /** Column name */
1306     char **pzDataType,    /** OUTPUT: Declared data type */
1307     char **pzCollSeq,     /** OUTPUT: Collation sequence name */
1308     int *pNotNull,              /** OUTPUT: True if NOT NULL constraint exists */
1309     int *pPrimaryKey,           /** OUTPUT: True if column part of PK */
1310     int *pAutoinc               /** OUTPUT: True if column is auto-increment */
1311 );
1312 
1313 /**
1314 ** CAPI3REF: Load An Extension
1315 */
1316 int sqlite3_load_extension(
1317     sqlite3 *db,          /** Load the extension into this database connection */
1318     const(char)*zFile,    /** Name of the shared library containing extension */
1319     const(char)*zProc,    /** Entry point.  Derived from zFile if 0 */
1320     char **pzErrMsg       /** Put error message here if not 0 */
1321 );
1322 
1323 /**
1324 ** CAPI3REF: Enable Or Disable Extension Loading
1325 */
1326 int sqlite3_enable_load_extension(sqlite3 *db, int onoff);
1327 
1328 /**
1329 ** CAPI3REF: Automatically Load Statically Linked Extensions
1330 */
1331 int sqlite3_auto_extension(void function () xEntryPoint);
1332 
1333 /**
1334 ** CAPI3REF: Cancel Automatic Extension Loading
1335 */
1336 int sqlite3_cancel_auto_extension(void function() xEntryPoint);
1337 
1338 /**
1339 ** CAPI3REF: Reset Automatic Extension Loading
1340 */
1341 void sqlite3_reset_auto_extension();
1342 
1343 /**
1344 ** The interface to the virtual-table mechanism is currently considered
1345 ** to be experimental.  The interface might change in incompatible ways.
1346 ** If this is a problem for you, do not use the interface at this time.
1347 **
1348 ** When the virtual-table mechanism stabilizes, we will declare the
1349 ** interface fixed, support it indefinitely, and remove this comment.
1350 */
1351 
1352 /**
1353 ** CAPI3REF: Virtual Table Object
1354 */
1355 
1356 alias mapFunction = void function (sqlite3_context*,int,sqlite3_value**);
1357 
1358 /// Ditto
1359 struct sqlite3_module
1360 {
1361     int iVersion;
1362     int function (sqlite3*, void *pAux,
1363                int argc, const char **argv,
1364                sqlite3_vtab **ppVTab, char**) xCreate;
1365     int function (sqlite3*, void *pAux,
1366                int argc, const char **argv,
1367                sqlite3_vtab **ppVTab, char**) xConnect;
1368     int function (sqlite3_vtab *pVTab, sqlite3_index_info*) xBestIndex;
1369     int function (sqlite3_vtab *pVTab) xDisconnect;
1370     int function (sqlite3_vtab *pVTab) xDestroy;
1371     int function (sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor) xOpen;
1372     int function (sqlite3_vtab_cursor*) xClose;
1373     int function (sqlite3_vtab_cursor*, int idxNum, const char *idxStr,
1374                 int argc, sqlite3_value **argv) xFilter;
1375     int function (sqlite3_vtab_cursor*) xNext;
1376     int function (sqlite3_vtab_cursor*) xEof;
1377     int function (sqlite3_vtab_cursor*, sqlite3_context*, int) xColumn;
1378     int function (sqlite3_vtab_cursor*, sqlite3_int64 *pRowid) xRowid;
1379     int function (sqlite3_vtab *, int, sqlite3_value **, sqlite3_int64 *) xUpdate;
1380     int function (sqlite3_vtab *pVTab) xBegin;
1381     int function (sqlite3_vtab *pVTab) xSync;
1382     int function (sqlite3_vtab *pVTab) xCommit;
1383     int function (sqlite3_vtab *pVTab) xRollback;
1384     int function (sqlite3_vtab *pVtab, int nArg, const char *zName,
1385                        mapFunction*,
1386                        void **ppArg) xFindFunction;
1387     int function (sqlite3_vtab *pVtab, const char *zNew) xRename;
1388     int function (sqlite3_vtab *pVTab, int) xSavepoint;
1389     int function (sqlite3_vtab *pVTab, int) xRelease;
1390     int function (sqlite3_vtab *pVTab, int) xRollbackTo;
1391 }
1392 
1393 /**
1394 ** CAPI3REF: Virtual Table Indexing Information
1395 */
1396 struct sqlite3_index_info
1397 {
1398     struct sqlite3_index_constraint
1399     {
1400         int iColumn;            /** Column on left-hand side of constraint */
1401         char op;                /** Constraint operator */
1402         char usable;            /** True if this constraint is usable */
1403         int iTermOffset;        /** Used internally - xBestIndex should ignore */
1404     }
1405     struct sqlite3_index_orderby
1406     {
1407         int iColumn;            /** Column number */
1408         char desc;              /** True for DESC.  False for ASC. */
1409     }
1410     struct sqlite3_index_constraint_usage
1411     {
1412         int argvIndex;           /** if >0, constraint is part of argv to xFilter */
1413         char omit;               /** Do not code a test for this constraint */
1414     }
1415     /* Inputs */
1416     int nConstraint;           /** Number of entries in aConstraint */
1417     sqlite3_index_constraint* aConstraint;  /** Table of WHERE clause constraints */
1418     int nOrderBy;              /** Number of terms in the ORDER BY clause */
1419     sqlite3_index_orderby *aOrderBy; /** The ORDER BY clause */
1420     /* Outputs */
1421     sqlite3_index_constraint_usage *aConstraintUsage;
1422     int idxNum;                /** Number used to identify the index */
1423     char *idxStr;              /** String, possibly obtained from sqlite3_malloc */
1424     int needToFreeIdxStr;      /** Free idxStr using sqlite3_free() if true */
1425     int orderByConsumed;       /** True if output is already ordered */
1426     double estimatedCost;      /** Estimated cost of using this index */
1427     sqlite3_int64 estimatedRows;
1428     int idxFlags;
1429     sqlite3_uint64 colUsed;
1430 }
1431 
1432 /**
1433 ** CAPI3REF: Virtual Table Constraint Operator Codes
1434 */
1435 enum
1436 {
1437     SQLITE_INDEX_SCAN_UNIQUE       = 1,
1438     SQLITE_INDEX_CONSTRAINT_EQ     = 2,
1439     SQLITE_INDEX_CONSTRAINT_GT     = 4,
1440     SQLITE_INDEX_CONSTRAINT_LE     = 8,
1441     SQLITE_INDEX_CONSTRAINT_LT     = 16,
1442     SQLITE_INDEX_CONSTRAINT_GE     = 32,
1443     SQLITE_INDEX_CONSTRAINT_MATCH  = 64,
1444     SQLITE_INDEX_CONSTRAINT_LIKE   = 65,
1445     SQLITE_INDEX_CONSTRAINT_GLOB   = 66,
1446     SQLITE_INDEX_CONSTRAINT_REGEXP = 67,
1447 }
1448 
1449 /**
1450 ** CAPI3REF: Register A Virtual Table Implementation
1451 */
1452 int sqlite3_create_module(
1453     sqlite3 *db,                    /* SQLite connection to register module with */
1454     const(char)*zName,              /* Name of the module */
1455     const(sqlite3_module)*p,        /* Methods for the module */
1456     void *pClientData               /* Client data for xCreate/xConnect */
1457 );
1458 /// Ditto
1459 int sqlite3_create_module_v2(
1460     sqlite3 *db,                    /* SQLite connection to register module with */
1461     const(char)*zName,              /* Name of the module */
1462     const(sqlite3_module)*p,        /* Methods for the module */
1463     void *pClientData,              /* Client data for xCreate/xConnect */
1464     void function (void*) xDestroy  /* Module destructor function */
1465 );
1466 
1467 /**
1468 ** CAPI3REF: Virtual Table Instance Object
1469 */
1470 struct sqlite3_vtab
1471 {
1472     const(sqlite3_module)*pModule;  /** The module for this virtual table */
1473     int nRef;                       /** NO LONGER USED */
1474     char *zErrMsg;                  /** Error message from sqlite3_mprintf() */
1475     /* Virtual table implementations will typically add additional fields */
1476 }
1477 
1478 /**
1479 ** CAPI3REF: Virtual Table Cursor Object
1480 */
1481 struct sqlite3_vtab_cursor
1482 {
1483     sqlite3_vtab *pVtab;      /** Virtual table of this cursor */
1484     /* Virtual table implementations will typically add additional fields */
1485 }
1486 
1487 /**
1488 ** CAPI3REF: Declare The Schema Of A Virtual Table
1489 */
1490 int sqlite3_declare_vtab(sqlite3*, const char *zSQL);
1491 
1492 /**
1493 ** CAPI3REF: Overload A Function For A Virtual Table
1494 */
1495 int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg);
1496 
1497 /**
1498 ** The interface to the virtual-table mechanism defined above (back up
1499 ** to a comment remarkably similar to this one) is currently considered
1500 ** to be experimental.  The interface might change in incompatible ways.
1501 ** If this is a problem for you, do not use the interface at this time.
1502 **
1503 ** When the virtual-table mechanism stabilizes, we will declare the
1504 ** interface fixed, support it indefinitely, and remove this comment.
1505 */
1506 
1507 /*
1508 ** CAPI3REF: A Handle To An Open BLOB
1509 */
1510 struct sqlite3_blob;
1511 
1512 /**
1513 ** CAPI3REF: Open A BLOB For Incremental I/O
1514 */
1515 int sqlite3_blob_open(
1516     sqlite3*,
1517     const(char)* zDb,
1518     const(char)* zTable,
1519     const(char)* zColumn,
1520     sqlite3_int64 iRow,
1521     int flags,
1522     sqlite3_blob **ppBlob
1523 );
1524 
1525 /**
1526 ** CAPI3REF: Move a BLOB Handle to a New Row
1527 */
1528 int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64);
1529 
1530 /**
1531 ** CAPI3REF: Close A BLOB Handle
1532 */
1533 int sqlite3_blob_close(sqlite3_blob *);
1534 
1535 /**
1536 ** CAPI3REF: Return The Size Of An Open BLOB
1537 */
1538 int sqlite3_blob_bytes(sqlite3_blob *);
1539 
1540 /**
1541 ** CAPI3REF: Read Data From A BLOB Incrementally
1542 */
1543 int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
1544 
1545 /**
1546 ** CAPI3REF: Write Data Into A BLOB Incrementally
1547 */
1548 int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset);
1549 
1550 /**
1551 ** CAPI3REF: Virtual File System Objects
1552 */
1553 sqlite3_vfs *sqlite3_vfs_find(const char *zVfsName);
1554 /// Ditto
1555 int sqlite3_vfs_register(sqlite3_vfs*, int makeDflt);
1556 /// Ditto
1557 int sqlite3_vfs_unregister(sqlite3_vfs*);
1558 
1559 /**
1560 ** CAPI3REF: Mutexes
1561 */
1562 sqlite3_mutex *sqlite3_mutex_alloc(int);
1563 /// Ditto
1564 void sqlite3_mutex_free(sqlite3_mutex*);
1565 /// Ditto
1566 void sqlite3_mutex_enter(sqlite3_mutex*);
1567 /// Ditto
1568 int sqlite3_mutex_try(sqlite3_mutex*);
1569 /// Ditto
1570 void sqlite3_mutex_leave(sqlite3_mutex*);
1571 
1572 /**
1573 ** CAPI3REF: Mutex Methods Object
1574 */
1575 struct sqlite3_mutex_methods
1576 {
1577     int  function () xMutexInit;
1578     int  function () xMutexEnd;
1579     sqlite3_mutex* function (int) xMutexAlloc;
1580     void  function (sqlite3_mutex *) xMutexFree;
1581     void  function (sqlite3_mutex *) xMutexEnter;
1582     int  function (sqlite3_mutex *) xMutexTry;
1583     void  function (sqlite3_mutex *) xMutexLeave;
1584     int  function (sqlite3_mutex *) xMutexHeld;
1585     int  function (sqlite3_mutex *) xMutexNotheld;
1586 }
1587 
1588 /**
1589 ** CAPI3REF: Mutex Verification Routines
1590 */
1591 
1592 //#ifndef NDEBUG
1593 int sqlite3_mutex_held(sqlite3_mutex*);
1594 /// Ditto
1595 int sqlite3_mutex_notheld(sqlite3_mutex*);
1596 //#endif
1597 
1598 /**
1599 ** CAPI3REF: Mutex Types
1600 */
1601 enum
1602 {
1603     SQLITE_MUTEX_FAST             = 0,
1604     SQLITE_MUTEX_RECURSIVE        = 1,
1605     SQLITE_MUTEX_STATIC_MASTER    = 2,
1606     SQLITE_MUTEX_STATIC_MEM       = 3,  /** sqlite3_malloc() */
1607     SQLITE_MUTEX_STATIC_MEM2      = 4,  /** NOT USED */
1608     SQLITE_MUTEX_STATIC_OPEN      = 4,  /** sqlite3BtreeOpen() */
1609     SQLITE_MUTEX_STATIC_PRNG      = 5,  /** sqlite3_random() */
1610     SQLITE_MUTEX_STATIC_LRU       = 6,  /** lru page list */
1611     SQLITE_MUTEX_STATIC_LRU2      = 7,  /** NOT USED */
1612     SQLITE_MUTEX_STATIC_PMEM      = 7,  /** sqlite3PageMalloc() */
1613     SQLITE_MUTEX_STATIC_APP1      = 8,  /** For use by application */
1614     SQLITE_MUTEX_STATIC_APP2      = 9,  /** For use by application */
1615     SQLITE_MUTEX_STATIC_APP3      = 10, /** For use by application */
1616     SQLITE_MUTEX_STATIC_VFS1      = 11, /** For use by built-in VFS */
1617     SQLITE_MUTEX_STATIC_VFS2      = 12, /** For use by extension VFS */
1618     SQLITE_MUTEX_STATIC_VFS3      = 13, /** For use by application VFS */
1619 }
1620 
1621 /**
1622 ** CAPI3REF: Retrieve the mutex for a database connection
1623 */
1624 sqlite3_mutex *sqlite3_db_mutex(sqlite3*);
1625 
1626 /**
1627 ** CAPI3REF: Low-Level Control Of Database Files
1628 */
1629 int sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*);
1630 
1631 /**
1632 ** CAPI3REF: Testing Interface
1633 */
1634 int sqlite3_test_control(int op, ...);
1635 
1636 /**
1637 ** CAPI3REF: Testing Interface Operation Codes
1638 */
1639 enum
1640 {
1641     SQLITE_TESTCTRL_FIRST                   = 5,
1642     SQLITE_TESTCTRL_PRNG_SAVE               = 5,
1643     SQLITE_TESTCTRL_PRNG_RESTORE            = 6,
1644     SQLITE_TESTCTRL_PRNG_RESET              = 7,
1645     SQLITE_TESTCTRL_BITVEC_TEST             = 8,
1646     SQLITE_TESTCTRL_FAULT_INSTALL           = 9,
1647     SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS     = 10,
1648     SQLITE_TESTCTRL_PENDING_BYTE            = 11,
1649     SQLITE_TESTCTRL_ASSERT                  = 12,
1650     SQLITE_TESTCTRL_ALWAYS                  = 13,
1651     SQLITE_TESTCTRL_RESERVE                 = 14,
1652     SQLITE_TESTCTRL_OPTIMIZATIONS           = 15,
1653     SQLITE_TESTCTRL_ISKEYWORD               = 16,
1654     SQLITE_TESTCTRL_SCRATCHMALLOC           = 17,
1655     SQLITE_TESTCTRL_LOCALTIME_FAULT         = 18,
1656     SQLITE_TESTCTRL_EXPLAIN_STMT            = 19,
1657     SQLITE_TESTCTRL_NEVER_CORRUPT           = 20,
1658     SQLITE_TESTCTRL_VDBE_COVERAGE           = 21,
1659     SQLITE_TESTCTRL_BYTEORDER               = 22,
1660     SQLITE_TESTCTRL_ISINIT                  = 23,
1661     SQLITE_TESTCTRL_SORTER_MMAP             = 24,
1662     SQLITE_TESTCTRL_IMPOSTER                = 25,
1663     SQLITE_TESTCTRL_LAST                    = 25,
1664 }
1665 
1666 /**
1667 ** CAPI3REF: SQLite Runtime Status
1668 */
1669 int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag);
1670 /// Ditto
1671 int  sqlite3_status64(int op, long *pCurrent, long *pHighwater, int resetFlag);
1672 
1673 /**
1674 ** CAPI3REF: Status Parameters
1675 */
1676 enum
1677 {
1678     SQLITE_STATUS_MEMORY_USED          = 0,
1679     SQLITE_STATUS_PAGECACHE_USED       = 1,
1680     SQLITE_STATUS_PAGECACHE_OVERFLOW   = 2,
1681     SQLITE_STATUS_SCRATCH_USED         = 3,
1682     SQLITE_STATUS_SCRATCH_OVERFLOW     = 4,
1683     SQLITE_STATUS_MALLOC_SIZE          = 5,
1684     SQLITE_STATUS_PARSER_STACK         = 6,
1685     SQLITE_STATUS_PAGECACHE_SIZE       = 7,
1686     SQLITE_STATUS_SCRATCH_SIZE         = 8,
1687     SQLITE_STATUS_MALLOC_COUNT         = 9
1688 }
1689 
1690 /**
1691 ** CAPI3REF: Database Connection Status
1692 */
1693 int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
1694 
1695 /**
1696 ** CAPI3REF: Status Parameters for database connections
1697 */
1698 enum
1699 {
1700     SQLITE_DBSTATUS_LOOKASIDE_USED      = 0,
1701     SQLITE_DBSTATUS_CACHE_USED          = 1,
1702     SQLITE_DBSTATUS_SCHEMA_USED         = 2,
1703     SQLITE_DBSTATUS_STMT_USED           = 3,
1704     SQLITE_DBSTATUS_LOOKASIDE_HIT       = 4,
1705     SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE = 5,
1706     SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL = 6,
1707     SQLITE_DBSTATUS_CACHE_HIT           = 7,
1708     SQLITE_DBSTATUS_CACHE_MISS          = 8,
1709     SQLITE_DBSTATUS_CACHE_WRITE         = 9,
1710     SQLITE_DBSTATUS_DEFERRED_FKS        = 10,
1711     SQLITE_DBSTATUS_MAX                 = 10   /** Largest defined DBSTATUS */
1712 }
1713 
1714 /**
1715 ** CAPI3REF: Prepared Statement Status
1716 */
1717 int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
1718 
1719 /**
1720 ** CAPI3REF: Status Parameters for prepared statements
1721 */
1722 enum
1723 {
1724     SQLITE_STMTSTATUS_FULLSCAN_STEP     = 1,
1725     SQLITE_STMTSTATUS_SORT              = 2,
1726     SQLITE_STMTSTATUS_AUTOINDEX         = 3,
1727     SQLITE_STMTSTATUS_VM_STEP           = 4
1728 }
1729 
1730 /**
1731 ** CAPI3REF: Custom Page Cache Object
1732 */
1733 struct sqlite3_pcache;
1734 
1735 /**
1736 ** CAPI3REF: Custom Page Cache Object
1737 */
1738 struct sqlite3_pcache_page
1739 {
1740     void *pBuf;        /* The content of the page */
1741     void *pExtra;      /* Extra information associated with the page */
1742 }
1743 
1744 /**
1745 ** CAPI3REF: Application Defined Page Cache.
1746 */
1747 struct sqlite3_pcache_methods2
1748 {
1749     int iVersion;
1750     void *pArg;
1751     int function(void*) xInit;
1752     void function(void*) xShutdown;
1753     sqlite3_pcache * function(int szPage, int szExtra, int bPurgeable) xCreate;
1754     void function(sqlite3_pcache*, int nCachesize) xCachesize;
1755     int function(sqlite3_pcache*) xPagecount;
1756     sqlite3_pcache_page * function(sqlite3_pcache*, uint key, int createFlag) xFetch;
1757     void function(sqlite3_pcache*, sqlite3_pcache_page*, int discard) xUnpin;
1758     void function(sqlite3_pcache*, sqlite3_pcache_page*,
1759      uint oldKey, uint newKey) xRekey;
1760     void function(sqlite3_pcache*, uint iLimit) xTruncate;
1761     void function(sqlite3_pcache*) xDestroy;
1762     void function(sqlite3_pcache*) xShrink;
1763 }
1764 
1765 struct sqlite3_pcache_methods
1766 {
1767     void *pArg;
1768     int  function (void*) xInit;
1769     void  function (void*) xShutdown;
1770     sqlite3_pcache* function (int szPage, int bPurgeable) xCreate;
1771     void  function (sqlite3_pcache*, int nCachesize) xCachesize;
1772     int  function (sqlite3_pcache*) xPagecount;
1773     void* function (sqlite3_pcache*, uint key, int createFlag) xFetch;
1774     void  function (sqlite3_pcache*, void*, int discard) xUnpin;
1775     void  function (sqlite3_pcache*, void*, uint oldKey, uint newKey) xRekey;
1776     void  function (sqlite3_pcache*, uint iLimit) xTruncate;
1777     void  function (sqlite3_pcache*) xDestroy;
1778 }
1779 
1780 /**
1781 ** CAPI3REF: Online Backup Object
1782 */
1783 struct sqlite3_backup;
1784 
1785 /**
1786 ** CAPI3REF: Online Backup API.
1787 */
1788 sqlite3_backup *sqlite3_backup_init(
1789     sqlite3 *pDest,                        /** Destination database handle */
1790     const(char)*zDestName,                 /** Destination database name */
1791     sqlite3 *pSource,                      /** Source database handle */
1792     const(char)*zSourceName                /** Source database name */
1793 );
1794 /// Ditto
1795 int sqlite3_backup_step(sqlite3_backup *p, int nPage);
1796 /// Ditto
1797 int sqlite3_backup_finish(sqlite3_backup *p);
1798 /// Ditto
1799 int sqlite3_backup_remaining(sqlite3_backup *p);
1800 /// Ditto
1801 int sqlite3_backup_pagecount(sqlite3_backup *p);
1802 
1803 /**
1804 ** CAPI3REF: Unlock Notification
1805 */
1806 int sqlite3_unlock_notify(
1807     sqlite3 *pBlocked,                               /** Waiting connection */
1808     void function (void **apArg, int nArg) xNotify,  /** Callback function to invoke */
1809     void *pNotifyArg                                 /** Argument to pass to xNotify */
1810 );
1811 
1812 /**
1813 ** CAPI3REF: String Comparison
1814 */
1815 int sqlite3_stricmp(const char * , const char * );
1816 int sqlite3_strnicmp(const char * , const char * , int);
1817 
1818 /*
1819 ** CAPI3REF: String Globbing
1820 *
1821 */
1822 int sqlite3_strglob(const(char)* zGlob, const(char)* zStr);
1823 
1824 /*
1825 ** CAPI3REF: String LIKE Matching
1826 */
1827 int sqlite3_strlike(const(char)* zGlob, const(char)* zStr, uint cEsc);
1828 
1829 /**
1830 ** CAPI3REF: Error Logging Interface
1831 */
1832 void sqlite3_log(int iErrCode, const char *zFormat, ...);
1833 
1834 /**
1835 ** CAPI3REF: Write-Ahead Log Commit Hook
1836 */
1837 void *sqlite3_wal_hook(
1838     sqlite3*,
1839     int function (void *,sqlite3*,const char*,int),
1840     void*
1841 );
1842 
1843 /**
1844 ** CAPI3REF: Configure an auto-checkpoint
1845 */
1846 int sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
1847 
1848 /**
1849 ** CAPI3REF: Checkpoint a database
1850 */
1851 int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
1852 
1853 /**
1854 ** CAPI3REF: Checkpoint a database
1855 */
1856 int sqlite3_wal_checkpoint_v2(
1857     sqlite3 *db,                    /** Database handle */
1858     const(char)*zDb,                /** Name of attached database (or NULL) */
1859     int eMode,                      /** SQLITE_CHECKPOINT_* value */
1860     int *pnLog,                     /** OUT: Size of WAL log in frames */
1861     int *pnCkpt                     /** OUT: Total number of frames checkpointed */
1862 );
1863 
1864 /**
1865 ** CAPI3REF: Checkpoint operation parameters
1866 */
1867 enum
1868 {
1869     SQLITE_CHECKPOINT_PASSIVE  = 0,
1870     SQLITE_CHECKPOINT_FULL     = 1,
1871     SQLITE_CHECKPOINT_RESTART  = 2,
1872     SQLITE_CHECKPOINT_TRUNCATE = 3,
1873 }
1874 
1875 /*
1876 ** CAPI3REF: Virtual Table Interface Configuration
1877 */
1878 int sqlite3_vtab_config(sqlite3*, int op, ...);
1879 
1880 /**
1881 ** CAPI3REF: Virtual Table Configuration Options
1882 */
1883 enum SQLITE_VTAB_CONSTRAINT_SUPPORT = 1;
1884 
1885 /*
1886 ** 2010 August 30
1887 **
1888 ** The author disclaims copyright to this source code.  In place of
1889 ** a legal notice, here is a blessing:
1890 **
1891 **    May you do good and not evil.
1892 **    May you find forgiveness for yourself and forgive others.
1893 **    May you share freely, never taking more than you give.
1894 **
1895 *************************************************************************
1896 */
1897 
1898 //#ifndef _SQLITE3RTREE_H_
1899 //#define _SQLITE3RTREE_H_
1900 
1901 
1902 /*
1903 ** CAPI3REF: Determine The Virtual Table Conflict Policy
1904 */
1905 int sqlite3_vtab_on_conflict(sqlite3 *);
1906 
1907 /*
1908 ** CAPI3REF: Conflict resolution modes
1909 */
1910 enum
1911 {
1912     SQLITE_ROLLBACK = 1,
1913     SQLITE_FAIL     = 3,
1914     SQLITE_REPLACE  = 5
1915 }
1916 
1917 /*
1918 ** CAPI3REF: Prepared Statement Scan Status Opcodes
1919 */
1920 enum
1921 {
1922     SQLITE_SCANSTAT_NLOOP    = 0,
1923     SQLITE_SCANSTAT_NVISIT   = 1,
1924     SQLITE_SCANSTAT_EST      = 2,
1925     SQLITE_SCANSTAT_NAME     = 3,
1926     SQLITE_SCANSTAT_EXPLAIN  = 4,
1927     SQLITE_SCANSTAT_SELECTID = 5,
1928 }
1929 
1930 /*
1931 ** CAPI3REF: Prepared Statement Scan Status
1932 */
1933 int sqlite3_stmt_scanstatus(sqlite3_stmt *pStmt, int idx, int iScanStatusOp, void *pOut);
1934 
1935 /*
1936 ** CAPI3REF: Zero Scan-Status Counters
1937 */
1938 void sqlite3_stmt_scanstatus_reset(sqlite3_stmt *);
1939 
1940 /*
1941 ** CAPI3REF: Flush caches to disk mid-transaction
1942 */
1943 int sqlite3_db_cacheflush(sqlite3 *);
1944 
1945 struct sqlite3_snapshot;
1946 
1947 /*
1948 ** CAPI3REF: Record A Database Snapshot
1949 */
1950 int sqlite3_snapshot_get(sqlite3 *db, char *zSchema, sqlite3_snapshot **ppSnapshot);
1951 
1952 /*
1953 ** CAPI3REF: Start a read transaction on an historical snapshot
1954 */
1955 int sqlite3_snapshot_open(sqlite3 *db, char *zSchema, sqlite3_snapshot *pSnapshot);
1956 
1957 /*
1958 ** CAPI3REF: Destroy a snapshot
1959 */
1960 void sqlite3_snapshot_free(sqlite3_snapshot *);
1961 
1962 /**
1963 ** Register a geometry callback named zGeom that can be used as part of an
1964 ** R-Tree geometry query as follows:
1965 **
1966 **   SELECT ... FROM $(LT)rtree$(GT) WHERE $(LT)rtree col$(GT) MATCH $zGeom(... params ...)
1967 */
1968 int sqlite3_rtree_geometry_callback(
1969     sqlite3 *db,
1970     const(char)*zGeom,
1971     int function (sqlite3_rtree_geometry *, int nCoord, double *aCoord, int *pRes) xGeom,
1972     void *pContext
1973 );
1974 
1975 /**
1976 ** A pointer to a structure of the following type is passed as the first
1977 ** argument to callbacks registered using rtree_geometry_callback().
1978 */
1979 struct sqlite3_rtree_geometry
1980 {
1981     void *pContext;                   /** Copy of pContext passed to s_r_g_c() */
1982     int nParam;                       /** Size of array aParam[] */
1983     double *aParam;                   /** Parameters passed to SQL geom function */
1984     void *pUser;                      /** Callback implementation user data */
1985     void function (void *) xDelUser;  /** Called by SQLite to clean up pUser */
1986 }
1987 
1988 int sqlite3_rtree_query_callback(
1989     sqlite3 *db,
1990     const(char)* zQueryFunc,
1991     int function(sqlite3_rtree_query_info*) xQueryFunc,
1992     void *pContext,
1993     void function(void*) xDestructor
1994 );
1995 
1996 struct sqlite3_rtree_query_info
1997 {
1998     void *pContext;                   /* pContext from when function registered */
1999     int nParam;                       /* Number of function parameters */
2000     double*aParam;        /* value of function parameters */
2001     void *pUser;                      /* callback can use this, if desired */
2002     void function(void*) xDelUser;          /* function to free pUser */
2003     double*aCoord;        /* Coordinates of node or entry to check */
2004     uint *anQueue;            /* Number of pending entries in the queue */
2005     int nCoord;                       /* Number of coordinates */
2006     int iLevel;                       /* Level of current node or entry */
2007     int mxLevel;                      /* The largest iLevel value in the tree */
2008     sqlite3_int64 iRowid;             /* Rowid for current entry */
2009     double rParentScore;   /* Score of parent node */
2010     int eParentWithin;                /* Visibility of parent node */
2011     int eWithin;                      /* OUT: Visiblity */
2012     double rScore;         /* OUT: Write the score here */
2013     sqlite3_value **apSqlParam;       /* Original SQL values of parameters */
2014 }
2015 
2016 enum
2017 {
2018     NOT_WITHIN    = 0,
2019     PARTLY_WITHIN = 1,
2020     FULLY_WITHIN  = 2
2021 }
2022 
2023 /******************************************************************************
2024 ** Interfaces to extend FTS5.
2025 */
2026 struct Fts5Context;
2027 /// Ditto
2028 alias fts5_extension_function = void function(
2029     const Fts5ExtensionApi *pApi,
2030     Fts5Context *pFts,
2031     sqlite3_context *pCtx,
2032     int nVal,
2033     sqlite3_value **apVal
2034 );
2035 /// Ditto
2036 struct Fts5PhraseIter
2037 {
2038     const(ubyte) *a;
2039     const(ubyte) *b;
2040 }
2041 /// Ditto
2042 struct Fts5ExtensionApi
2043 {
2044     int iVersion;
2045     void* function(Fts5Context*) xUserData;
2046     int function(Fts5Context*) xColumnCount;
2047     int function(Fts5Context*, sqlite3_int64 *pnRow) xRowCount;
2048     int function(Fts5Context*, int iCol, sqlite3_int64 *pnToken) xColumnTotalSize;
2049     int function(Fts5Context*,
2050         const char *pText, int nText,
2051         void *pCtx,
2052         int function(void*, int, const char*, int, int, int) xToken
2053     ) xTokenize;
2054     int function(Fts5Context*) xPhraseCount;
2055     int function(Fts5Context*, int iPhrase) xPhraseSize;
2056     int function(Fts5Context*, int *pnInst) xInstCount;
2057     int function(Fts5Context*, int iIdx, int *piPhrase, int *piCol, int *piOff) xInst;
2058     sqlite3_int64 function(Fts5Context*) xRowid;
2059     int function(Fts5Context*, int iCol, const char **pz, int *pn) xColumnText;
2060     int function(Fts5Context*, int iCol, int *pnToken) xColumnSize;
2061     int function(Fts5Context*, int iPhrase, void *pUserData,
2062         int function(const Fts5ExtensionApi*,Fts5Context*,void*)
2063     ) xQueryPhrase;
2064     int function(Fts5Context*, void *pAux, void function(void*) xDelete) xSetAuxdata;
2065     void* function(Fts5Context*, int bClear) xGetAuxdata;
2066     void function(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*, int*) xPhraseFirst;
2067     void function(Fts5Context*, Fts5PhraseIter*, int *piCol, int *piOff) xPhraseNext;
2068 }
2069 /// Ditto
2070 struct Fts5Tokenizer;
2071 struct fts5_tokenizer
2072 {
2073     int function(void*, const char **azArg, int nArg, Fts5Tokenizer **ppOut) xCreate;
2074     void function(Fts5Tokenizer*) xDelete;
2075     int function(Fts5Tokenizer*,
2076         void *pCtx,
2077         int flags,
2078         const char *pText, int nText,
2079         int function(
2080             void *pCtx,
2081             int tflags,
2082             const char *pToken,
2083             int nToken,
2084             int iStart,
2085             int iEnd
2086         ) xToken
2087     ) xTokenize;
2088 }
2089 /// Ditto
2090 enum FTS5_TOKENIZE_QUERY     = 0x0001;
2091 /// Ditto
2092 enum FTS5_TOKENIZE_PREFIX    = 0x0002;
2093 /// Ditto
2094 enum FTS5_TOKENIZE_DOCUMENT  = 0x0004;
2095 /// Ditto
2096 enum FTS5_TOKENIZE_AUX       = 0x0008;
2097 /// Ditto
2098 enum FTS5_TOKEN_COLOCATED    = 0x0001;
2099 /// Ditto
2100 struct fts5_api
2101 {
2102     int iVersion;
2103 
2104     int function(
2105         fts5_api *pApi,
2106         const char *zName,
2107         void *pContext,
2108         fts5_tokenizer *pTokenizer,
2109         void function(void*) xDestroy
2110     ) xCreateTokenizer;
2111 
2112     int function(
2113         fts5_api *pApi,
2114         const char *zName,
2115         void **ppContext,
2116         fts5_tokenizer *pTokenizer
2117     ) xFindTokenizer;
2118 
2119     int function(
2120         fts5_api *pApi,
2121         const char *zName,
2122         void *pContext,
2123         fts5_extension_function xFunction,
2124         void function(void*) xDestroy
2125     ) xCreateFunction;
2126 }
Suggestion Box / Bug Report