-
Notifications
You must be signed in to change notification settings - Fork 5
/
libpassqlite.pas
9142 lines (7742 loc) · 512 KB
/
libpassqlite.pas
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
(******************************************************************************)
(* libPasSQLite *)
(* object pascal wrapper around SQLite library *)
(* *)
(* Copyright (c) 2020 Ivan Semenkov *)
(* https://github.com/isemenkov/libpassqlite ivan@semenkov.pro *)
(* Ukraine *)
(******************************************************************************)
(* *)
(* This source is free software; you can redistribute it and/or modify it *)
(* under the terms of the GNU General Public License as published by the Free *)
(* Software Foundation; either version 3 of the License. *)
(* *)
(* This code is distributed in the hope that it will be useful, but WITHOUT *)
(* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *)
(* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *)
(* more details. *)
(* *)
(* A copy of the GNU General Public License is available on the World Wide *)
(* Web at <http://www.gnu.org/copyleft/gpl.html>. You can also obtain it by *)
(* writing to the Free Software Foundation, Inc., 51 Franklin Street - Fifth *)
(* Floor, Boston, MA 02110-1335, USA. *)
(* *)
(******************************************************************************)
unit libpassqlite;
{$IFDEF FPC}
{$mode objfpc}{$H+}
{$ENDIF}
interface
uses
SysUtils;
{$IFDEF FPC}
{$PACKRECORDS C}
{$ENDIF}
const
{$IFNDEF FPC}
{$IFDEF WIN32 OR IFDEF WIN64}
sqlite3_lib = 'sqlite3.dll';
{$ENDIF}
{$ENDIF}
{$IFDEF WINDOWS}
sqlite3_lib = 'sqlite3.dll';
{$ENDIF}
{$IFDEF UNIX}
sqlite3_lib = 'sqlite3.so';
{$ENDIF}
{$IFDEF DARWIN}
sqlite3_lib = 'libsqlite3.dylib';
{$ENDIF}
{ Many SQLite functions return an integer result code from the set shown here
in order to indicate success or failure. }
const
SQLITE_OK { Successful result } = 0;
SQLITE_ERROR { Generic error } = 1;
SQLITE_INTERNAL { Internal logic error in SQLite } = 2;
SQLITE_PERM { Access permission denied } = 3;
SQLITE_ABORT { Callback routine requested an abort } = 4;
SQLITE_BUSY { The database file is locked } = 5;
SQLITE_LOCKED { A table in the database is locked } = 6;
SQLITE_NOMEM { A malloc() failed } = 7;
SQLITE_READONLY { Attempt to write a readonly database } = 8;
SQLITE_INTERRUPT { Operation terminated by sqlite3_interrupt() } = 9;
SQLITE_IOERR { Some kind of disk I/O error occurred } = 10;
SQLITE_CORRUPT { The database disk image is malformed } = 11;
SQLITE_NOTFOUND { Unknown opcode in sqlite3_file_control() } = 12;
SQLITE_FULL { Insertion failed because database is full } = 13;
SQLITE_CANTOPEN { Unable to open the database file } = 14;
SQLITE_PROTOCOL { Database lock protocol error } = 15;
SQLITE_EMPTY { Internal use only } = 16;
SQLITE_SCHEMA { The database schema changed } = 17;
SQLITE_TOOBIG { String or BLOB exceeds size limit } = 18;
SQLITE_CONSTRAINT { Abort due to constraint violation } = 19;
SQLITE_MISMATCH { Data type mismatch } = 20;
SQLITE_MISUSE { Library used incorrectly } = 21;
SQLITE_NOLFS { Uses OS features not supported on host } = 22;
SQLITE_AUTH { Authorization denied } = 23;
SQLITE_FORMAT { Not used } = 24;
SQLITE_RANGE { 2nd parameter to sqlite3_bind out of range } = 25;
SQLITE_NOTADB { File opened that is not a database file } = 26;
SQLITE_NOTICE { Notifications from sqlite3_log() } = 27;
SQLITE_WARNING { Warnings from sqlite3_log() } = 28;
SQLITE_ROW { sqlite3_step() has another row ready } = 100;
SQLITE_DONE { sqlite3_step() has finished executing } = 101;
{ The SQLITE_ERROR_MISSING_COLLSEQ result code means that an SQL statement
could not be prepared because a collating sequence named in that SQL
statement could not be located.
Sometimes when this error code is encountered, the sqlite3_prepare_v2()
routine will convert the error into SQLITE_ERROR_RETRY and try again to
prepare the SQL statement using a different query plan that does not
require the use of the unknown collating sequence. }
SQLITE_ERROR_MISSING_COLLSEQ = SQLITE_ERROR or (1 shl 8);
{ The SQLITE_ERROR_RETRY is used internally to provoke sqlite3_prepare_v2()
(or one of its sibling routines for creating prepared statements) to try
again to prepare a statement that failed with an error on the previous
attempt. }
SQLITE_ERROR_RETRY = SQLITE_ERROR or (2 shl 8);
{ The SQLITE_ERROR_SNAPSHOT result code might be returned when attempting to
start a read transaction on an historical version of the database by using
the sqlite3_snapshot_open() interface. If the historical snapshot is no
longer available, then the read transaction will fail with the
SQLITE_ERROR_SNAPSHOT. This error code is only possible if SQLite is
compiled with -DSQLITE_ENABLE_SNAPSHOT. }
SQLITE_ERROR_SNAPSHOT = SQLITE_ERROR or (3 shl 8);
{ The SQLITE_IOERR_READ error code is an extended error code for
SQLITE_IOERR indicating an I/O error in the VFS layer while trying to read
from a file on disk. This error might result from a hardware malfunction
or because a filesystem came unmounted while the file was open. }
SQLITE_IOERR_READ = SQLITE_IOERR or (1 shl 8);
{ The SQLITE_IOERR_SHORT_READ error code is an extended error code for
SQLITE_IOERR indicating that a read attempt in the VFS layer was unable to
obtain as many bytes as was requested. This might be due to a truncated
file. }
SQLITE_IOERR_SHORT_READ = SQLITE_IOERR or (2 shl 8);
{ The SQLITE_IOERR_WRITE error code is an extended error code for
SQLITE_IOERR indicating an I/O error in the VFS layer while trying to
write into a file on disk. This error might result from a hardware
malfunction or because a filesystem came unmounted while the file was
open. This error should not occur if the filesystem is full as there is a
separate error code (SQLITE_FULL) for that purpose. }
SQLITE_IOERR_WRITE = SQLITE_IOERR or (3 shl 8);
{ The SQLITE_IOERR_FSYNC error code is an extended error code for
SQLITE_IOERR indicating an I/O error in the VFS layer while trying to
flush previously written content out of OS and/or disk-control buffers and
into persistent storage. In other words, this code indicates a problem
with the fsync() system call in unix or the FlushFileBuffers() system call
in windows. }
SQLITE_IOERR_FSYNC = SQLITE_IOERR or (4 shl 8);
{ The SQLITE_IOERR_DIR_FSYNC error code is an extended error code for
SQLITE_IOERR indicating an I/O error in the VFS layer while trying to
invoke fsync() on a directory. The unix VFS attempts to fsync()
directories after creating or deleting certain files to ensure that those
files will still appear in the filesystem following a power loss or system
crash. This error code indicates a problem attempting to perform that
fsync(). }
SQLITE_IOERR_DIR_FSYNC = SQLITE_IOERR or (5 shl 8);
{ The SQLITE_IOERR_TRUNCATE error code is an extended error code for
SQLITE_IOERR indicating an I/O error in the VFS layer while trying to
truncate a file to a smaller size. }
SQLITE_IOERR_TRUNCATE = SQLITE_IOERR or (6 shl 8);
{ The SQLITE_IOERR_FSTAT error code is an extended error code for
SQLITE_IOERR indicating an I/O error in the VFS layer while trying to
invoke fstat() (or the equivalent) on a file in order to determine
information such as the file size or access permissions. }
SQLITE_IOERR_FSTAT = SQLITE_IOERR or (7 shl 8);
{ The SQLITE_IOERR_UNLOCK error code is an extended error code for
SQLITE_IOERR indicating an I/O error within xUnlock method on the
sqlite3_io_methods object. }
SQLITE_IOERR_UNLOCK = SQLITE_IOERR or (8 shl 8);
{ The SQLITE_IOERR_UNLOCK error code is an extended error code for
SQLITE_IOERR indicating an I/O error within xLock method on the
sqlite3_io_methods object while trying to obtain a read lock. }
SQLITE_IOERR_RDLOCK = SQLITE_IOERR or (9 shl 8);
{ The SQLITE_IOERR_UNLOCK error code is an extended error code for
SQLITE_IOERR indicating an I/O error within xDelete method on the
sqlite3_vfs object. }
SQLITE_IOERR_DELETE = SQLITE_IOERR or (10 shl 8);
{ The SQLITE_IOERR_BLOCKED error code is no longer used. }
SQLITE_IOERR_BLOCKED = SQLITE_IOERR or (11 shl 8);
{ The SQLITE_IOERR_NOMEM error code is sometimes returned by the VFS layer
to indicate that an operation could not be completed due to the inability
to allocate sufficient memory. This error code is normally converted into
SQLITE_NOMEM by the higher layers of SQLite before being returned to the
application. }
SQLITE_IOERR_NOMEM = SQLITE_IOERR or (12 shl 8);
{ The SQLITE_IOERR_ACCESS error code is an extended error code for
SQLITE_IOERR indicating an I/O error within the xAccess method on the
sqlite3_vfs object. }
SQLITE_IOERR_ACCESS = SQLITE_IOERR or (13 shl 8);
{ The SQLITE_IOERR_CHECKRESERVEDLOCK error code is an extended error code
for SQLITE_IOERR indicating an I/O error within the xCheckReservedLock
method on the sqlite3_io_methods object. }
SQLITE_IOERR_CHECKRESERVEDLOCK = SQLITE_IOERR or (14 shl 8);
{ The SQLITE_IOERR_LOCK error code is an extended error code for
SQLITE_IOERR indicating an I/O error in the advisory file locking logic.
Usually an SQLITE_IOERR_LOCK error indicates a problem obtaining a PENDING
lock. However it can also indicate miscellaneous locking errors on some of
the specialized VFSes used on Macs. }
SQLITE_IOERR_LOCK = SQLITE_IOERR or (15 shl 8);
{ The SQLITE_IOERR_ACCESS error code is an extended error code for
SQLITE_IOERR indicating an I/O error within the xClose method on the
sqlite3_io_methods object. }
SQLITE_IOERR_CLOSE = SQLITE_IOERR or (16 shl 8);
{ The SQLITE_IOERR_DIR_CLOSE error code is no longer used. }
SQLITE_IOERR_DIR_CLOSE = SQLITE_IOERR or (17 shl 8);
{ The SQLITE_IOERR_SHMOPEN error code is an extended error code for
SQLITE_IOERR indicating an I/O error within the xShmMap method on the
sqlite3_io_methods object while trying to open a new shared memory
segment. }
SQLITE_IOERR_SHMOPEN = SQLITE_IOERR or (18 shl 8);
{ The SQLITE_IOERR_SHMSIZE error code is an extended error code for
SQLITE_IOERR indicating an I/O error within the xShmMap method on the
sqlite3_io_methods object while trying to enlarge a "shm" file as part of
WAL mode transaction processing. This error may indicate that the
underlying filesystem volume is out of space. }
SQLITE_IOERR_SHMSIZE = SQLITE_IOERR or (19 shl 8);
{ The SQLITE_IOERR_SHMLOCK error code is no longer used. }
SQLITE_IOERR_SHMLOCK = SQLITE_IOERR or (20 shl 8);
{ The SQLITE_IOERR_SHMMAP error code is an extended error code for
SQLITE_IOERR indicating an I/O error within the xShmMap method on the
sqlite3_io_methods object while trying to map a shared memory segment into
the process address space. }
SQLITE_IOERR_SHMMAP = SQLITE_IOERR or (21 shl 8);
{ The SQLITE_IOERR_SEEK error code is an extended error code for
SQLITE_IOERR indicating an I/O error within the xRead or xWrite methods on
the sqlite3_io_methods object while trying to seek a file descriptor to
the beginning point of the file where the read or write is to occur. }
SQLITE_IOERR_SEEK = SQLITE_IOERR or (22 shl 8);
{ The SQLITE_IOERR_DELETE_NOENT error code is an extended error code for
SQLITE_IOERR indicating that the xDelete method on the sqlite3_vfs object
failed because the file being deleted does not exist. }
SQLITE_IOERR_DELETE_NOENT = SQLITE_IOERR or (23 shl 8);
{ The SQLITE_IOERR_MMAP error code is an extended error code for
SQLITE_IOERR indicating an I/O error within the xFetch or xUnfetch methods
on the sqlite3_io_methods object while trying to map or unmap part of the
database file into the process address space. }
SQLITE_IOERR_MMAP = SQLITE_IOERR or (24 shl 8);
{ The SQLITE_IOERR_GETTEMPPATH error code is an extended error code for
SQLITE_IOERR indicating that the VFS is unable to determine a suitable
directory in which to place temporary files. }
SQLITE_IOERR_GETTEMPPATH = SQLITE_IOERR or (25 shl 8);
{ The SQLITE_IOERR_CONVPATH error code is an extended error code for
SQLITE_IOERR used only by Cygwin VFS and indicating that the
cygwin_conv_path() system call failed. See also:
SQLITE_CANTOPEN_CONVPATH. }
SQLITE_IOERR_CONVPATH = SQLITE_IOERR or (26 shl 8);
SQLITE_IOERR_VNODE = SQLITE_IOERR or (27 shl 8);
SQLITE_IOERR_AUTH = SQLITE_IOERR or (28 shl 8);
SQLITE_IOERR_BEGIN_ATOMIC = SQLITE_IOERR or (29 shl 8);
SQLITE_IOERR_COMMIT_ATOMIC = SQLITE_IOERR or (30 shl 8);
SQLITE_IOERR_ROLLBACK_ATOMIC = SQLITE_IOERR or (31 shl 8);
SQLITE_IOERR_DATA = SQLITE_IOERR or (32 shl 8);
{ The SQLITE_LOCKED_SHAREDCACHE error code is an extended error code for
SQLITE_LOCKED indicating that the locking conflict has occurred due to
contention with a different database connection that happens to hold a
shared cache with the database connection to which the error was returned.
For example, if the other database connection is holding an exclusive lock
on the database, then the database connection that receives this error
will be unable to read or write any part of the database file unless it
has the read_uncommitted pragma enabled.
The SQLITE_LOCKED_SHARECACHE error code works very much like the
SQLITE_BUSY error code except that SQLITE_LOCKED_SHARECACHE is for
separate database connections that share a cache whereas SQLITE_BUSY is
for the much more common case of separate database connections that do not
share the same cache. Also, the sqlite3_busy_handler() and
sqlite3_busy_timeout() interfaces do not help in resolving
SQLITE_LOCKED_SHAREDCACHE conflicts. }
SQLITE_LOCKED_SHAREDCACHE = SQLITE_LOCKED or (1 shl 8);
{ The SQLITE_LOCKED_VTAB result code is not used by the SQLite core, but it
is available for use by extensions. Virtual table implementations can
return this result code to indicate that they cannot complete the current
operation because of locks held by other threads or processes.
The R-Tree extension returns this result code when an attempt is made to
update the R-Tree while another prepared statement is actively reading the
R-Tree. The update cannot proceed because any change to an R-Tree might
involve reshuffling and rebalancing of nodes, which would disrupt read
cursors, causing some rows to be repeated and other rows to be omitted. }
SQLITE_LOCKED_VTAB = SQLITE_LOCKED or (2 shl 8);
{ The SQLITE_BUSY_RECOVERY error code is an extended error code for
SQLITE_BUSY that indicates that an operation could not continue because
another process is busy recovering a WAL mode database file following a
crash. The SQLITE_BUSY_RECOVERY error code only occurs on WAL mode
databases. }
SQLITE_BUSY_RECOVERY = SQLITE_BUSY or (1 shl 8);
{ The SQLITE_BUSY_SNAPSHOT error code is an extended error code for
SQLITE_BUSY that occurs on WAL mode databases when a database connection
tries to promote a read transaction into a write transaction but finds
that another database connection has already written to the database and
thus invalidated prior reads.
The following scenario illustrates how an SQLITE_BUSY_SNAPSHOT error might
arise:
Process A starts a read transaction on the database and does one or more
SELECT statement. Process A keeps the transaction open.
Process B updates the database, changing values previous read by process
A.
Process A now tries to write to the database. But process A's view of
the database content is now obsolete because process B has modified
the database file after process A read from it. Hence process A gets
an SQLITE_BUSY_SNAPSHOT error. }
SQLITE_BUSY_SNAPSHOT = SQLITE_BUSY or (2 shl 8);
SQLITE_BUSY_TIMEOUT = SQLITE_BUSY or (3 shl 8);
{ The SQLITE_CANTOPEN_NOTEMPDIR error code is no longer used. }
SQLITE_CANTOPEN_NOTEMPDIR = SQLITE_CANTOPEN or (1 shl 8);
{ The SQLITE_CANTOPEN_ISDIR error code is an extended error code for
SQLITE_CANTOPEN indicating that a file open operation failed because the
file is really a directory. }
SQLITE_CANTOPEN_ISDIR = SQLITE_CANTOPEN or (2 shl 8);
{ The SQLITE_CANTOPEN_FULLPATH error code is an extended error code for
SQLITE_CANTOPEN indicating that a file open operation failed because the
operating system was unable to convert the filename into a full pathname.}
SQLITE_CANTOPEN_FULLPATH = SQLITE_CANTOPEN or (3 shl 8);
{ The SQLITE_CANTOPEN_CONVPATH error code is an extended error code for
SQLITE_CANTOPEN used only by Cygwin VFS and indicating that the
cygwin_conv_path() system call failed while trying to open a file. See
also: SQLITE_IOERR_CONVPATH }
SQLITE_CANTOPEN_CONVPATH = SQLITE_CANTOPEN or (4 shl 8);
{ The SQLITE_CANTOPEN_DIRTYWAL result code is not used at this time. }
SQLITE_CANTOPEN_DIRTYWAL = SQLITE_CANTOPEN or (5 shl 8);
SQLITE_CANTOPEN_SYMLINK = SQLITE_CANTOPEN or (6 shl 8);
{ The SQLITE_CORRUPT_VTAB error code is an extended error code for
SQLITE_CORRUPT used by virtual tables. A virtual table might return
SQLITE_CORRUPT_VTAB to indicate that content in the virtual table is
corrupt. }
SQLITE_CORRUPT_VTAB = SQLITE_CORRUPT or (1 shl 8);
{ The SQLITE_CORRUPT_SEQUENCE result code means that the schema of the
sqlite_sequence table is corrupt. The sqlite_sequence table is used to
help implement the AUTOINCREMENT feature. }
SQLITE_CORRUPT_SEQUENCE = SQLITE_CORRUPT or (2 shl 8);
SQLITE_CORRUPT_INDEX = SQLITE_CORRUPT or (3 shl 8);
{ The SQLITE_READONLY_RECOVERY error code is an extended error code for
SQLITE_READONLY. The SQLITE_READONLY_RECOVERY error code indicates that a
WAL mode database cannot be opened because the database file needs to be
recovered and recovery requires write access but only read access is
available. }
SQLITE_READONLY_RECOVERY = SQLITE_READONLY or (1 shl 8);
{ The SQLITE_READONLY_CANTLOCK error code is an extended error code for
SQLITE_READONLY. The SQLITE_READONLY_CANTLOCK error code indicates that
SQLite is unable to obtain a read lock on a WAL mode database because the
shared-memory file associated with that database is read-only. }
SQLITE_READONLY_CANTLOCK = SQLITE_READONLY or (2 shl 8);
{ The SQLITE_READONLY_ROLLBACK error code is an extended error code for
SQLITE_READONLY. The SQLITE_READONLY_ROLLBACK error code indicates that a
database cannot be opened because it has a hot journal that needs to be
rolled back but cannot because the database is readonly. }
SQLITE_READONLY_ROLLBACK = SQLITE_READONLY or (3 shl 8);
{ The SQLITE_READONLY_DBMOVED error code is an extended error code for
SQLITE_READONLY. The SQLITE_READONLY_DBMOVED error code indicates that a
database cannot be modified because the database file has been moved since
it was opened, and so any attempt to modify the database might result in
database corruption if the processes crashes because the rollback journal
would not be correctly named. }
SQLITE_READONLY_DBMOVED = SQLITE_READONLY or (4 shl 8);
{ The SQLITE_READONLY_CANTINIT result code originates in the xShmMap method
of a VFS to indicate that the shared memory region used by WAL mode exists
buts its content is unreliable and unusable by the current process since
the current process does not have write permission on the shared memory
region. (The shared memory region for WAL mode is normally a file with a
"-wal" suffix that is mmapped into the process space. If the current
process does not have write permission on that file, then it cannot write
into shared memory.)
Higher level logic within SQLite will normally intercept the error code
and create a temporary in-memory shared memory region so that the current
process can at least read the content of the database. This result code
should not reach the application interface layer. }
SQLITE_READONLY_CANTINIT = SQLITE_READONLY or (5 shl 8);
{ The SQLITE_READONLY_DIRECTORY result code indicates that the database is
read-only because process does not have permission to create a journal
file in the same directory as the database and the creation of a journal
file is a prerequisite for writing. }
SQLITE_READONLY_DIRECTORY = SQLITE_READONLY or (6 shl 8);
{ The SQLITE_ABORT_ROLLBACK error code is an extended error code for
SQLITE_ABORT indicating that an SQL statement aborted because the
transaction that was active when the SQL statement first started was
rolled back. Pending write operations always fail with this error when a
rollback occurs. A ROLLBACK will cause a pending read operation to fail
only if the schema was changed within the transaction being rolled back. }
SQLITE_ABORT_ROLLBACK = SQLITE_ABORT or (2 shl 8);
{ The SQLITE_CONSTRAINT_CHECK error code is an extended error code for
SQLITE_CONSTRAINT indicating that a CHECK constraint failed. }
SQLITE_CONSTRAINT_CHECK = SQLITE_CONSTRAINT or (1 shl 8);
{ The SQLITE_CONSTRAINT_COMMITHOOK error code is an extended error code for
SQLITE_CONSTRAINT indicating that a commit hook callback returned non-zero
that thus caused the SQL statement to be rolled back. }
SQLITE_CONSTRAINT_COMMITHOOK = SQLITE_CONSTRAINT or (2 shl 8);
{ The SQLITE_CONSTRAINT_FOREIGNKEY error code is an extended error code for
SQLITE_CONSTRAINT indicating that a foreign key constraint failed. }
SQLITE_CONSTRAINT_FOREIGNKEY = SQLITE_CONSTRAINT or (3 shl 8);
{ The SQLITE_CONSTRAINT_FUNCTION error code is not currently used by the
SQLite core. However, this error code is available for use by extension
functions. }
SQLITE_CONSTRAINT_FUNCTION = SQLITE_CONSTRAINT or (4 shl 8);
{ The SQLITE_CONSTRAINT_NOTNULL error code is an extended error code for
SQLITE_CONSTRAINT indicating that a NOT NULL constraint failed. }
SQLITE_CONSTRAINT_NOTNULL = SQLITE_CONSTRAINT or (5 shl 8);
{ The SQLITE_CONSTRAINT_PRIMARYKEY error code is an extended error code for
SQLITE_CONSTRAINT indicating that a PRIMARY KEY constraint failed. }
SQLITE_CONSTRAINT_PRIMARYKEY = SQLITE_CONSTRAINT or (6 shl 8);
{ The SQLITE_CONSTRAINT_TRIGGER error code is an extended error code for
SQLITE_CONSTRAINT indicating that a RAISE function within a trigger fired,
causing the SQL statement to abort. }
SQLITE_CONSTRAINT_TRIGGER = SQLITE_CONSTRAINT or (7 shl 8);
{ The SQLITE_CONSTRAINT_UNIQUE error code is an extended error code for
SQLITE_CONSTRAINT indicating that a UNIQUE constraint failed. }
SQLITE_CONSTRAINT_UNIQUE = SQLITE_CONSTRAINT or (8 shl 8);
{ The SQLITE_CONSTRAINT_VTAB error code is not currently used by the SQLite
core. However, this error code is available for use by application-defined
virtual tables. }
SQLITE_CONSTRAINT_VTAB = SQLITE_CONSTRAINT or (9 shl 8);
{ The SQLITE_CONSTRAINT_ROWID error code is an extended error code for
SQLITE_CONSTRAINT indicating that a rowid is not unique. }
SQLITE_CONSTRAINT_ROWID = SQLITE_CONSTRAINT or (10 shl 8);
SQLITE_CONSTRAINT_PINNED = SQLITE_CONSTRAINT or (11 shl 8);
{ The SQLITE_NOTICE_RECOVER_WAL result code is passed to the callback of
sqlite3_log() when a WAL mode database file is recovered. }
SQLITE_NOTICE_RECOVER_WAL = SQLITE_NOTICE or (1 shl 8);
{ The SQLITE_NOTICE_RECOVER_ROLLBACK result code is passed to the callback
of sqlite3_log() when a hot journal is rolled back. }
SQLITE_NOTICE_RECOVER_ROLLBACK = SQLITE_NOTICE or (2 shl 8);
{ The SQLITE_WARNING_AUTOINDEX result code is passed to the callback of
sqlite3_log() whenever automatic indexing is used. This can serve as a
warning to application designers that the database might benefit from
additional indexes. }
SQLITE_WARNING_AUTOINDEX = SQLITE_WARNING or (1 shl 8);
SQLITE_AUTH_USER = SQLITE_AUTH or (1 shl 8);
{ The sqlite3_load_extension() interface loads an extension into a single
database connection. The default behavior is for that extension to be
automatically unloaded when the database connection closes. However, if
the extension entry point returns SQLITE_OK_LOAD_PERMANENTLY instead of
SQLITE_OK, then the extension remains loaded into the process address
space after the database connection closes. In other words, the xDlClose
methods of the sqlite3_vfs object is not called for the extension when the
database connection closes.
The SQLITE_OK_LOAD_PERMANENTLY return code is useful to loadable
extensions that register new VFSes, for example. }
SQLITE_OK_LOAD_PERMANENTLY = SQLITE_OK or (1 shl 8);
SQLITE_OK_SYMLINK = SQLITE_OK or (2 shl 8);
{ Flags For File Open Operations
These bit values are intended for use in the 3rd parameter to the
sqlite3_open_v2() interface and in the 4th parameter to the
sqlite3_vfs.xOpen method. }
SQLITE_OPEN_READONLY { Ok for sqlite3_open_v2() } = $00000001;
SQLITE_OPEN_READWRITE { Ok for sqlite3_open_v2() } = $00000002;
SQLITE_OPEN_CREATE { Ok for sqlite3_open_v2() } = $00000004;
SQLITE_OPEN_DELETEONCLOSE { VFS only } = $00000008;
SQLITE_OPEN_EXCLUSIVE { VFS only } = $00000010;
SQLITE_OPEN_AUTOPROXY { VFS only } = $00000020;
SQLITE_OPEN_URI { Ok for sqlite3_open_v2() } = $00000040;
SQLITE_OPEN_MEMORY { Ok for sqlite3_open_v2() } = $00000080;
SQLITE_OPEN_MAIN_DB { VFS only } = $00000100;
SQLITE_OPEN_TEMP_DB { VFS only } = $00000200;
SQLITE_OPEN_TRANSIENT_DB { VFS only } = $00000400;
SQLITE_OPEN_MAIN_JOURNAL { VFS only } = $00000800;
SQLITE_OPEN_TEMP_JOURNAL { VFS only } = $00001000;
SQLITE_OPEN_SUBJOURNAL { VFS only } = $00002000;
SQLITE_OPEN_SUPER_JOURNAL { VFS only } = $00004000;
SQLITE_OPEN_NOMUTEX { Ok for sqlite3_open_v2() } = $00008000;
SQLITE_OPEN_FULLMUTEX { Ok for sqlite3_open_v2() } = $00010000;
SQLITE_OPEN_SHAREDCACHE { Ok for sqlite3_open_v2() } = $00020000;
SQLITE_OPEN_PRIVATECACHE { Ok for sqlite3_open_v2() } = $00040000;
SQLITE_OPEN_WAL { VFS only } = $00080000;
SQLITE_OPEN_NOFOLLOW { Ok for sqlite3_open_v2() } = $01000000;
{ Legacy compatibility: }
SQLITE_OPEN_MASTER_JOURNAL { VFS only } = $00004000;
{ The xDeviceCharacteristics method of the sqlite3_io_methods object returns
an integer which is a vector of these bit values expressing I/O
characteristics of the mass storage device that holds the file that the
sqlite3_io_methods refers to.
The SQLITE_IOCAP_ATOMIC property means that all writes of any size are
atomic. The SQLITE_IOCAP_ATOMICnnn values mean that writes of blocks that
are nnn bytes in size and are aligned to an address which is an integer
multiple of nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means that
when data is appended to a file, the data is appended first then the size of
the file is extended, never the other way around. The
SQLITE_IOCAP_SEQUENTIAL property means that information is written to disk
in the same order as calls to xWrite(). The SQLITE_IOCAP_POWERSAFE_OVERWRITE
property means that after reboot following a crash or power loss, the only
bytes in a file that were written at the application level might have
changed and that adjacent bytes, even bytes within the same sector are
guaranteed to be unchanged. The SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN flag
indicates that a file cannot be deleted when open. The
SQLITE_IOCAP_IMMUTABLE flag indicates that the file is on read-only media
and cannot be changed even by processes with elevated privileges.
The SQLITE_IOCAP_BATCH_ATOMIC property means that the underlying filesystem
supports doing multiple write operations atomically when those write
operations are bracketed by SQLITE_FCNTL_BEGIN_ATOMIC_WRITE and
SQLITE_FCNTL_COMMIT_ATOMIC_WRITE. }
SQLITE_IOCAP_ATOMIC = $00000001;
SQLITE_IOCAP_ATOMIC512 = $00000002;
SQLITE_IOCAP_ATOMIC1K = $00000004;
SQLITE_IOCAP_ATOMIC2K = $00000008;
SQLITE_IOCAP_ATOMIC4K = $00000010;
SQLITE_IOCAP_ATOMIC8K = $00000020;
SQLITE_IOCAP_ATOMIC16K = $00000040;
SQLITE_IOCAP_ATOMIC32K = $00000080;
SQLITE_IOCAP_ATOMIC64K = $00000100;
SQLITE_IOCAP_SAFE_APPEND = $00000200;
SQLITE_IOCAP_SEQUENTIAL = $00000400;
SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN = $00000800;
SQLITE_IOCAP_POWERSAFE_OVERWRITE = $00001000;
SQLITE_IOCAP_IMMUTABLE = $00002000;
SQLITE_IOCAP_BATCH_ATOMIC = $00004000;
{ SQLite uses one of these integer values as the second argument to calls it
makes to the xLock() and xUnlock() methods of an sqlite3_io_methods object.}
SQLITE_LOCK_NONE = 0;
SQLITE_LOCK_SHARED = 1;
SQLITE_LOCK_RESERVED = 2;
SQLITE_LOCK_PENDING = 3;
SQLITE_LOCK_EXCLUSIVE = 4;
{ When SQLite invokes the xSync() method of an sqlite3_io_methods object it
uses a combination of these integer values as the second argument.
When the SQLITE_SYNC_DATAONLY flag is used, it means that the sync operation
only needs to flush data to mass storage. Inode information need not be
flushed. If the lower four bits of the flag equal SQLITE_SYNC_NORMAL, that
means to use normal fsync() semantics. If the lower four bits equal
SQLITE_SYNC_FULL, that means to use Mac OS X style fullsync instead of
fsync().
Do not confuse the SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags with the
PRAGMA synchronous=NORMAL and PRAGMA synchronous=FULL settings. The
synchronous pragma determines when calls to the xSync VFS method occur and
applies uniformly across all platforms. The SQLITE_SYNC_NORMAL and
SQLITE_SYNC_FULL flags determine how energetic or rigorous or forceful the
sync operations are and only make a difference on Mac OSX for the default
SQLite code. (Third-party VFS implementations might also make the
distinction between SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL, but among the
operating systems natively supported by SQLite, only Mac OSX cares about the
difference.) }
SQLITE_SYNC_NORMAL = $00002;
SQLITE_SYNC_FULL = $00003;
SQLITE_SYNC_DATAONLY = $00010;
{ Standard File Control Opcodes }
{ The SQLITE_FCNTL_LOCKSTATE opcode is used for debugging. This opcode causes
the xFileControl method to write the current state of the lock (one of
SQLITE_LOCK_NONE, SQLITE_LOCK_SHARED, SQLITE_LOCK_RESERVED,
SQLITE_LOCK_PENDING, or SQLITE_LOCK_EXCLUSIVE) into an integer that the pArg
argument points to. This capability is used during testing and is only
available when the SQLITE_TEST compile-time option is used. }
SQLITE_FCNTL_LOCKSTATE = 1;
SQLITE_FCNTL_GET_LOCKPROXYFILE = 2;
SQLITE_FCNTL_SET_LOCKPROXYFILE = 3;
SQLITE_FCNTL_LAST_ERRNO = 4;
{ The SQLITE_FCNTL_SIZE_HINT opcode is used by SQLite to give the VFS layer a
hint of how large the database file will grow to be during the current
transaction. This hint is not guaranteed to be accurate but it is often
close. The underlying VFS might choose to preallocate database file space
based on this hint in order to help writes to the database file run faster.}
SQLITE_FCNTL_SIZE_HINT = 5;
{ The SQLITE_FCNTL_CHUNK_SIZE opcode is used to request that the VFS extends
and truncates the database file in chunks of a size specified by the user.
The fourth argument to sqlite3_file_control() should point to an integer
(type int) containing the new chunk-size to use for the nominated database.
Allocating database file space in large chunks (say 1MB at a time), may
reduce file-system fragmentation and improve performance on some systems. }
SQLITE_FCNTL_CHUNK_SIZE = 6;
{ The SQLITE_FCNTL_FILE_POINTER opcode is used to obtain a pointer to the
sqlite3_file object associated with a particular database connection. See
also SQLITE_FCNTL_JOURNAL_POINTER. }
SQLITE_FCNTL_FILE_POINTER = 7;
SQLITE_FCNTL_SYNC_OMITTED = 8;
{ The SQLITE_FCNTL_WIN32_AV_RETRY opcode is used to configure automatic retry
counts and intervals for certain disk I/O operations for the windows VFS in
order to provide robustness in the presence of anti-virus programs. By
default, the windows VFS will retry file read, file write, and file delete
operations up to 10 times, with a delay of 25 milliseconds before the first
retry and with the delay increasing by an additional 25 milliseconds with
each subsequent retry. This opcode allows these two values (10 retries and
25 milliseconds of delay) to be adjusted. The values are changed for all
database connections within the same process. The argument is a pointer to
an array of two integers where the first integer is the new retry count and
the second integer is the delay. If either integer is negative, then the
setting is not changed but instead the prior value of that setting is
written into the array entry, allowing the current retry settings to be
interrogated. The zDbName parameter is ignored. }
SQLITE_FCNTL_WIN32_AV_RETRY = 9;
{ The SQLITE_FCNTL_PERSIST_WAL opcode is used to set or query the persistent.
Write Ahead Log setting. By default, the auxiliary write ahead log (WAL
file) and shared memory files used for transaction control are automatically
deleted when the latest connection to the database closes. Setting
persistent WAL mode causes those files to persist after close. Persisting
the files is useful when other processes that do not have write permission
on the directory containing the database file want to read the database
file, as the WAL and shared memory files must exist in order for the
database to be readable. The fourth parameter to sqlite3_file_control() for
this opcode should be a pointer to an integer. That integer is 0 to disable
persistent WAL mode or 1 to enable persistent WAL mode. If the integer is
-1, then it is overwritten with the current WAL persistence setting. }
SQLITE_FCNTL_PERSIST_WAL = 10;
{ The SQLITE_FCNTL_OVERWRITE opcode is invoked by SQLite after opening a write
transaction to indicate that, unless it is rolled back for some reason, the
entire database file will be overwritten by the current transaction. This is
used by VACUUM operations. }
SQLITE_FCNTL_OVERWRITE = 11;
{ The SQLITE_FCNTL_VFSNAME opcode can be used to obtain the names of all VFSes
in the VFS stack. The names are of all VFS shims and the final bottom-level
VFS are written into memory obtained from sqlite3_malloc() and the result is
stored in the char* variable that the fourth parameter of
sqlite3_file_control() points to. The caller is responsible for freeing the
memory when done. As with all file-control actions, there is no guarantee
that this will actually do anything. Callers should initialize the char*
variable to a NULL pointer in case this file-control is not implemented.
This file-control is intended for diagnostic use only. }
SQLITE_FCNTL_VFSNAME = 12;
{ The SQLITE_FCNTL_POWERSAFE_OVERWRITE opcode is used to set or query the
persistent "powersafe-overwrite" or "PSOW" setting. The PSOW setting
determines the SQLITE_IOCAP_POWERSAFE_OVERWRITE bit of the
xDeviceCharacteristics methods. The fourth parameter to
sqlite3_file_control() for this opcode should be a pointer to an integer.
That integer is 0 to disable zero-damage mode or 1 to enable zero-damage
mode. If the integer is -1, then it is overwritten with the current
zero-damage mode setting. }
SQLITE_FCNTL_POWERSAFE_OVERWRITE = 13;
{ Whenever a PRAGMA statement is parsed, an SQLITE_FCNTL_PRAGMA file control
is sent to the open sqlite3_file object corresponding to the database file
to which the pragma statement refers. The argument to the
SQLITE_FCNTL_PRAGMA file control is an array of pointers to strings (char**)
in which the second element of the array is the name of the pragma and the
third element is the argument to the pragma or NULL if the pragma has no
argument. The handler for an SQLITE_FCNTL_PRAGMA file control can optionally
make the first element of the char** argument point to a string obtained
from sqlite3_mprintf() or the equivalent and that string will become the
result of the pragma or the error message if the pragma fails. If the
SQLITE_FCNTL_PRAGMA file control returns SQLITE_NOTFOUND, then normal PRAGMA
processing continues. If the SQLITE_FCNTL_PRAGMA file control returns
SQLITE_OK, then the parser assumes that the VFS has handled the PRAGMA
itself and the parser generates a no-op prepared statement if result string
is NULL, or that returns a copy of the result string if the string is
non-NULL. If the SQLITE_FCNTL_PRAGMA file control returns any result code
other than SQLITE_OK or SQLITE_NOTFOUND, that means that the VFS encountered
an error while handling the PRAGMA and the compilation of the PRAGMA fails
with an error. The SQLITE_FCNTL_PRAGMA file control occurs at the beginning
of pragma statement analysis and so it is able to override built-in PRAGMA
statements. }
SQLITE_FCNTL_PRAGMA = 14;
{ The SQLITE_FCNTL_BUSYHANDLER file-control may be invoked by SQLite on the
database file handle shortly after it is opened in order to provide a custom
VFS with access to the connection's busy-handler callback. The argument is
of type (void**) - an array of two (void *) values. The first (void *)
actually points to a function of type (int (*)(void *)). In order to invoke
the connection's busy-handler, this function should be invoked with the
second (void *) in the array as the only argument. If it returns non-zero,
then the operation should be retried. If it returns zero, the custom VFS
should abandon the current operation. }
SQLITE_FCNTL_BUSYHANDLER = 15;
{ Applications can invoke the SQLITE_FCNTL_TEMPFILENAME file-control to have
SQLite generate a temporary filename using the same algorithm that is
followed to generate temporary filenames for TEMP tables and other internal
uses. The argument should be a char** which will be filled with the filename
written into memory obtained from sqlite3_malloc(). The caller should invoke
sqlite3_free() on the result to avoid a memory leak. }
SQLITE_FCNTL_TEMPFILENAME = 16;
{ The SQLITE_FCNTL_MMAP_SIZE file control is used to query or set the maximum
number of bytes that will be used for memory-mapped I/O. The argument is a
pointer to a value of type sqlite3_int64 that is an advisory maximum number
of bytes in the file to memory map. The pointer is overwritten with the old
value. The limit is not changed if the value originally pointed to is
negative, and so the current limit can be queried by passing in a pointer to
a negative number. This file-control is used internally to implement PRAGMA
mmap_size. }
SQLITE_FCNTL_MMAP_SIZE = 18;
{ The SQLITE_FCNTL_TRACE file control provides advisory information to the VFS
about what the higher layers of the SQLite stack are doing. This file
control is used by some VFS activity tracing shims. The argument is a
zero-terminated string. Higher layers in the SQLite stack may generate
instances of this file control if the SQLITE_USE_FCNTL_TRACE compile-time
option is enabled. }
SQLITE_FCNTL_TRACE = 19;
{ The SQLITE_FCNTL_HAS_MOVED file control interprets its argument as a pointer
to an integer and it writes a boolean into that integer depending on whether
or not the file has been renamed, moved, or deleted since it was first
opened. }
SQLITE_FCNTL_HAS_MOVED = 20;
{ The SQLITE_FCNTL_SYNC opcode is generated internally by SQLite and sent to
the VFS immediately before the xSync method is invoked on a database file
descriptor. Or, if the xSync method is not invoked because the user has
configured SQLite with PRAGMA synchronous=OFF it is invoked in place of the
xSync method. In most cases, the pointer argument passed with this
file-control is NULL. However, if the database file is being synced as part
of a multi-database commit, the argument points to a nul-terminated string
containing the transactions super-journal file name. VFSes that do not need
this signal should silently ignore this opcode. Applications should not call
sqlite3_file_control() with this opcode as doing so may disrupt the
operation of the specialized VFSes that do require it. }
SQLITE_FCNTL_SYNC = 21;
{ The SQLITE_FCNTL_COMMIT_PHASETWO opcode is generated internally by SQLite
and sent to the VFS after a transaction has been committed immediately but
before the database is unlocked. VFSes that do not need this signal should
silently ignore this opcode. Applications should not call
sqlite3_file_control() with this opcode as doing so may disrupt the
operation of the specialized VFSes that do require it. }
SQLITE_FCNTL_COMMIT_PHASETWO = 22;
{ The SQLITE_FCNTL_WIN32_SET_HANDLE opcode is used for debugging. This opcode
causes the xFileControl method to swap the file handle with the one pointed
to by the pArg argument. This capability is used during testing and only
needs to be supported when SQLITE_TEST is defined. }
SQLITE_FCNTL_WIN32_SET_HANDLE = 23;
{ The SQLITE_FCNTL_WAL_BLOCK is a signal to the VFS layer that it might be
advantageous to block on the next WAL lock if the lock is not immediately
available. The WAL subsystem issues this signal during rare circumstances in
order to fix a problem with priority inversion. Applications should not use
this file-control. }
SQLITE_FCNTL_WAL_BLOCK = 24;
{ The SQLITE_FCNTL_ZIPVFS opcode is implemented by zipvfs only. All other VFS
should return SQLITE_NOTFOUND for this opcode. }
SQLITE_FCNTL_ZIPVFS = 25;
{ The SQLITE_FCNTL_RBU opcode is implemented by the special VFS used by the
RBU extension only. All other VFS should return SQLITE_NOTFOUND for this
opcode. }
SQLITE_FCNTL_RBU = 26;
{ The SQLITE_FCNTL_VFS_POINTER opcode finds a pointer to the top-level VFSes
currently in use. The argument X in
sqlite3_file_control(db,SQLITE_FCNTL_VFS_POINTER,X) must be of type
"sqlite3_vfs **". This opcodes will set *X to a pointer to the top-level
VFS. When there are multiple VFS shims in the stack, this opcode finds the
upper-most shim only. }
SQLITE_FCNTL_VFS_POINTER = 27;
{ The SQLITE_FCNTL_JOURNAL_POINTER opcode is used to obtain a pointer to the
sqlite3_file object associated with the journal file (either the rollback
journal or the write-ahead log) for a particular database connection. See
also SQLITE_FCNTL_FILE_POINTER. }
SQLITE_FCNTL_JOURNAL_POINTER = 28;
{ The SQLITE_FCNTL_WIN32_GET_HANDLE opcode can be used to obtain the
underlying native file handle associated with a file handle. This file
control interprets its argument as a pointer to a native file handle and
writes the resulting value there. }
SQLITE_FCNTL_WIN32_GET_HANDLE = 29;
SQLITE_FCNTL_PDB = 30;
{ If the SQLITE_FCNTL_BEGIN_ATOMIC_WRITE opcode returns SQLITE_OK, then the
file descriptor is placed in "batch write mode", which means all subsequent
write operations will be deferred and done atomically at the next
SQLITE_FCNTL_COMMIT_ATOMIC_WRITE. Systems that do not support batch atomic
writes will return SQLITE_NOTFOUND. Following a successful
SQLITE_FCNTL_BEGIN_ATOMIC_WRITE and prior to the closing
SQLITE_FCNTL_COMMIT_ATOMIC_WRITE or SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE,
SQLite will make no VFS interface calls on the same sqlite3_file file
descriptor except for calls to the xWrite method and the xFileControl method
with SQLITE_FCNTL_SIZE_HINT. }
SQLITE_FCNTL_BEGIN_ATOMIC_WRITE = 31;
{ The SQLITE_FCNTL_COMMIT_ATOMIC_WRITE opcode causes all write operations
since the previous successful call to SQLITE_FCNTL_BEGIN_ATOMIC_WRITE to be
performed atomically. This file control returns SQLITE_OK if and only if the
writes were all performed successfully and have been committed to persistent
storage. Regardless of whether or not it is successful, this file control
takes the file descriptor out of batch write mode so that all subsequent
write operations are independent. SQLite will never invoke
SQLITE_FCNTL_COMMIT_ATOMIC_WRITE without a prior successful call to
SQLITE_FCNTL_BEGIN_ATOMIC_WRITE. }
SQLITE_FCNTL_COMMIT_ATOMIC_WRITE = 32;
{ The SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE opcode causes all write operations
since the previous successful call to SQLITE_FCNTL_BEGIN_ATOMIC_WRITE to be
rolled back. This file control takes the file descriptor out of batch write
mode so that all subsequent write operations are independent. SQLite will
never invoke SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE without a prior successful
call to SQLITE_FCNTL_BEGIN_ATOMIC_WRITE. }
SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE = 33;
{ The SQLITE_FCNTL_LOCK_TIMEOUT opcode is used to configure a VFS to block for
up to M milliseconds before failing when attempting to obtain a file lock
using the xLock or xShmLock methods of the VFS. The parameter is a pointer
to a 32-bit signed integer that contains the value that M is to be set to.
Before returning, the 32-bit signed integer is overwritten with the previous
value of M. }
SQLITE_FCNTL_LOCK_TIMEOUT = 34;
{ The SQLITE_FCNTL_DATA_VERSION opcode is used to detect changes to a database
file. The argument is a pointer to a 32-bit unsigned integer. The "data
version" for the pager is written into the pointer. The "data version"
changes whenever any change occurs to the corresponding database file,
either through SQL statements on the same database connection or through
transactions committed by separate database connections possibly in other
processes. The sqlite3_total_changes() interface can be used to find if any
database on the connection has changed, but that interface responds to
changes on TEMP as well as MAIN and does not provide a mechanism to detect
changes to MAIN only. Also, the sqlite3_total_changes() interface responds
to internal changes only and omits changes made by other database
connections. The PRAGMA data_version command provides a mechanism to detect
changes to a single attached database that occur due to other database
connections, but omits changes implemented by the database connection on
which it is called. This file control is the only mechanism to detect
changes that happen either internally or externally and that are associated
with a particular attached database. }
SQLITE_FCNTL_DATA_VERSION = 35;
{ The SQLITE_FCNTL_SIZE_LIMIT opcode is used by in-memory VFS that implements
sqlite3_deserialize() to set an upper bound on the size of the in-memory
database. The argument is a pointer to a sqlite3_int64. If the integer
pointed to is negative, then it is filled in with the current limit.
Otherwise the limit is set to the larger of the value of the integer pointed
to and the current database size. The integer pointed to is set to the new
limit. }
SQLITE_FCNTL_SIZE_LIMIT = 36;
{ The SQLITE_FCNTL_CKPT_DONE opcode is invoked from within a checkpoint in wal
mode after the client has finished copying pages from the wal file to the
database file, but before the *-shm file is updated to record the fact that
the pages have been checkpointed. }
SQLITE_FCNTL_CKPT_DONE = 37;
SQLITE_FCNTL_RESERVE_BYTES = 38;
{ The SQLITE_FCNTL_CKPT_START opcode is invoked from within a checkpoint in
wal mode before the client starts to copy pages from the wal file to the
database file. }
SQLITE_FCNTL_CKPT_START = 39;
{ deprecated names }
SQLITE_GET_LOCKPROXYFILE = SQLITE_FCNTL_GET_LOCKPROXYFILE;
SQLITE_SET_LOCKPROXYFILE = SQLITE_FCNTL_SET_LOCKPROXYFILE;
SQLITE_LAST_ERRNO = SQLITE_FCNTL_LAST_ERRNO;
{ These integer constants can be used as the third parameter to the xAccess
method of an sqlite3_vfs object. They determine what kind of permissions the
xAccess method is looking for. With SQLITE_ACCESS_EXISTS, the xAccess method
simply checks whether the file exists. With SQLITE_ACCESS_READWRITE, the
xAccess method checks whether the named directory is both readable and
writable (in other words, if files can be added, removed, and renamed within
the directory). The SQLITE_ACCESS_READWRITE constant is currently used only
by the temp_store_directory pragma, though this could change in a future
release of SQLite. With SQLITE_ACCESS_READ, the xAccess method checks
whether the file is readable. The SQLITE_ACCESS_READ constant is currently
unused, though it might be used in a future release of SQLite. }
SQLITE_ACCESS_EXISTS = 0;
SQLITE_ACCESS_READWRITE { Used by PRAGMA temp_store_directory } = 1;
SQLITE_ACCESS_READ { Unused } = 2;
{ These integer constants define the various locking operations allowed by the
xShmLock method of sqlite3_io_methods.
When unlocking, the same SHARED or EXCLUSIVE flag must be supplied as was
given on the corresponding lock.
The xShmLock method can transition between unlocked and SHARED or between
unlocked and EXCLUSIVE. It cannot transition between SHARED and EXCLUSIVE. }
SQLITE_SHM_UNLOCK = 1;
SQLITE_SHM_LOCK = 2;
SQLITE_SHM_SHARED = 4;
SQLITE_SHM_EXCLUSIVE = 8;
{ The xShmLock method on sqlite3_io_methods may use values between 0 and this
upper bound as its "offset" argument. The SQLite core will never attempt to
acquire or release a lock outside of this range. }
SQLITE_SHM_NLOCK = 8;
{ These constants are the available integer configuration options that can be
passed as the first argument to the sqlite3_config() interface.
New configuration options may be added in future releases of SQLite.
Existing configuration options might be discontinued. Applications should
check the return code from sqlite3_config() to make sure that the call
worked. The sqlite3_config() interface will return a non-zero error code if
a discontinued or unsupported configuration option is invoked. }
{ There are no arguments to this option. This option sets the threading mode
to Single-thread. In other words, it disables all mutexing and puts SQLite
into a mode where it can only be used by a single thread. If SQLite is
compiled with the SQLITE_THREADSAFE=0 compile-time option then it is not
possible to change the threading mode from its default value of
Single-thread and so sqlite3_config() will return SQLITE_ERROR if called
with the SQLITE_CONFIG_SINGLETHREAD configuration option. }
SQLITE_CONFIG_SINGLETHREAD { nil } = 1;
{ There are no arguments to this option. This option sets the threading mode
to Multi-thread. In other words, it disables mutexing on database connection
and prepared statement objects. The application is responsible for
serializing access to database connections and prepared statements. But
other mutexes are enabled so that SQLite will be safe to use in a
multi-threaded environment as long as no two threads attempt to use the same
database connection at the same time. If SQLite is compiled with the
SQLITE_THREADSAFE=0 compile-time option then it is not possible to set the
Multi-thread threading mode and sqlite3_config() will return SQLITE_ERROR if
called with the SQLITE_CONFIG_MULTITHREAD configuration option. }
SQLITE_CONFIG_MULTITHREAD { nil } = 2;
{ There are no arguments to this option. This option sets the threading mode
to Serialized. In other words, this option enables all mutexes including the
recursive mutexes on database connection and prepared statement objects. In
this mode (which is the default when SQLite is compiled with
SQLITE_THREADSAFE=1) the SQLite library will itself serialize access to
database connections and prepared statements so that the application is free
to use the same database connection or the same prepared statement in
different threads at the same time. If SQLite is compiled with the
SQLITE_THREADSAFE=0 compile-time option then it is not possible to set the
Serialized threading mode and sqlite3_config() will return SQLITE_ERROR if
called with the SQLITE_CONFIG_SERIALIZED configuration option. }
SQLITE_CONFIG_SERIALIZED { nil } = 3;
{ The SQLITE_CONFIG_MALLOC option takes a single argument which is a pointer
to an instance of the sqlite3_mem_methods structure. The argument specifies
alternative low-level memory allocation routines to be used in place of the
memory allocation routines built into SQLite. SQLite makes its own private
copy of the content of the sqlite3_mem_methods structure before the
sqlite3_config() call returns. }
SQLITE_CONFIG_MALLOC { psqlite3_mem_methods } = 4;
{ The SQLITE_CONFIG_GETMALLOC option takes a single argument which is a
pointer to an instance of the sqlite3_mem_methods structure. The
sqlite3_mem_methods structure is filled with the currently defined memory
allocation routines. This option can be used to overload the default memory
allocation routines with a wrapper that simulations memory allocation
failure or tracks memory usage, for example. }
SQLITE_CONFIG_GETMALLOC { psqlite3_mem_methods } = 5;