forked from ldc-developers/phobos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsqlite3.d
2126 lines (1926 loc) · 66.8 KB
/
sqlite3.d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
module etc.c.sqlite3;
/*
** 2001 September 15
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
**
** May you do good and not evil.
** May you find forgiveness for yourself and forgive others.
** May you share freely, never taking more than you give.
**
*************************************************************************
** This header file defines the interface that the SQLite library
** presents to client programs. If a C-function, structure, datatype,
** or constant definition does not appear in this file, then it is
** not a published API of SQLite, is subject to change without
** notice, and should not be referenced by programs that use SQLite.
**
** Some of the definitions that are in this file are marked as
** "experimental". Experimental interfaces are normally new
** features recently added to SQLite. We do not anticipate changes
** to experimental interfaces but reserve the right to make minor changes
** if experience from use "in the wild" suggest such changes are prudent.
**
** The official C-language API documentation for SQLite is derived
** from comments in this file. This file is the authoritative source
** on how SQLite interfaces are suppose to operate.
**
** The name of this file under configuration management is "sqlite.h.in".
** The makefile makes some minor changes to this file (such as inserting
** the version number) and changes its name to "sqlite3.h" as
** part of the build process.
*/
import core.stdc.stdarg : va_list;
extern (C) __gshared nothrow:
/**
** CAPI3REF: Compile-Time Library Version Numbers
*/
enum SQLITE_VERSION = "3.10.2";
/// Ditto
enum SQLITE_VERSION_NUMBER = 3_010_002;
/// Ditto
enum SQLITE_SOURCE_ID = "2016-01-20 15:27:19 17efb4209f97fb4971656086b138599a91a75ff9";
/**
** CAPI3REF: Run-Time Library Version Numbers
*/
extern immutable(char)* sqlite3_version;
/// Ditto
immutable(char)* sqlite3_libversion();
/// Ditto
immutable(char)* sqlite3_sourceid();
/// Ditto
int sqlite3_libversion_number();
/**
** CAPI3REF: Run-Time Library Compilation Options Diagnostics
*/
int sqlite3_compileoption_used(const char *zOptName);
/// Ditto
immutable(char)* sqlite3_compileoption_get(int N);
/**
** CAPI3REF: Test To See If The Library Is Threadsafe
*/
int sqlite3_threadsafe();
/**
** CAPI3REF: Database Connection Handle
*/
struct sqlite3;
///
alias sqlite3_int64 = long;
///
alias sqlite3_uint64 = ulong;
/**
** CAPI3REF: Closing A Database Connection
**
*/
int sqlite3_close(sqlite3 *);
int sqlite3_close_v2(sqlite3*);
/**
** The type for a callback function.
** This is legacy and deprecated. It is included for historical
** compatibility and is not documented.
*/
alias sqlite3_callback = int function (void*,int,char**, char**);
/**
** CAPI3REF: One-Step Query Execution Interface
*/
int sqlite3_exec(
sqlite3*, /** An open database */
const(char)*sql, /** SQL to be evaluated */
int function (void*,int,char**,char**) callback, /** Callback function */
void *, /** 1st argument to callback */
char **errmsg /** Error msg written here */
);
/**
** CAPI3REF: Result Codes
*/
enum
{
SQLITE_OK = 0, /** Successful result */
/* beginning-of-error-codes */
/// Ditto
SQLITE_ERROR = 1, /** SQL error or missing database */
SQLITE_INTERNAL = 2, /** Internal logic error in SQLite */
SQLITE_PERM = 3, /** Access permission denied */
SQLITE_ABORT = 4, /** Callback routine requested an abort */
SQLITE_BUSY = 5, /** The database file is locked */
SQLITE_LOCKED = 6, /** A table in the database is locked */
SQLITE_NOMEM = 7, /** A malloc() failed */
SQLITE_READONLY = 8, /** Attempt to write a readonly database */
SQLITE_INTERRUPT = 9, /** Operation terminated by sqlite3_interrupt()*/
SQLITE_IOERR = 10, /** Some kind of disk I/O error occurred */
SQLITE_CORRUPT = 11, /** The database disk image is malformed */
SQLITE_NOTFOUND = 12, /** Unknown opcode in sqlite3_file_control() */
SQLITE_FULL = 13, /** Insertion failed because database is full */
SQLITE_CANTOPEN = 14, /** Unable to open the database file */
SQLITE_PROTOCOL = 15, /** Database lock protocol error */
SQLITE_EMPTY = 16, /** Database is empty */
SQLITE_SCHEMA = 17, /** The database schema changed */
SQLITE_TOOBIG = 18, /** String or BLOB exceeds size limit */
SQLITE_CONSTRAINT = 19, /** Abort due to constraint violation */
SQLITE_MISMATCH = 20, /** Data type mismatch */
SQLITE_MISUSE = 21, /** Library used incorrectly */
SQLITE_NOLFS = 22, /** Uses OS features not supported on host */
SQLITE_AUTH = 23, /** Authorization denied */
SQLITE_FORMAT = 24, /** Auxiliary database format error */
SQLITE_RANGE = 25, /** 2nd parameter to sqlite3_bind out of range */
SQLITE_NOTADB = 26, /** File opened that is not a database file */
SQLITE_NOTICE = 27,
SQLITE_WARNING = 28,
SQLITE_ROW = 100, /** sqlite3_step() has another row ready */
SQLITE_DONE = 101 /** sqlite3_step() has finished executing */
}
/* end-of-error-codes */
/**
** CAPI3REF: Extended Result Codes
*/
enum
{
SQLITE_IOERR_READ = (SQLITE_IOERR | (1 << 8)),
SQLITE_IOERR_SHORT_READ = (SQLITE_IOERR | (2 << 8)),
SQLITE_IOERR_WRITE = (SQLITE_IOERR | (3 << 8)),
SQLITE_IOERR_FSYNC = (SQLITE_IOERR | (4 << 8)),
SQLITE_IOERR_DIR_FSYNC = (SQLITE_IOERR | (5 << 8)),
SQLITE_IOERR_TRUNCATE = (SQLITE_IOERR | (6 << 8)),
SQLITE_IOERR_FSTAT = (SQLITE_IOERR | (7 << 8)),
SQLITE_IOERR_UNLOCK = (SQLITE_IOERR | (8 << 8)),
SQLITE_IOERR_RDLOCK = (SQLITE_IOERR | (9 << 8)),
SQLITE_IOERR_DELETE = (SQLITE_IOERR | (10 << 8)),
SQLITE_IOERR_BLOCKED = (SQLITE_IOERR | (11 << 8)),
SQLITE_IOERR_NOMEM = (SQLITE_IOERR | (12 << 8)),
SQLITE_IOERR_ACCESS = (SQLITE_IOERR | (13 << 8)),
SQLITE_IOERR_CHECKRESERVEDLOCK = (SQLITE_IOERR | (14 << 8)),
SQLITE_IOERR_LOCK = (SQLITE_IOERR | (15 << 8)),
SQLITE_IOERR_CLOSE = (SQLITE_IOERR | (16 << 8)),
SQLITE_IOERR_DIR_CLOSE = (SQLITE_IOERR | (17 << 8)),
SQLITE_IOERR_SHMOPEN = (SQLITE_IOERR | (18 << 8)),
SQLITE_IOERR_SHMSIZE = (SQLITE_IOERR | (19 << 8)),
SQLITE_IOERR_SHMLOCK = (SQLITE_IOERR | (20 << 8)),
SQLITE_IOERR_SHMMAP = (SQLITE_IOERR | (21 << 8)),
SQLITE_IOERR_SEEK = (SQLITE_IOERR | (22 << 8)),
SQLITE_IOERR_DELETE_NOENT = (SQLITE_IOERR | (23 << 8)),
SQLITE_IOERR_MMAP = (SQLITE_IOERR | (24 << 8)),
SQLITE_LOCKED_SHAREDCACHE = (SQLITE_LOCKED | (1 << 8)),
SQLITE_BUSY_RECOVERY = (SQLITE_BUSY | (1 << 8)),
SQLITE_CANTOPEN_NOTEMPDIR = (SQLITE_CANTOPEN | (1 << 8)),
SQLITE_IOERR_GETTEMPPATH = (SQLITE_IOERR | (25 << 8)),
SQLITE_IOERR_CONVPATH = (SQLITE_IOERR | (26 << 8)),
SQLITE_BUSY_SNAPSHOT = (SQLITE_BUSY | (2 << 8)),
SQLITE_CANTOPEN_ISDIR = (SQLITE_CANTOPEN | (2 << 8)),
SQLITE_CANTOPEN_FULLPATH = (SQLITE_CANTOPEN | (3 << 8)),
SQLITE_CANTOPEN_CONVPATH = (SQLITE_CANTOPEN | (4 << 8)),
SQLITE_CORRUPT_VTAB = (SQLITE_CORRUPT | (1 << 8)),
SQLITE_READONLY_RECOVERY = (SQLITE_READONLY | (1 << 8)),
SQLITE_READONLY_CANTLOCK = (SQLITE_READONLY | (2 << 8)),
SQLITE_READONLY_ROLLBACK = (SQLITE_READONLY | (3 << 8)),
SQLITE_READONLY_DBMOVED = (SQLITE_READONLY | (4 << 8)),
SQLITE_ABORT_ROLLBACK = (SQLITE_ABORT | (2 << 8)),
SQLITE_CONSTRAINT_CHECK = (SQLITE_CONSTRAINT | (1 << 8)),
SQLITE_CONSTRAINT_COMMITHOOK = (SQLITE_CONSTRAINT | (2 << 8)),
SQLITE_CONSTRAINT_FOREIGNKEY = (SQLITE_CONSTRAINT | (3 << 8)),
SQLITE_CONSTRAINT_FUNCTION = (SQLITE_CONSTRAINT | (4 << 8)),
SQLITE_CONSTRAINT_NOTNULL = (SQLITE_CONSTRAINT | (5 << 8)),
SQLITE_CONSTRAINT_PRIMARYKEY = (SQLITE_CONSTRAINT | (6 << 8)),
SQLITE_CONSTRAINT_TRIGGER = (SQLITE_CONSTRAINT | (7 << 8)),
SQLITE_CONSTRAINT_UNIQUE = (SQLITE_CONSTRAINT | (8 << 8)),
SQLITE_CONSTRAINT_VTAB = (SQLITE_CONSTRAINT | (9 << 8)),
SQLITE_CONSTRAINT_ROWID = (SQLITE_CONSTRAINT |(10 << 8)),
SQLITE_NOTICE_RECOVER_WAL = (SQLITE_NOTICE | (1 << 8)),
SQLITE_NOTICE_RECOVER_ROLLBACK = (SQLITE_NOTICE | (2 << 8)),
SQLITE_WARNING_AUTOINDEX = (SQLITE_WARNING | (1 << 8)),
SQLITE_AUTH_USER = (SQLITE_AUTH | (1 << 8))
}
/**
** CAPI3REF: Flags For File Open Operations
*/
enum
{
SQLITE_OPEN_READONLY = 0x00000001, /** Ok for sqlite3_open_v2() */
SQLITE_OPEN_READWRITE = 0x00000002, /** Ok for sqlite3_open_v2() */
SQLITE_OPEN_CREATE = 0x00000004, /** Ok for sqlite3_open_v2() */
SQLITE_OPEN_DELETEONCLOSE = 0x00000008, /** VFS only */
SQLITE_OPEN_EXCLUSIVE = 0x00000010, /** VFS only */
SQLITE_OPEN_AUTOPROXY = 0x00000020, /** VFS only */
SQLITE_OPEN_URI = 0x00000040, /** Ok for sqlite3_open_v2() */
SQLITE_OPEN_MEMORY = 0x00000080, /** Ok for sqlite3_open_v2() */
SQLITE_OPEN_MAIN_DB = 0x00000100, /** VFS only */
SQLITE_OPEN_TEMP_DB = 0x00000200, /** VFS only */
SQLITE_OPEN_TRANSIENT_DB = 0x00000400, /** VFS only */
SQLITE_OPEN_MAIN_JOURNAL = 0x00000800, /** VFS only */
SQLITE_OPEN_TEMP_JOURNAL = 0x00001000, /** VFS only */
SQLITE_OPEN_SUBJOURNAL = 0x00002000, /** VFS only */
SQLITE_OPEN_MASTER_JOURNAL = 0x00004000, /** VFS only */
SQLITE_OPEN_NOMUTEX = 0x00008000, /** Ok for sqlite3_open_v2() */
SQLITE_OPEN_FULLMUTEX = 0x00010000, /** Ok for sqlite3_open_v2() */
SQLITE_OPEN_SHAREDCACHE = 0x00020000, /** Ok for sqlite3_open_v2() */
SQLITE_OPEN_PRIVATECACHE = 0x00040000, /** Ok for sqlite3_open_v2() */
SQLITE_OPEN_WAL = 0x00080000 /** VFS only */
}
/**
** CAPI3REF: Device Characteristics
*/
enum
{
SQLITE_IOCAP_ATOMIC = 0x00000001,
SQLITE_IOCAP_ATOMIC512 = 0x00000002,
SQLITE_IOCAP_ATOMIC1K = 0x00000004,
SQLITE_IOCAP_ATOMIC2K = 0x00000008,
SQLITE_IOCAP_ATOMIC4K = 0x00000010,
SQLITE_IOCAP_ATOMIC8K = 0x00000020,
SQLITE_IOCAP_ATOMIC16K = 0x00000040,
SQLITE_IOCAP_ATOMIC32K = 0x00000080,
SQLITE_IOCAP_ATOMIC64K = 0x00000100,
SQLITE_IOCAP_SAFE_APPEND = 0x00000200,
SQLITE_IOCAP_SEQUENTIAL = 0x00000400,
SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN = 0x00000800,
SQLITE_IOCAP_POWERSAFE_OVERWRITE = 0x00001000,
SQLITE_IOCAP_IMMUTABLE = 0x00002000
}
/**
** CAPI3REF: File Locking Levels
*/
enum
{
SQLITE_LOCK_NONE = 0,
SQLITE_LOCK_SHARED = 1,
SQLITE_LOCK_RESERVED = 2,
SQLITE_LOCK_PENDING = 3,
SQLITE_LOCK_EXCLUSIVE = 4
}
/**
** CAPI3REF: Synchronization Type Flags
*/
enum
{
SQLITE_SYNC_NORMAL = 0x00002,
SQLITE_SYNC_FULL = 0x00003,
SQLITE_SYNC_DATAONLY = 0x00010
}
/**
** CAPI3REF: OS Interface Open File Handle
*/
struct sqlite3_file
{
const(sqlite3_io_methods)*pMethods; /* Methods for an open file */
}
/**
** CAPI3REF: OS Interface File Virtual Methods Object
*/
struct sqlite3_io_methods
{
int iVersion;
int function (sqlite3_file*) xClose;
int function (sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst) xRead;
int function (sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst) xWrite;
int function (sqlite3_file*, sqlite3_int64 size) xTruncate;
int function (sqlite3_file*, int flags) xSync;
int function (sqlite3_file*, sqlite3_int64 *pSize) xFileSize;
int function (sqlite3_file*, int) xLock;
int function (sqlite3_file*, int) xUnlock;
int function (sqlite3_file*, int *pResOut) xCheckReservedLock;
int function (sqlite3_file*, int op, void *pArg) xFileControl;
int function (sqlite3_file*) xSectorSize;
int function (sqlite3_file*) xDeviceCharacteristics;
/* Methods above are valid for version 1 */
int function (sqlite3_file*, int iPg, int pgsz, int, void **) xShmMap;
int function (sqlite3_file*, int offset, int n, int flags) xShmLock;
void function (sqlite3_file*) xShmBarrier;
int function (sqlite3_file*, int deleteFlag) xShmUnmap;
/* Methods above are valid for version 2 */
/* Additional methods may be added in future releases */
int function (sqlite3_file*, sqlite3_int64 iOfst, int iAmt, void **pp) xFetch;
int function (sqlite3_file*, sqlite3_int64 iOfst, void *p) xUnfetch;
}
/**
** CAPI3REF: Standard File Control Opcodes
*/
enum
{
SQLITE_FCNTL_LOCKSTATE = 1,
SQLITE_GET_LOCKPROXYFILE = 2,
SQLITE_SET_LOCKPROXYFILE = 3,
SQLITE_LAST_ERRNO = 4,
SQLITE_FCNTL_SIZE_HINT = 5,
SQLITE_FCNTL_CHUNK_SIZE = 6,
SQLITE_FCNTL_FILE_POINTER = 7,
SQLITE_FCNTL_SYNC_OMITTED = 8,
SQLITE_FCNTL_WIN32_AV_RETRY = 9,
SQLITE_FCNTL_PERSIST_WAL = 10,
SQLITE_FCNTL_OVERWRITE = 11,
SQLITE_FCNTL_VFSNAME = 12,
SQLITE_FCNTL_POWERSAFE_OVERWRITE = 13,
SQLITE_FCNTL_PRAGMA = 14,
SQLITE_FCNTL_BUSYHANDLER = 15,
SQLITE_FCNTL_TEMPFILENAME = 16,
SQLITE_FCNTL_MMAP_SIZE = 18,
SQLITE_FCNTL_TRACE = 19,
SQLITE_FCNTL_HAS_MOVED = 20,
SQLITE_FCNTL_SYNC = 21,
SQLITE_FCNTL_COMMIT_PHASETWO = 22,
SQLITE_FCNTL_WIN32_SET_HANDLE = 23,
SQLITE_FCNTL_WAL_BLOCK = 24,
SQLITE_FCNTL_ZIPVFS = 25,
SQLITE_FCNTL_RBU = 26,
SQLITE_FCNTL_VFS_POINTER = 27,
}
/**
** CAPI3REF: Mutex Handle
*/
struct sqlite3_mutex;
/**
** CAPI3REF: OS Interface Object
*/
alias xDlSymReturn = void * function();
/// Ditto
alias sqlite3_syscall_ptr = void function();
struct sqlite3_vfs
{
int iVersion; /** Structure version number (currently 2) */
int szOsFile; /** Size of subclassed sqlite3_file */
int mxPathname; /** Maximum file pathname length */
sqlite3_vfs *pNext; /** Next registered VFS */
const(char)*zName; /** Name of this virtual file system */
void *pAppData; /** Pointer to application-specific data */
int function (sqlite3_vfs*, const char *zName, sqlite3_file*,
int flags, int *pOutFlags) xOpen;
int function (sqlite3_vfs*, const char *zName, int syncDir) xDelete;
int function (sqlite3_vfs*, const char *zName, int flags, int *pResOut) xAccess;
int function (sqlite3_vfs*, const char *zName, int nOut, char *zOut) xFullPathname;
void* function (sqlite3_vfs*, const char *zFilename) xDlOpen;
void function (sqlite3_vfs*, int nByte, char *zErrMsg) xDlError;
xDlSymReturn function (sqlite3_vfs*,void*, const char *zSymbol) *xDlSym;
void function (sqlite3_vfs*, void*) xDlClose;
int function (sqlite3_vfs*, int nByte, char *zOut) xRandomness;
int function (sqlite3_vfs*, int microseconds) xSleep;
int function (sqlite3_vfs*, double*) xCurrentTime;
int function (sqlite3_vfs*, int, char *) xGetLastError;
/*
** The methods above are in version 1 of the sqlite_vfs object
** definition. Those that follow are added in version 2 or later
*/
int function (sqlite3_vfs*, sqlite3_int64*) xCurrentTimeInt64;
/*
** The methods above are in versions 1 and 2 of the sqlite_vfs object.
** Those below are for version 3 and greater.
*/
int function(sqlite3_vfs*, const char * zName, sqlite3_syscall_ptr) xSetSystemCall;
sqlite3_syscall_ptr function(sqlite3_vfs*, const char * zName) xGetSystemCall;
const(char)* function(sqlite3_vfs*, const char * zName) xNextSystemCall;
/*
** The methods above are in versions 1 through 3 of the sqlite_vfs object.
** New fields may be appended in figure versions. The iVersion
** value will increment whenever this happens.
*/
}
/**
** CAPI3REF: Flags for the xAccess VFS method
*/
enum
{
SQLITE_ACCESS_EXISTS = 0,
SQLITE_ACCESS_READWRITE = 1, /** Used by PRAGMA temp_store_directory */
SQLITE_ACCESS_READ = 2 /** Unused */
}
/**
** CAPI3REF: Flags for the xShmLock VFS method
*/
enum
{
SQLITE_SHM_UNLOCK = 1,
SQLITE_SHM_LOCK = 2,
SQLITE_SHM_SHARED = 4,
SQLITE_SHM_EXCLUSIVE = 8
}
/**
** CAPI3REF: Maximum xShmLock index
*/
enum SQLITE_SHM_NLOCK = 8;
/**
** CAPI3REF: Initialize The SQLite Library
*/
int sqlite3_initialize();
/// Ditto
int sqlite3_shutdown();
/// Ditto
int sqlite3_os_init();
/// Ditto
int sqlite3_os_end();
/**
** CAPI3REF: Configuring The SQLite Library
*/
int sqlite3_config(int, ...);
/**
** CAPI3REF: Configure database connections
*/
int sqlite3_db_config(sqlite3*, int op, ...);
/**
** CAPI3REF: Memory Allocation Routines
*/
struct sqlite3_mem_methods
{
void* function (int) xMalloc; /** Memory allocation function */
void function (void*) xFree; /** Free a prior allocation */
void* function (void*,int) xRealloc; /** Resize an allocation */
int function (void*) xSize; /** Return the size of an allocation */
int function (int) xRoundup; /** Round up request size to allocation size */
int function (void*) xInit; /** Initialize the memory allocator */
void function (void*) xShutdown; /** Deinitialize the memory allocator */
void *pAppData; /** Argument to xInit() and xShutdown() */
}
/**
** CAPI3REF: Configuration Options
*/
enum
{
SQLITE_CONFIG_SINGLETHREAD = 1, /** nil */
SQLITE_CONFIG_MULTITHREAD = 2, /** nil */
SQLITE_CONFIG_SERIALIZED = 3, /** nil */
SQLITE_CONFIG_MALLOC = 4, /** sqlite3_mem_methods* */
SQLITE_CONFIG_GETMALLOC = 5, /** sqlite3_mem_methods* */
SQLITE_CONFIG_SCRATCH = 6, /** void*, int sz, int N */
SQLITE_CONFIG_PAGECACHE = 7, /** void*, int sz, int N */
SQLITE_CONFIG_HEAP = 8, /** void*, int nByte, int min */
SQLITE_CONFIG_MEMSTATUS = 9, /** boolean */
SQLITE_CONFIG_MUTEX = 10, /** sqlite3_mutex_methods* */
SQLITE_CONFIG_GETMUTEX = 11, /** sqlite3_mutex_methods* */
/* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */
SQLITE_CONFIG_LOOKASIDE = 13, /** int int */
SQLITE_CONFIG_PCACHE = 14, /** sqlite3_pcache_methods* */
SQLITE_CONFIG_GETPCACHE = 15, /** sqlite3_pcache_methods* */
SQLITE_CONFIG_LOG = 16, /** xFunc, void* */
SQLITE_CONFIG_URI = 17,
SQLITE_CONFIG_PCACHE2 = 18,
SQLITE_CONFIG_GETPCACHE2 = 19,
SQLITE_CONFIG_COVERING_INDEX_SCAN = 20,
SQLITE_CONFIG_SQLLOG = 21,
SQLITE_CONFIG_MMAP_SIZE = 22,
SQLITE_CONFIG_WIN32_HEAPSIZE = 23,
SQLITE_CONFIG_PCACHE_HDRSZ = 24,
SQLITE_CONFIG_PMASZ = 25,
}
/**
** CAPI3REF: Database Connection Configuration Options
*/
enum
{
SQLITE_DBCONFIG_LOOKASIDE = 1001, /** void* int int */
SQLITE_DBCONFIG_ENABLE_FKEY = 1002, /** int int* */
SQLITE_DBCONFIG_ENABLE_TRIGGER = 1003 /** int int* */
}
/**
** CAPI3REF: Enable Or Disable Extended Result Codes
*/
int sqlite3_extended_result_codes(sqlite3*, int onoff);
/**
** CAPI3REF: Last Insert Rowid
*/
sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);
/**
** CAPI3REF: Count The Number Of Rows Modified
*/
int sqlite3_changes(sqlite3*);
/**
** CAPI3REF: Total Number Of Rows Modified
*/
int sqlite3_total_changes(sqlite3*);
/**
** CAPI3REF: Interrupt A Long-Running Query
*/
void sqlite3_interrupt(sqlite3*);
/**
** CAPI3REF: Determine If An SQL Statement Is Complete
*/
int sqlite3_complete(const char *sql);
/// Ditto
int sqlite3_complete16(const void *sql);
/**
** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors
*/
int sqlite3_busy_handler(sqlite3*, int function (void*,int), void*);
/**
** CAPI3REF: Set A Busy Timeout
*/
int sqlite3_busy_timeout(sqlite3*, int ms);
/**
** CAPI3REF: Convenience Routines For Running Queries
*/
int sqlite3_get_table(
sqlite3 *db, /** An open database */
const(char)*zSql, /** SQL to be evaluated */
char ***pazResult, /** Results of the query */
int *pnRow, /** Number of result rows written here */
int *pnColumn, /** Number of result columns written here */
char **pzErrmsg /** Error msg written here */
);
///
void sqlite3_free_table(char **result);
/**
** CAPI3REF: Formatted String Printing Functions
*/
char *sqlite3_mprintf(const char*,...);
char *sqlite3_vmprintf(const char*, va_list);
char *sqlite3_snprintf(int,char*,const char*, ...);
char *sqlite3_vsnprintf(int,char*,const char*, va_list);
/**
** CAPI3REF: Memory Allocation Subsystem
*/
void *sqlite3_malloc(int);
/// Ditto
void *sqlite3_malloc64(sqlite3_uint64);
/// Ditto
void *sqlite3_realloc(void*, int);
/// Ditto
void *sqlite3_realloc64(void*, sqlite3_uint64);
/// Ditto
void sqlite3_free(void*);
/// Ditto
sqlite3_uint64 sqlite3_msize(void*);
/**
** CAPI3REF: Memory Allocator Statistics
*/
sqlite3_int64 sqlite3_memory_used();
sqlite3_int64 sqlite3_memory_highwater(int resetFlag);
/**
** CAPI3REF: Pseudo-Random Number Generator
*/
void sqlite3_randomness(int N, void *P);
/**
** CAPI3REF: Compile-Time Authorization Callbacks
*/
int sqlite3_set_authorizer(
sqlite3*,
int function (void*,int,const char*,const char*,const char*,const char*) xAuth,
void *pUserData
);
/**
** CAPI3REF: Authorizer Return Codes
*/
enum
{
SQLITE_DENY = 1, /** Abort the SQL statement with an error */
SQLITE_IGNORE = 2 /** Don't allow access, but don't generate an error */
}
/**
** CAPI3REF: Authorizer Action Codes
*/
/******************************************* 3rd ************ 4th ***********/
enum
{
SQLITE_CREATE_INDEX = 1, /** Index Name Table Name */
SQLITE_CREATE_TABLE = 2, /** Table Name NULL */
SQLITE_CREATE_TEMP_INDEX = 3, /** Index Name Table Name */
SQLITE_CREATE_TEMP_TABLE = 4, /** Table Name NULL */
SQLITE_CREATE_TEMP_TRIGGER = 5, /** Trigger Name Table Name */
SQLITE_CREATE_TEMP_VIEW = 6, /** View Name NULL */
SQLITE_CREATE_TRIGGER = 7, /** Trigger Name Table Name */
SQLITE_CREATE_VIEW = 8, /** View Name NULL */
SQLITE_DELETE = 9, /** Table Name NULL */
SQLITE_DROP_INDEX = 10, /** Index Name Table Name */
SQLITE_DROP_TABLE = 11, /** Table Name NULL */
SQLITE_DROP_TEMP_INDEX = 12, /** Index Name Table Name */
SQLITE_DROP_TEMP_TABLE = 13, /** Table Name NULL */
SQLITE_DROP_TEMP_TRIGGER = 14, /** Trigger Name Table Name */
SQLITE_DROP_TEMP_VIEW = 15, /** View Name NULL */
SQLITE_DROP_TRIGGER = 16, /** Trigger Name Table Name */
SQLITE_DROP_VIEW = 17, /** View Name NULL */
SQLITE_INSERT = 18, /** Table Name NULL */
SQLITE_PRAGMA = 19, /** Pragma Name 1st arg or NULL */
SQLITE_READ = 20, /** Table Name Column Name */
SQLITE_SELECT = 21, /** NULL NULL */
SQLITE_TRANSACTION = 22, /** Operation NULL */
SQLITE_UPDATE = 23, /** Table Name Column Name */
SQLITE_ATTACH = 24, /** Filename NULL */
SQLITE_DETACH = 25, /** Database Name NULL */
SQLITE_ALTER_TABLE = 26, /** Database Name Table Name */
SQLITE_REINDEX = 27, /** Index Name NULL */
SQLITE_ANALYZE = 28, /** Table Name NULL */
SQLITE_CREATE_VTABLE = 29, /** Table Name Module Name */
SQLITE_DROP_VTABLE = 30, /** Table Name Module Name */
SQLITE_FUNCTION = 31, /** NULL Function Name */
SQLITE_SAVEPOINT = 32, /** Operation Savepoint Name */
SQLITE_COPY = 0, /** No longer used */
SQLITE_RECURSIVE = 33
}
/**
** CAPI3REF: Tracing And Profiling Functions
*/
void *sqlite3_trace(sqlite3*, void function (void*,const char*) xTrace, void*);
/// Ditto
void *sqlite3_profile(sqlite3*, void function (void*,const char*,sqlite3_uint64) xProfile, void*);
/**
** CAPI3REF: Query Progress Callbacks
*/
void sqlite3_progress_handler(sqlite3*, int, int function (void*), void*);
/**
** CAPI3REF: Opening A New Database Connection
*/
int sqlite3_open(
const(char)*filename, /** Database filename (UTF-8) */
sqlite3 **ppDb /** OUT: SQLite db handle */
);
/// Ditto
int sqlite3_open16(
const(void)*filename, /** Database filename (UTF-16) */
sqlite3 **ppDb /** OUT: SQLite db handle */
);
/// Ditto
int sqlite3_open_v2(
const(char)*filename, /** Database filename (UTF-8) */
sqlite3 **ppDb, /** OUT: SQLite db handle */
int flags, /** Flags */
const(char)*zVfs /** Name of VFS module to use */
);
/*
** CAPI3REF: Obtain Values For URI Parameters
*/
const(char)* sqlite3_uri_parameter(const(char)* zFilename, const(char)* zParam);
/// Ditto
int sqlite3_uri_boolean(const(char)* zFile, const(char)* zParam, int bDefault);
/// Ditto
sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int64);
/**
** CAPI3REF: Error Codes And Messages
*/
int sqlite3_errcode(sqlite3 *db);
/// Ditto
int sqlite3_extended_errcode(sqlite3 *db);
/// Ditto
const(char)* sqlite3_errmsg(sqlite3*);
/// Ditto
const(void)* sqlite3_errmsg16(sqlite3*);
/// Ditto
const(char)* sqlite3_errstr(int);
/**
** CAPI3REF: SQL Statement Object
*/
struct sqlite3_stmt;
/**
** CAPI3REF: Run-time Limits
*/
int sqlite3_limit(sqlite3*, int id, int newVal);
/**
** CAPI3REF: Run-Time Limit Categories
*/
enum
{
SQLITE_LIMIT_LENGTH = 0,
SQLITE_LIMIT_SQL_LENGTH = 1,
SQLITE_LIMIT_COLUMN = 2,
SQLITE_LIMIT_EXPR_DEPTH = 3,
SQLITE_LIMIT_COMPOUND_SELECT = 4,
SQLITE_LIMIT_VDBE_OP = 5,
SQLITE_LIMIT_FUNCTION_ARG = 6,
SQLITE_LIMIT_ATTACHED = 7,
SQLITE_LIMIT_LIKE_PATTERN_LENGTH = 8,
SQLITE_LIMIT_VARIABLE_NUMBER = 9,
SQLITE_LIMIT_TRIGGER_DEPTH = 10,
SQLITE_LIMIT_WORKER_THREADS = 11,
}
/**
** CAPI3REF: Compiling An SQL Statement
*/
int sqlite3_prepare(
sqlite3 *db, /** Database handle */
const(char)*zSql, /** SQL statement, UTF-8 encoded */
int nByte, /** Maximum length of zSql in bytes. */
sqlite3_stmt **ppStmt, /** OUT: Statement handle */
const(char*)*pzTail /** OUT: Pointer to unused portion of zSql */
);
/// Ditto
int sqlite3_prepare_v2(
sqlite3 *db, /** Database handle */
const(char)*zSql, /** SQL statement, UTF-8 encoded */
int nByte, /** Maximum length of zSql in bytes. */
sqlite3_stmt **ppStmt, /** OUT: Statement handle */
const(char*)*pzTail /** OUT: Pointer to unused portion of zSql */
);
/// Ditto
int sqlite3_prepare16(
sqlite3 *db, /** Database handle */
const(void)*zSql, /** SQL statement, UTF-16 encoded */
int nByte, /** Maximum length of zSql in bytes. */
sqlite3_stmt **ppStmt, /** OUT: Statement handle */
const(void*)*pzTail /** OUT: Pointer to unused portion of zSql */
);
/// Ditto
int sqlite3_prepare16_v2(
sqlite3 *db, /** Database handle */
const(void)*zSql, /** SQL statement, UTF-16 encoded */
int nByte, /** Maximum length of zSql in bytes. */
sqlite3_stmt **ppStmt, /** OUT: Statement handle */
const(void*)*pzTail /** OUT: Pointer to unused portion of zSql */
);
/**
** CAPI3REF: Retrieving Statement SQL
*/
const(char)* sqlite3_sql(sqlite3_stmt *pStmt);
/*
** CAPI3REF: Determine If An SQL Statement Writes The Database
*/
int sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
/**
** CAPI3REF: Determine If A Prepared Statement Has Been Reset
*/
int sqlite3_stmt_busy(sqlite3_stmt*);
/**
** CAPI3REF: Dynamically Typed Value Object
*/
struct sqlite3_value;
/**
** CAPI3REF: SQL Function Context Object
*/
struct sqlite3_context;
/**
** CAPI3REF: Binding Values To Prepared Statements
*/
int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void function (void*));
/// Ditto
int sqlite3_bind_blob64(sqlite3_stmt*, int, const void*, sqlite3_uint64,void function (void*));
/// Ditto
int sqlite3_bind_double(sqlite3_stmt*, int, double);
/// Ditto
int sqlite3_bind_int(sqlite3_stmt*, int, int);
/// Ditto
int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64);
/// Ditto
int sqlite3_bind_null(sqlite3_stmt*, int);
/// Ditto
int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int n, void function (void*));
/// Ditto
int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void function (void*));
/// Ditto
int sqlite3_bind_text64(sqlite3_stmt*, int, const char*, sqlite3_uint64,void function (void*), ubyte encoding);
/// Ditto
int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
/// Ditto
int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
/// Ditto
int sqlite3_bind_zeroblob64(sqlite3_stmt*, int, sqlite3_uint64 n);
/**
** CAPI3REF: Number Of SQL Parameters
*/
int sqlite3_bind_parameter_count(sqlite3_stmt*);
/**
** CAPI3REF: Name Of A Host Parameter
*/
const(char)* sqlite3_bind_parameter_name(sqlite3_stmt*, int);
/**
** CAPI3REF: Index Of A Parameter With A Given Name
*/
int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName);
/**
** CAPI3REF: Reset All Bindings On A Prepared Statement
*/
int sqlite3_clear_bindings(sqlite3_stmt*);
/**
** CAPI3REF: Number Of Columns In A Result Set
*/
int sqlite3_column_count(sqlite3_stmt *pStmt);
/**
** CAPI3REF: Column Names In A Result Set
*/
const(char)* sqlite3_column_name(sqlite3_stmt*, int N);
/// Ditto
const(void)* sqlite3_column_name16(sqlite3_stmt*, int N);
/**
** CAPI3REF: Source Of Data In A Query Result
*/
const(char)* sqlite3_column_database_name(sqlite3_stmt*,int);
/// Ditto
const(void)* sqlite3_column_database_name16(sqlite3_stmt*,int);
/// Ditto
const(char)* sqlite3_column_table_name(sqlite3_stmt*,int);
/// Ditto
const (void)* sqlite3_column_table_name16(sqlite3_stmt*,int);
/// Ditto
const (char)* sqlite3_column_origin_name(sqlite3_stmt*,int);
/// Ditto
const (void)* sqlite3_column_origin_name16(sqlite3_stmt*,int);
/**
** CAPI3REF: Declared Datatype Of A Query Result
*/
const (char)* sqlite3_column_decltype(sqlite3_stmt*,int);
/// Ditto
const (void)* sqlite3_column_decltype16(sqlite3_stmt*,int);
/**
** CAPI3REF: Evaluate An SQL Statement
*/
int sqlite3_step(sqlite3_stmt*);
/**
** CAPI3REF: Number of columns in a result set
*/
int sqlite3_data_count(sqlite3_stmt *pStmt);
/**
** CAPI3REF: Fundamental Datatypes
*/
enum
{
SQLITE_INTEGER = 1,
SQLITE_FLOAT = 2,
SQLITE_BLOB = 4,
SQLITE_NULL = 5,
SQLITE3_TEXT = 3
}
/**
** CAPI3REF: Result Values From A Query
*/
const (void)* sqlite3_column_blob(sqlite3_stmt*, int iCol);
/// Ditto
int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
/// Ditto
int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
/// Ditto
double sqlite3_column_double(sqlite3_stmt*, int iCol);
/// Ditto
int sqlite3_column_int(sqlite3_stmt*, int iCol);
/// Ditto
sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol);
/// Ditto
const (char)* sqlite3_column_text(sqlite3_stmt*, int iCol);
/// Ditto
const (void)* sqlite3_column_text16(sqlite3_stmt*, int iCol);
/// Ditto
int sqlite3_column_type(sqlite3_stmt*, int iCol);
/// Ditto
sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol);
/**
** CAPI3REF: Destroy A Prepared Statement Object
*/
int sqlite3_finalize(sqlite3_stmt *pStmt);
/**
** CAPI3REF: Reset A Prepared Statement Object
*/
int sqlite3_reset(sqlite3_stmt *pStmt);
/**
** CAPI3REF: Create Or Redefine SQL Functions
*/
int sqlite3_create_function(
sqlite3 *db,
const(char)*zFunctionName,
int nArg,
int eTextRep,
void *pApp,
void function (sqlite3_context*,int,sqlite3_value**) xFunc,
void function (sqlite3_context*,int,sqlite3_value**) xStep,
void function (sqlite3_context*) xFinal
);
/// Ditto
int sqlite3_create_function16(
sqlite3 *db,
const(void)*zFunctionName,
int nArg,
int eTextRep,
void *pApp,
void function (sqlite3_context*,int,sqlite3_value**) xFunc,
void function (sqlite3_context*,int,sqlite3_value**) xStep,
void function (sqlite3_context*) xFinal
);
/// Ditto
int sqlite3_create_function_v2(
sqlite3 *db,
const(char)*zFunctionName,
int nArg,
int eTextRep,
void *pApp,
void function (sqlite3_context*,int,sqlite3_value**) xFunc,
void function (sqlite3_context*,int,sqlite3_value**) xStep,
void function (sqlite3_context*) xFinal,
void function (void*) xDestroy
);
/**
** CAPI3REF: Text Encodings
**
** These constant define integer codes that represent the various
** text encodings supported by SQLite.
*/
enum
{
SQLITE_UTF8 = 1,
SQLITE_UTF16LE = 2,
SQLITE_UTF16BE = 3
}
/// Ditto
enum
{
SQLITE_UTF16 = 4, /** Use native byte order */
SQLITE_ANY = 5, /** sqlite3_create_function only */
SQLITE_UTF16_ALIGNED = 8 /** sqlite3_create_collation only */
}
/**
** CAPI3REF: Function Flags
*/
enum SQLITE_DETERMINISTIC = 0x800;
/**