amalgalite 1.9.1-x86-mingw32 → 2.0.0-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/HISTORY.md +26 -0
- data/Manifest.txt +4 -54
- data/README.md +1 -1
- data/TODO.md +4 -3
- data/amalgalite.gemspec +39 -0
- data/ext/amalgalite/c/amalgalite.c +0 -1
- data/ext/amalgalite/c/amalgalite_constants.c +155 -10
- data/ext/amalgalite/c/extconf.rb +5 -2
- data/ext/amalgalite/c/gen_constants.rb +32 -1
- data/ext/amalgalite/c/sqlite3.c +33715 -13095
- data/ext/amalgalite/c/sqlite3.h +1387 -389
- data/ext/amalgalite/c/sqlite3ext.h +21 -0
- data/lib/amalgalite/2.7/amalgalite.so +0 -0
- data/lib/amalgalite/3.0/amalgalite.so +0 -0
- data/lib/amalgalite/3.1/amalgalite.so +0 -0
- data/lib/amalgalite/3.2/amalgalite.so +0 -0
- data/lib/amalgalite/3.3/amalgalite.so +0 -0
- data/lib/amalgalite/3.4/amalgalite.so +0 -0
- data/lib/amalgalite/column.rb +20 -2
- data/lib/amalgalite/result/row.rb +83 -0
- data/lib/amalgalite/result.rb +15 -0
- data/lib/amalgalite/statement.rb +32 -24
- data/lib/amalgalite/type_maps/default_map.rb +48 -56
- data/lib/amalgalite/version.rb +1 -1
- metadata +36 -123
- data/Rakefile +0 -27
- data/bin/amalgalite-pack +0 -147
- data/examples/a.rb +0 -9
- data/examples/blob.rb +0 -88
- data/examples/bootstrap.rb +0 -36
- data/examples/define_aggregate.rb +0 -75
- data/examples/define_function.rb +0 -104
- data/examples/fts5.rb +0 -152
- data/examples/gem-db.rb +0 -94
- data/examples/require_me.rb +0 -11
- data/examples/requires.rb +0 -42
- data/examples/schema-info.rb +0 -34
- data/ext/amalgalite/c/amalgalite_requires_bootstrap.c +0 -283
- data/lib/amalgalite/2.4/amalgalite.so +0 -0
- data/lib/amalgalite/2.5/amalgalite.so +0 -0
- data/lib/amalgalite/2.6/amalgalite.so +0 -0
- data/lib/amalgalite/core_ext/kernel/require.rb +0 -21
- data/lib/amalgalite/packer.rb +0 -231
- data/lib/amalgalite/requires.rb +0 -151
- data/spec/aggregate_spec.rb +0 -158
- data/spec/amalgalite_spec.rb +0 -4
- data/spec/blob_spec.rb +0 -78
- data/spec/boolean_spec.rb +0 -24
- data/spec/busy_handler.rb +0 -157
- data/spec/data/iso-3166-country.txt +0 -242
- data/spec/data/iso-3166-schema.sql +0 -22
- data/spec/data/iso-3166-subcountry.txt +0 -3995
- data/spec/data/make-iso-db.sh +0 -12
- data/spec/database_spec.rb +0 -505
- data/spec/default_map_spec.rb +0 -92
- data/spec/function_spec.rb +0 -78
- data/spec/integeration_spec.rb +0 -97
- data/spec/iso_3166_database.rb +0 -58
- data/spec/json_spec.rb +0 -24
- data/spec/packer_spec.rb +0 -60
- data/spec/paths_spec.rb +0 -28
- data/spec/progress_handler_spec.rb +0 -91
- data/spec/requires_spec.rb +0 -54
- data/spec/rtree_spec.rb +0 -66
- data/spec/schema_spec.rb +0 -131
- data/spec/spec_helper.rb +0 -48
- data/spec/sqlite3/constants_spec.rb +0 -108
- data/spec/sqlite3/database_status_spec.rb +0 -36
- data/spec/sqlite3/status_spec.rb +0 -22
- data/spec/sqlite3/version_spec.rb +0 -28
- data/spec/sqlite3_spec.rb +0 -53
- data/spec/statement_spec.rb +0 -168
- data/spec/storage_map_spec.rb +0 -38
- data/spec/tap_spec.rb +0 -57
- data/spec/text_map_spec.rb +0 -20
- data/spec/type_map_spec.rb +0 -14
- data/spec/version_spec.rb +0 -8
- data/tasks/custom.rake +0 -101
- data/tasks/default.rake +0 -257
- data/tasks/extension.rake +0 -28
- data/tasks/this.rb +0 -208
- /data/{LICENSE → LICENSE.txt} +0 -0
data/ext/amalgalite/c/sqlite3.h
CHANGED
|
@@ -133,7 +133,7 @@ extern "C" {
|
|
|
133
133
|
**
|
|
134
134
|
** Since [version 3.6.18] ([dateof:3.6.18]),
|
|
135
135
|
** SQLite source code has been stored in the
|
|
136
|
-
** <a href="http://
|
|
136
|
+
** <a href="http://fossil-scm.org/">Fossil configuration management
|
|
137
137
|
** system</a>. ^The SQLITE_SOURCE_ID macro evaluates to
|
|
138
138
|
** a string which identifies a particular check-in of SQLite
|
|
139
139
|
** within its configuration management system. ^The SQLITE_SOURCE_ID
|
|
@@ -146,9 +146,12 @@ extern "C" {
|
|
|
146
146
|
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
|
147
147
|
** [sqlite_version()] and [sqlite_source_id()].
|
|
148
148
|
*/
|
|
149
|
-
#define SQLITE_VERSION "3.
|
|
150
|
-
#define SQLITE_VERSION_NUMBER
|
|
151
|
-
#define SQLITE_SOURCE_ID "
|
|
149
|
+
#define SQLITE_VERSION "3.51.0"
|
|
150
|
+
#define SQLITE_VERSION_NUMBER 3051000
|
|
151
|
+
#define SQLITE_SOURCE_ID "2025-11-04 19:38:17 fb2c931ae597f8d00a37574ff67aeed3eced4e5547f9120744ae4bfa8e74527b"
|
|
152
|
+
#define SQLITE_SCM_BRANCH "trunk"
|
|
153
|
+
#define SQLITE_SCM_TAGS "release major-release version-3.51.0"
|
|
154
|
+
#define SQLITE_SCM_DATETIME "2025-11-04T19:38:17.314Z"
|
|
152
155
|
|
|
153
156
|
/*
|
|
154
157
|
** CAPI3REF: Run-Time Library Version Numbers
|
|
@@ -168,9 +171,9 @@ extern "C" {
|
|
|
168
171
|
** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 );
|
|
169
172
|
** </pre></blockquote>)^
|
|
170
173
|
**
|
|
171
|
-
** ^The sqlite3_version[] string constant contains the text of
|
|
172
|
-
** macro. ^The sqlite3_libversion() function returns a
|
|
173
|
-
** to the sqlite3_version[] string constant. The sqlite3_libversion()
|
|
174
|
+
** ^The sqlite3_version[] string constant contains the text of the
|
|
175
|
+
** [SQLITE_VERSION] macro. ^The sqlite3_libversion() function returns a
|
|
176
|
+
** pointer to the sqlite3_version[] string constant. The sqlite3_libversion()
|
|
174
177
|
** function is provided for use in DLLs since DLL users usually do not have
|
|
175
178
|
** direct access to string constants within the DLL. ^The
|
|
176
179
|
** sqlite3_libversion_number() function returns an integer equal to
|
|
@@ -370,7 +373,7 @@ typedef int (*sqlite3_callback)(void*,int,char**, char**);
|
|
|
370
373
|
** without having to use a lot of C code.
|
|
371
374
|
**
|
|
372
375
|
** ^The sqlite3_exec() interface runs zero or more UTF-8 encoded,
|
|
373
|
-
** semicolon-
|
|
376
|
+
** semicolon-separated SQL statements passed into its 2nd argument,
|
|
374
377
|
** in the context of the [database connection] passed in as its 1st
|
|
375
378
|
** argument. ^If the callback function of the 3rd argument to
|
|
376
379
|
** sqlite3_exec() is not NULL, then it is invoked for each result row
|
|
@@ -403,7 +406,7 @@ typedef int (*sqlite3_callback)(void*,int,char**, char**);
|
|
|
403
406
|
** result row is NULL then the corresponding string pointer for the
|
|
404
407
|
** sqlite3_exec() callback is a NULL pointer. ^The 4th argument to the
|
|
405
408
|
** sqlite3_exec() callback is an array of pointers to strings where each
|
|
406
|
-
** entry represents the name of corresponding result column as obtained
|
|
409
|
+
** entry represents the name of a corresponding result column as obtained
|
|
407
410
|
** from [sqlite3_column_name()].
|
|
408
411
|
**
|
|
409
412
|
** ^If the 2nd parameter to sqlite3_exec() is a NULL pointer, a pointer
|
|
@@ -420,6 +423,8 @@ typedef int (*sqlite3_callback)(void*,int,char**, char**);
|
|
|
420
423
|
** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running.
|
|
421
424
|
** <li> The application must not modify the SQL statement text passed into
|
|
422
425
|
** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running.
|
|
426
|
+
** <li> The application must not dereference the arrays or string pointers
|
|
427
|
+
** passed as the 3rd and 4th callback parameters after it returns.
|
|
423
428
|
** </ul>
|
|
424
429
|
*/
|
|
425
430
|
SQLITE_API int sqlite3_exec(
|
|
@@ -495,6 +500,9 @@ SQLITE_API int sqlite3_exec(
|
|
|
495
500
|
#define SQLITE_ERROR_MISSING_COLLSEQ (SQLITE_ERROR | (1<<8))
|
|
496
501
|
#define SQLITE_ERROR_RETRY (SQLITE_ERROR | (2<<8))
|
|
497
502
|
#define SQLITE_ERROR_SNAPSHOT (SQLITE_ERROR | (3<<8))
|
|
503
|
+
#define SQLITE_ERROR_RESERVESIZE (SQLITE_ERROR | (4<<8))
|
|
504
|
+
#define SQLITE_ERROR_KEY (SQLITE_ERROR | (5<<8))
|
|
505
|
+
#define SQLITE_ERROR_UNABLE (SQLITE_ERROR | (6<<8))
|
|
498
506
|
#define SQLITE_IOERR_READ (SQLITE_IOERR | (1<<8))
|
|
499
507
|
#define SQLITE_IOERR_SHORT_READ (SQLITE_IOERR | (2<<8))
|
|
500
508
|
#define SQLITE_IOERR_WRITE (SQLITE_IOERR | (3<<8))
|
|
@@ -528,6 +536,9 @@ SQLITE_API int sqlite3_exec(
|
|
|
528
536
|
#define SQLITE_IOERR_ROLLBACK_ATOMIC (SQLITE_IOERR | (31<<8))
|
|
529
537
|
#define SQLITE_IOERR_DATA (SQLITE_IOERR | (32<<8))
|
|
530
538
|
#define SQLITE_IOERR_CORRUPTFS (SQLITE_IOERR | (33<<8))
|
|
539
|
+
#define SQLITE_IOERR_IN_PAGE (SQLITE_IOERR | (34<<8))
|
|
540
|
+
#define SQLITE_IOERR_BADKEY (SQLITE_IOERR | (35<<8))
|
|
541
|
+
#define SQLITE_IOERR_CODEC (SQLITE_IOERR | (36<<8))
|
|
531
542
|
#define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8))
|
|
532
543
|
#define SQLITE_LOCKED_VTAB (SQLITE_LOCKED | (2<<8))
|
|
533
544
|
#define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8))
|
|
@@ -586,7 +597,7 @@ SQLITE_API int sqlite3_exec(
|
|
|
586
597
|
** Note in particular that passing the SQLITE_OPEN_EXCLUSIVE flag into
|
|
587
598
|
** [sqlite3_open_v2()] does *not* cause the underlying database file
|
|
588
599
|
** to be opened using O_EXCL. Passing SQLITE_OPEN_EXCLUSIVE into
|
|
589
|
-
** [sqlite3_open_v2()] has historically
|
|
600
|
+
** [sqlite3_open_v2()] has historically been a no-op and might become an
|
|
590
601
|
** error in future versions of SQLite.
|
|
591
602
|
*/
|
|
592
603
|
#define SQLITE_OPEN_READONLY 0x00000001 /* Ok for sqlite3_open_v2() */
|
|
@@ -649,6 +660,13 @@ SQLITE_API int sqlite3_exec(
|
|
|
649
660
|
** filesystem supports doing multiple write operations atomically when those
|
|
650
661
|
** write operations are bracketed by [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] and
|
|
651
662
|
** [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE].
|
|
663
|
+
**
|
|
664
|
+
** The SQLITE_IOCAP_SUBPAGE_READ property means that it is ok to read
|
|
665
|
+
** from the database file in amounts that are not a multiple of the
|
|
666
|
+
** page size and that do not begin at a page boundary. Without this
|
|
667
|
+
** property, SQLite is careful to only do full-page reads and write
|
|
668
|
+
** on aligned pages, with the one exception that it will do a sub-page
|
|
669
|
+
** read of the first page to access the database header.
|
|
652
670
|
*/
|
|
653
671
|
#define SQLITE_IOCAP_ATOMIC 0x00000001
|
|
654
672
|
#define SQLITE_IOCAP_ATOMIC512 0x00000002
|
|
@@ -665,6 +683,7 @@ SQLITE_API int sqlite3_exec(
|
|
|
665
683
|
#define SQLITE_IOCAP_POWERSAFE_OVERWRITE 0x00001000
|
|
666
684
|
#define SQLITE_IOCAP_IMMUTABLE 0x00002000
|
|
667
685
|
#define SQLITE_IOCAP_BATCH_ATOMIC 0x00004000
|
|
686
|
+
#define SQLITE_IOCAP_SUBPAGE_READ 0x00008000
|
|
668
687
|
|
|
669
688
|
/*
|
|
670
689
|
** CAPI3REF: File Locking Levels
|
|
@@ -672,7 +691,7 @@ SQLITE_API int sqlite3_exec(
|
|
|
672
691
|
** SQLite uses one of these integer values as the second
|
|
673
692
|
** argument to calls it makes to the xLock() and xUnlock() methods
|
|
674
693
|
** of an [sqlite3_io_methods] object. These values are ordered from
|
|
675
|
-
**
|
|
694
|
+
** least restrictive to most restrictive.
|
|
676
695
|
**
|
|
677
696
|
** The argument to xLock() is always SHARED or higher. The argument to
|
|
678
697
|
** xUnlock is either SHARED or NONE.
|
|
@@ -761,16 +780,16 @@ struct sqlite3_file {
|
|
|
761
780
|
** </ul>
|
|
762
781
|
** xLock() upgrades the database file lock. In other words, xLock() moves the
|
|
763
782
|
** database file lock in the direction NONE toward EXCLUSIVE. The argument to
|
|
764
|
-
** xLock() is always
|
|
783
|
+
** xLock() is always one of SHARED, RESERVED, PENDING, or EXCLUSIVE, never
|
|
765
784
|
** SQLITE_LOCK_NONE. If the database file lock is already at or above the
|
|
766
785
|
** requested lock, then the call to xLock() is a no-op.
|
|
767
786
|
** xUnlock() downgrades the database file lock to either SHARED or NONE.
|
|
768
|
-
|
|
787
|
+
** If the lock is already at or below the requested lock state, then the call
|
|
769
788
|
** to xUnlock() is a no-op.
|
|
770
789
|
** The xCheckReservedLock() method checks whether any database connection,
|
|
771
790
|
** either in this process or in some other process, is holding a RESERVED,
|
|
772
|
-
** PENDING, or EXCLUSIVE lock on the file. It returns
|
|
773
|
-
** if such a lock exists and false otherwise.
|
|
791
|
+
** PENDING, or EXCLUSIVE lock on the file. It returns, via its output
|
|
792
|
+
** pointer parameter, true if such a lock exists and false otherwise.
|
|
774
793
|
**
|
|
775
794
|
** The xFileControl() method is a generic interface that allows custom
|
|
776
795
|
** VFS implementations to directly control an open file using the
|
|
@@ -811,6 +830,7 @@ struct sqlite3_file {
|
|
|
811
830
|
** <li> [SQLITE_IOCAP_POWERSAFE_OVERWRITE]
|
|
812
831
|
** <li> [SQLITE_IOCAP_IMMUTABLE]
|
|
813
832
|
** <li> [SQLITE_IOCAP_BATCH_ATOMIC]
|
|
833
|
+
** <li> [SQLITE_IOCAP_SUBPAGE_READ]
|
|
814
834
|
** </ul>
|
|
815
835
|
**
|
|
816
836
|
** The SQLITE_IOCAP_ATOMIC property means that all writes of
|
|
@@ -912,7 +932,7 @@ struct sqlite3_io_methods {
|
|
|
912
932
|
** connection. See also [SQLITE_FCNTL_FILE_POINTER].
|
|
913
933
|
**
|
|
914
934
|
** <li>[[SQLITE_FCNTL_SYNC_OMITTED]]
|
|
915
|
-
**
|
|
935
|
+
** The SQLITE_FCNTL_SYNC_OMITTED file-control is no longer used.
|
|
916
936
|
**
|
|
917
937
|
** <li>[[SQLITE_FCNTL_SYNC]]
|
|
918
938
|
** The [SQLITE_FCNTL_SYNC] opcode is generated internally by SQLite and
|
|
@@ -987,7 +1007,7 @@ struct sqlite3_io_methods {
|
|
|
987
1007
|
**
|
|
988
1008
|
** <li>[[SQLITE_FCNTL_VFSNAME]]
|
|
989
1009
|
** ^The [SQLITE_FCNTL_VFSNAME] opcode can be used to obtain the names of
|
|
990
|
-
** all [VFSes] in the VFS stack. The names
|
|
1010
|
+
** all [VFSes] in the VFS stack. The names of all VFS shims and the
|
|
991
1011
|
** final bottom-level VFS are written into memory obtained from
|
|
992
1012
|
** [sqlite3_malloc()] and the result is stored in the char* variable
|
|
993
1013
|
** that the fourth parameter of [sqlite3_file_control()] points to.
|
|
@@ -1001,7 +1021,7 @@ struct sqlite3_io_methods {
|
|
|
1001
1021
|
** ^The [SQLITE_FCNTL_VFS_POINTER] opcode finds a pointer to the top-level
|
|
1002
1022
|
** [VFSes] currently in use. ^(The argument X in
|
|
1003
1023
|
** sqlite3_file_control(db,SQLITE_FCNTL_VFS_POINTER,X) must be
|
|
1004
|
-
** of type "[sqlite3_vfs] **". This
|
|
1024
|
+
** of type "[sqlite3_vfs] **". This opcode will set *X
|
|
1005
1025
|
** to a pointer to the top-level VFS.)^
|
|
1006
1026
|
** ^When there are multiple VFS shims in the stack, this opcode finds the
|
|
1007
1027
|
** upper-most shim only.
|
|
@@ -1088,6 +1108,11 @@ struct sqlite3_io_methods {
|
|
|
1088
1108
|
** pointed to by the pArg argument. This capability is used during testing
|
|
1089
1109
|
** and only needs to be supported when SQLITE_TEST is defined.
|
|
1090
1110
|
**
|
|
1111
|
+
** <li>[[SQLITE_FCNTL_NULL_IO]]
|
|
1112
|
+
** The [SQLITE_FCNTL_NULL_IO] opcode sets the low-level file descriptor
|
|
1113
|
+
** or file handle for the [sqlite3_file] object such that it will no longer
|
|
1114
|
+
** read or write to the database file.
|
|
1115
|
+
**
|
|
1091
1116
|
** <li>[[SQLITE_FCNTL_WAL_BLOCK]]
|
|
1092
1117
|
** The [SQLITE_FCNTL_WAL_BLOCK] is a signal to the VFS layer that it might
|
|
1093
1118
|
** be advantageous to block on the next WAL lock if the lock is not immediately
|
|
@@ -1146,6 +1171,12 @@ struct sqlite3_io_methods {
|
|
|
1146
1171
|
** the value that M is to be set to. Before returning, the 32-bit signed
|
|
1147
1172
|
** integer is overwritten with the previous value of M.
|
|
1148
1173
|
**
|
|
1174
|
+
** <li>[[SQLITE_FCNTL_BLOCK_ON_CONNECT]]
|
|
1175
|
+
** The [SQLITE_FCNTL_BLOCK_ON_CONNECT] opcode is used to configure the
|
|
1176
|
+
** VFS to block when taking a SHARED lock to connect to a wal mode database.
|
|
1177
|
+
** This is used to implement the functionality associated with
|
|
1178
|
+
** SQLITE_SETLK_BLOCK_ON_CONNECT.
|
|
1179
|
+
**
|
|
1149
1180
|
** <li>[[SQLITE_FCNTL_DATA_VERSION]]
|
|
1150
1181
|
** The [SQLITE_FCNTL_DATA_VERSION] opcode is used to detect changes to
|
|
1151
1182
|
** a database file. The argument is a pointer to a 32-bit unsigned integer.
|
|
@@ -1180,7 +1211,7 @@ struct sqlite3_io_methods {
|
|
|
1180
1211
|
** <li>[[SQLITE_FCNTL_EXTERNAL_READER]]
|
|
1181
1212
|
** The EXPERIMENTAL [SQLITE_FCNTL_EXTERNAL_READER] opcode is used to detect
|
|
1182
1213
|
** whether or not there is a database client in another process with a wal-mode
|
|
1183
|
-
** transaction open on the database or not. It is only available on unix.The
|
|
1214
|
+
** transaction open on the database or not. It is only available on unix. The
|
|
1184
1215
|
** (void*) argument passed with this file-control should be a pointer to a
|
|
1185
1216
|
** value of type (int). The integer value is set to 1 if the database is a wal
|
|
1186
1217
|
** mode database and there exists at least one client in another process that
|
|
@@ -1190,7 +1221,7 @@ struct sqlite3_io_methods {
|
|
|
1190
1221
|
** by clients within the current process, only within other processes.
|
|
1191
1222
|
**
|
|
1192
1223
|
** <li>[[SQLITE_FCNTL_CKSM_FILE]]
|
|
1193
|
-
** The [SQLITE_FCNTL_CKSM_FILE] opcode is for use
|
|
1224
|
+
** The [SQLITE_FCNTL_CKSM_FILE] opcode is for use internally by the
|
|
1194
1225
|
** [checksum VFS shim] only.
|
|
1195
1226
|
**
|
|
1196
1227
|
** <li>[[SQLITE_FCNTL_RESET_CACHE]]
|
|
@@ -1198,6 +1229,15 @@ struct sqlite3_io_methods {
|
|
|
1198
1229
|
** database is not a temp db, then the [SQLITE_FCNTL_RESET_CACHE] file-control
|
|
1199
1230
|
** purges the contents of the in-memory page cache. If there is an open
|
|
1200
1231
|
** transaction, or if the db is a temp-db, this opcode is a no-op, not an error.
|
|
1232
|
+
**
|
|
1233
|
+
** <li>[[SQLITE_FCNTL_FILESTAT]]
|
|
1234
|
+
** The [SQLITE_FCNTL_FILESTAT] opcode returns low-level diagnostic information
|
|
1235
|
+
** about the [sqlite3_file] objects used access the database and journal files
|
|
1236
|
+
** for the given schema. The fourth parameter to [sqlite3_file_control()]
|
|
1237
|
+
** should be an initialized [sqlite3_str] pointer. JSON text describing
|
|
1238
|
+
** various aspects of the sqlite3_file object is appended to the sqlite3_str.
|
|
1239
|
+
** The SQLITE_FCNTL_FILESTAT opcode is usually a no-op, unless compile-time
|
|
1240
|
+
** options are used to enable it.
|
|
1201
1241
|
** </ul>
|
|
1202
1242
|
*/
|
|
1203
1243
|
#define SQLITE_FCNTL_LOCKSTATE 1
|
|
@@ -1241,6 +1281,9 @@ struct sqlite3_io_methods {
|
|
|
1241
1281
|
#define SQLITE_FCNTL_EXTERNAL_READER 40
|
|
1242
1282
|
#define SQLITE_FCNTL_CKSM_FILE 41
|
|
1243
1283
|
#define SQLITE_FCNTL_RESET_CACHE 42
|
|
1284
|
+
#define SQLITE_FCNTL_NULL_IO 43
|
|
1285
|
+
#define SQLITE_FCNTL_BLOCK_ON_CONNECT 44
|
|
1286
|
+
#define SQLITE_FCNTL_FILESTAT 45
|
|
1244
1287
|
|
|
1245
1288
|
/* deprecated names */
|
|
1246
1289
|
#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
|
|
@@ -1603,7 +1646,7 @@ struct sqlite3_vfs {
|
|
|
1603
1646
|
** SQLite interfaces so that an application usually does not need to
|
|
1604
1647
|
** invoke sqlite3_initialize() directly. For example, [sqlite3_open()]
|
|
1605
1648
|
** calls sqlite3_initialize() so the SQLite library will be automatically
|
|
1606
|
-
** initialized when [sqlite3_open()] is called if it has not
|
|
1649
|
+
** initialized when [sqlite3_open()] is called if it has not been initialized
|
|
1607
1650
|
** already. ^However, if SQLite is compiled with the [SQLITE_OMIT_AUTOINIT]
|
|
1608
1651
|
** compile-time option, then the automatic calls to sqlite3_initialize()
|
|
1609
1652
|
** are omitted and the application must call sqlite3_initialize() directly
|
|
@@ -1655,20 +1698,23 @@ SQLITE_API int sqlite3_os_end(void);
|
|
|
1655
1698
|
** must ensure that no other SQLite interfaces are invoked by other
|
|
1656
1699
|
** threads while sqlite3_config() is running.</b>
|
|
1657
1700
|
**
|
|
1658
|
-
** The sqlite3_config() interface
|
|
1659
|
-
** may only be invoked prior to library initialization using
|
|
1660
|
-
** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].
|
|
1661
|
-
** ^If sqlite3_config() is called after [sqlite3_initialize()] and before
|
|
1662
|
-
** [sqlite3_shutdown()] then it will return SQLITE_MISUSE.
|
|
1663
|
-
** Note, however, that ^sqlite3_config() can be called as part of the
|
|
1664
|
-
** implementation of an application-defined [sqlite3_os_init()].
|
|
1665
|
-
**
|
|
1666
1701
|
** The first argument to sqlite3_config() is an integer
|
|
1667
1702
|
** [configuration option] that determines
|
|
1668
1703
|
** what property of SQLite is to be configured. Subsequent arguments
|
|
1669
1704
|
** vary depending on the [configuration option]
|
|
1670
1705
|
** in the first argument.
|
|
1671
1706
|
**
|
|
1707
|
+
** For most configuration options, the sqlite3_config() interface
|
|
1708
|
+
** may only be invoked prior to library initialization using
|
|
1709
|
+
** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].
|
|
1710
|
+
** The exceptional configuration options that may be invoked at any time
|
|
1711
|
+
** are called "anytime configuration options".
|
|
1712
|
+
** ^If sqlite3_config() is called after [sqlite3_initialize()] and before
|
|
1713
|
+
** [sqlite3_shutdown()] with a first argument that is not an anytime
|
|
1714
|
+
** configuration option, then the sqlite3_config() call will return SQLITE_MISUSE.
|
|
1715
|
+
** Note, however, that ^sqlite3_config() can be called as part of the
|
|
1716
|
+
** implementation of an application-defined [sqlite3_os_init()].
|
|
1717
|
+
**
|
|
1672
1718
|
** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK].
|
|
1673
1719
|
** ^If the option is unknown or SQLite is unable to set the option
|
|
1674
1720
|
** then this routine returns a non-zero [error code].
|
|
@@ -1776,6 +1822,23 @@ struct sqlite3_mem_methods {
|
|
|
1776
1822
|
** These constants are the available integer configuration options that
|
|
1777
1823
|
** can be passed as the first argument to the [sqlite3_config()] interface.
|
|
1778
1824
|
**
|
|
1825
|
+
** Most of the configuration options for sqlite3_config()
|
|
1826
|
+
** will only work if invoked prior to [sqlite3_initialize()] or after
|
|
1827
|
+
** [sqlite3_shutdown()]. The few exceptions to this rule are called
|
|
1828
|
+
** "anytime configuration options".
|
|
1829
|
+
** ^Calling [sqlite3_config()] with a first argument that is not an
|
|
1830
|
+
** anytime configuration option in between calls to [sqlite3_initialize()] and
|
|
1831
|
+
** [sqlite3_shutdown()] is a no-op that returns SQLITE_MISUSE.
|
|
1832
|
+
**
|
|
1833
|
+
** The set of anytime configuration options can change (by insertions
|
|
1834
|
+
** and/or deletions) from one release of SQLite to the next.
|
|
1835
|
+
** As of SQLite version 3.42.0, the complete set of anytime configuration
|
|
1836
|
+
** options is:
|
|
1837
|
+
** <ul>
|
|
1838
|
+
** <li> SQLITE_CONFIG_LOG
|
|
1839
|
+
** <li> SQLITE_CONFIG_PCACHE_HDRSZ
|
|
1840
|
+
** </ul>
|
|
1841
|
+
**
|
|
1779
1842
|
** New configuration options may be added in future releases of SQLite.
|
|
1780
1843
|
** Existing configuration options might be discontinued. Applications
|
|
1781
1844
|
** should check the return code from [sqlite3_config()] to make sure that
|
|
@@ -1840,21 +1903,21 @@ struct sqlite3_mem_methods {
|
|
|
1840
1903
|
** The [sqlite3_mem_methods]
|
|
1841
1904
|
** structure is filled with the currently defined memory allocation routines.)^
|
|
1842
1905
|
** This option can be used to overload the default memory allocation
|
|
1843
|
-
** routines with a wrapper that
|
|
1906
|
+
** routines with a wrapper that simulates memory allocation failure or
|
|
1844
1907
|
** tracks memory usage, for example. </dd>
|
|
1845
1908
|
**
|
|
1846
1909
|
** [[SQLITE_CONFIG_SMALL_MALLOC]] <dt>SQLITE_CONFIG_SMALL_MALLOC</dt>
|
|
1847
|
-
** <dd> ^The SQLITE_CONFIG_SMALL_MALLOC option takes single argument of
|
|
1910
|
+
** <dd> ^The SQLITE_CONFIG_SMALL_MALLOC option takes a single argument of
|
|
1848
1911
|
** type int, interpreted as a boolean, which if true provides a hint to
|
|
1849
1912
|
** SQLite that it should avoid large memory allocations if possible.
|
|
1850
1913
|
** SQLite will run faster if it is free to make large memory allocations,
|
|
1851
|
-
** but some
|
|
1914
|
+
** but some applications might prefer to run slower in exchange for
|
|
1852
1915
|
** guarantees about memory fragmentation that are possible if large
|
|
1853
1916
|
** allocations are avoided. This hint is normally off.
|
|
1854
1917
|
** </dd>
|
|
1855
1918
|
**
|
|
1856
1919
|
** [[SQLITE_CONFIG_MEMSTATUS]] <dt>SQLITE_CONFIG_MEMSTATUS</dt>
|
|
1857
|
-
** <dd> ^The SQLITE_CONFIG_MEMSTATUS option takes single argument of type int,
|
|
1920
|
+
** <dd> ^The SQLITE_CONFIG_MEMSTATUS option takes a single argument of type int,
|
|
1858
1921
|
** interpreted as a boolean, which enables or disables the collection of
|
|
1859
1922
|
** memory allocation statistics. ^(When memory allocation statistics are
|
|
1860
1923
|
** disabled, the following SQLite interfaces become non-operational:
|
|
@@ -1899,7 +1962,7 @@ struct sqlite3_mem_methods {
|
|
|
1899
1962
|
** ^If pMem is NULL and N is non-zero, then each database connection
|
|
1900
1963
|
** does an initial bulk allocation for page cache memory
|
|
1901
1964
|
** from [sqlite3_malloc()] sufficient for N cache lines if N is positive or
|
|
1902
|
-
** of -1024*N bytes if N is negative
|
|
1965
|
+
** of -1024*N bytes if N is negative. ^If additional
|
|
1903
1966
|
** page cache memory is needed beyond what is provided by the initial
|
|
1904
1967
|
** allocation, then SQLite goes to [sqlite3_malloc()] separately for each
|
|
1905
1968
|
** additional cache line. </dd>
|
|
@@ -1928,7 +1991,7 @@ struct sqlite3_mem_methods {
|
|
|
1928
1991
|
** <dd> ^(The SQLITE_CONFIG_MUTEX option takes a single argument which is a
|
|
1929
1992
|
** pointer to an instance of the [sqlite3_mutex_methods] structure.
|
|
1930
1993
|
** The argument specifies alternative low-level mutex routines to be used
|
|
1931
|
-
** in place the mutex routines built into SQLite.)^ ^SQLite makes a copy of
|
|
1994
|
+
** in place of the mutex routines built into SQLite.)^ ^SQLite makes a copy of
|
|
1932
1995
|
** the content of the [sqlite3_mutex_methods] structure before the call to
|
|
1933
1996
|
** [sqlite3_config()] returns. ^If SQLite is compiled with
|
|
1934
1997
|
** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
|
|
@@ -1951,13 +2014,16 @@ struct sqlite3_mem_methods {
|
|
|
1951
2014
|
**
|
|
1952
2015
|
** [[SQLITE_CONFIG_LOOKASIDE]] <dt>SQLITE_CONFIG_LOOKASIDE</dt>
|
|
1953
2016
|
** <dd> ^(The SQLITE_CONFIG_LOOKASIDE option takes two arguments that determine
|
|
1954
|
-
** the default size of lookaside memory on each [database connection].
|
|
2017
|
+
** the default size of [lookaside memory] on each [database connection].
|
|
1955
2018
|
** The first argument is the
|
|
1956
|
-
** size of each lookaside buffer slot and the second is the number of
|
|
1957
|
-
** slots allocated to each database connection.)^
|
|
1958
|
-
** sets the <i>default</i> lookaside size.
|
|
1959
|
-
** option to [sqlite3_db_config()] can
|
|
1960
|
-
** configuration on individual connections.)^
|
|
2019
|
+
** size of each lookaside buffer slot ("sz") and the second is the number of
|
|
2020
|
+
** slots allocated to each database connection ("cnt").)^
|
|
2021
|
+
** ^(SQLITE_CONFIG_LOOKASIDE sets the <i>default</i> lookaside size.
|
|
2022
|
+
** The [SQLITE_DBCONFIG_LOOKASIDE] option to [sqlite3_db_config()] can
|
|
2023
|
+
** be used to change the lookaside configuration on individual connections.)^
|
|
2024
|
+
** The [-DSQLITE_DEFAULT_LOOKASIDE] option can be used to change the
|
|
2025
|
+
** default lookaside configuration at compile-time.
|
|
2026
|
+
** </dd>
|
|
1961
2027
|
**
|
|
1962
2028
|
** [[SQLITE_CONFIG_PCACHE2]] <dt>SQLITE_CONFIG_PCACHE2</dt>
|
|
1963
2029
|
** <dd> ^(The SQLITE_CONFIG_PCACHE2 option takes a single argument which is
|
|
@@ -1967,7 +2033,7 @@ struct sqlite3_mem_methods {
|
|
|
1967
2033
|
**
|
|
1968
2034
|
** [[SQLITE_CONFIG_GETPCACHE2]] <dt>SQLITE_CONFIG_GETPCACHE2</dt>
|
|
1969
2035
|
** <dd> ^(The SQLITE_CONFIG_GETPCACHE2 option takes a single argument which
|
|
1970
|
-
** is a pointer to an [sqlite3_pcache_methods2] object. SQLite copies
|
|
2036
|
+
** is a pointer to an [sqlite3_pcache_methods2] object. SQLite copies off
|
|
1971
2037
|
** the current page cache implementation into that object.)^ </dd>
|
|
1972
2038
|
**
|
|
1973
2039
|
** [[SQLITE_CONFIG_LOG]] <dt>SQLITE_CONFIG_LOG</dt>
|
|
@@ -1984,7 +2050,7 @@ struct sqlite3_mem_methods {
|
|
|
1984
2050
|
** the logger function is a copy of the first parameter to the corresponding
|
|
1985
2051
|
** [sqlite3_log()] call and is intended to be a [result code] or an
|
|
1986
2052
|
** [extended result code]. ^The third parameter passed to the logger is
|
|
1987
|
-
** log message after formatting via [sqlite3_snprintf()].
|
|
2053
|
+
** a log message after formatting via [sqlite3_snprintf()].
|
|
1988
2054
|
** The SQLite logging interface is not reentrant; the logger function
|
|
1989
2055
|
** supplied by the application must not invoke any SQLite interface.
|
|
1990
2056
|
** In a multi-threaded application, the application-defined logger
|
|
@@ -2106,7 +2172,7 @@ struct sqlite3_mem_methods {
|
|
|
2106
2172
|
** is stored in each sorted record and the required column values loaded
|
|
2107
2173
|
** from the database as records are returned in sorted order. The default
|
|
2108
2174
|
** value for this option is to never use this optimization. Specifying a
|
|
2109
|
-
** negative value for this option restores the default
|
|
2175
|
+
** negative value for this option restores the default behavior.
|
|
2110
2176
|
** This option is only available if SQLite is compiled with the
|
|
2111
2177
|
** [SQLITE_ENABLE_SORTER_REFERENCES] compile-time option.
|
|
2112
2178
|
**
|
|
@@ -2120,30 +2186,46 @@ struct sqlite3_mem_methods {
|
|
|
2120
2186
|
** configuration setting is never used, then the default maximum is determined
|
|
2121
2187
|
** by the [SQLITE_MEMDB_DEFAULT_MAXSIZE] compile-time option. If that
|
|
2122
2188
|
** compile-time option is not set, then the default maximum is 1073741824.
|
|
2189
|
+
**
|
|
2190
|
+
** [[SQLITE_CONFIG_ROWID_IN_VIEW]]
|
|
2191
|
+
** <dt>SQLITE_CONFIG_ROWID_IN_VIEW
|
|
2192
|
+
** <dd>The SQLITE_CONFIG_ROWID_IN_VIEW option enables or disables the ability
|
|
2193
|
+
** for VIEWs to have a ROWID. The capability can only be enabled if SQLite is
|
|
2194
|
+
** compiled with -DSQLITE_ALLOW_ROWID_IN_VIEW, in which case the capability
|
|
2195
|
+
** defaults to on. This configuration option queries the current setting or
|
|
2196
|
+
** changes the setting to off or on. The argument is a pointer to an integer.
|
|
2197
|
+
** If that integer initially holds a value of 1, then the ability for VIEWs to
|
|
2198
|
+
** have ROWIDs is activated. If the integer initially holds zero, then the
|
|
2199
|
+
** ability is deactivated. Any other initial value for the integer leaves the
|
|
2200
|
+
** setting unchanged. After changes, if any, the integer is written with
|
|
2201
|
+
** a 1 or 0, if the ability for VIEWs to have ROWIDs is on or off. If SQLite
|
|
2202
|
+
** is compiled without -DSQLITE_ALLOW_ROWID_IN_VIEW (which is the usual and
|
|
2203
|
+
** recommended case) then the integer is always filled with zero, regardless
|
|
2204
|
+
** if its initial value.
|
|
2123
2205
|
** </dl>
|
|
2124
2206
|
*/
|
|
2125
|
-
#define SQLITE_CONFIG_SINGLETHREAD
|
|
2126
|
-
#define SQLITE_CONFIG_MULTITHREAD
|
|
2127
|
-
#define SQLITE_CONFIG_SERIALIZED
|
|
2128
|
-
#define SQLITE_CONFIG_MALLOC
|
|
2129
|
-
#define SQLITE_CONFIG_GETMALLOC
|
|
2130
|
-
#define SQLITE_CONFIG_SCRATCH
|
|
2131
|
-
#define SQLITE_CONFIG_PAGECACHE
|
|
2132
|
-
#define SQLITE_CONFIG_HEAP
|
|
2133
|
-
#define SQLITE_CONFIG_MEMSTATUS
|
|
2134
|
-
#define SQLITE_CONFIG_MUTEX
|
|
2135
|
-
#define SQLITE_CONFIG_GETMUTEX
|
|
2136
|
-
/* previously SQLITE_CONFIG_CHUNKALLOC
|
|
2137
|
-
#define SQLITE_CONFIG_LOOKASIDE
|
|
2138
|
-
#define SQLITE_CONFIG_PCACHE
|
|
2139
|
-
#define SQLITE_CONFIG_GETPCACHE
|
|
2140
|
-
#define SQLITE_CONFIG_LOG
|
|
2141
|
-
#define SQLITE_CONFIG_URI
|
|
2142
|
-
#define SQLITE_CONFIG_PCACHE2
|
|
2143
|
-
#define SQLITE_CONFIG_GETPCACHE2
|
|
2207
|
+
#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
|
|
2208
|
+
#define SQLITE_CONFIG_MULTITHREAD 2 /* nil */
|
|
2209
|
+
#define SQLITE_CONFIG_SERIALIZED 3 /* nil */
|
|
2210
|
+
#define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */
|
|
2211
|
+
#define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */
|
|
2212
|
+
#define SQLITE_CONFIG_SCRATCH 6 /* No longer used */
|
|
2213
|
+
#define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */
|
|
2214
|
+
#define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */
|
|
2215
|
+
#define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */
|
|
2216
|
+
#define SQLITE_CONFIG_MUTEX 10 /* sqlite3_mutex_methods* */
|
|
2217
|
+
#define SQLITE_CONFIG_GETMUTEX 11 /* sqlite3_mutex_methods* */
|
|
2218
|
+
/* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */
|
|
2219
|
+
#define SQLITE_CONFIG_LOOKASIDE 13 /* int int */
|
|
2220
|
+
#define SQLITE_CONFIG_PCACHE 14 /* no-op */
|
|
2221
|
+
#define SQLITE_CONFIG_GETPCACHE 15 /* no-op */
|
|
2222
|
+
#define SQLITE_CONFIG_LOG 16 /* xFunc, void* */
|
|
2223
|
+
#define SQLITE_CONFIG_URI 17 /* int */
|
|
2224
|
+
#define SQLITE_CONFIG_PCACHE2 18 /* sqlite3_pcache_methods2* */
|
|
2225
|
+
#define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */
|
|
2144
2226
|
#define SQLITE_CONFIG_COVERING_INDEX_SCAN 20 /* int */
|
|
2145
|
-
#define SQLITE_CONFIG_SQLLOG
|
|
2146
|
-
#define SQLITE_CONFIG_MMAP_SIZE
|
|
2227
|
+
#define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */
|
|
2228
|
+
#define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */
|
|
2147
2229
|
#define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */
|
|
2148
2230
|
#define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */
|
|
2149
2231
|
#define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */
|
|
@@ -2151,12 +2233,21 @@ struct sqlite3_mem_methods {
|
|
|
2151
2233
|
#define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */
|
|
2152
2234
|
#define SQLITE_CONFIG_SORTERREF_SIZE 28 /* int nByte */
|
|
2153
2235
|
#define SQLITE_CONFIG_MEMDB_MAXSIZE 29 /* sqlite3_int64 */
|
|
2236
|
+
#define SQLITE_CONFIG_ROWID_IN_VIEW 30 /* int* */
|
|
2154
2237
|
|
|
2155
2238
|
/*
|
|
2156
2239
|
** CAPI3REF: Database Connection Configuration Options
|
|
2157
2240
|
**
|
|
2158
2241
|
** These constants are the available integer configuration options that
|
|
2159
|
-
** can be passed as the second
|
|
2242
|
+
** can be passed as the second parameter to the [sqlite3_db_config()] interface.
|
|
2243
|
+
**
|
|
2244
|
+
** The [sqlite3_db_config()] interface is a var-args function. It takes a
|
|
2245
|
+
** variable number of parameters, though always at least two. The number of
|
|
2246
|
+
** parameters passed into sqlite3_db_config() depends on which of these
|
|
2247
|
+
** constants is given as the second parameter. This documentation page
|
|
2248
|
+
** refers to parameters beyond the second as "arguments". Thus, when this
|
|
2249
|
+
** page says "the N-th argument" it means "the N-th parameter past the
|
|
2250
|
+
** configuration option" or "the (N+2)-th parameter to sqlite3_db_config()".
|
|
2160
2251
|
**
|
|
2161
2252
|
** New configuration options may be added in future releases of SQLite.
|
|
2162
2253
|
** Existing configuration options might be discontinued. Applications
|
|
@@ -2168,31 +2259,57 @@ struct sqlite3_mem_methods {
|
|
|
2168
2259
|
** <dl>
|
|
2169
2260
|
** [[SQLITE_DBCONFIG_LOOKASIDE]]
|
|
2170
2261
|
** <dt>SQLITE_DBCONFIG_LOOKASIDE</dt>
|
|
2171
|
-
** <dd>
|
|
2172
|
-
** [lookaside memory allocator]
|
|
2173
|
-
**
|
|
2262
|
+
** <dd> The SQLITE_DBCONFIG_LOOKASIDE option is used to adjust the
|
|
2263
|
+
** configuration of the [lookaside memory allocator] within a database
|
|
2264
|
+
** connection.
|
|
2265
|
+
** The arguments to the SQLITE_DBCONFIG_LOOKASIDE option are <i>not</i>
|
|
2266
|
+
** in the [DBCONFIG arguments|usual format].
|
|
2267
|
+
** The SQLITE_DBCONFIG_LOOKASIDE option takes three arguments, not two,
|
|
2268
|
+
** so that a call to [sqlite3_db_config()] that uses SQLITE_DBCONFIG_LOOKASIDE
|
|
2269
|
+
** should have a total of five parameters.
|
|
2270
|
+
** <ol>
|
|
2271
|
+
** <li><p>The first argument ("buf") is a
|
|
2174
2272
|
** pointer to a memory buffer to use for lookaside memory.
|
|
2175
|
-
**
|
|
2176
|
-
**
|
|
2177
|
-
**
|
|
2178
|
-
** size of each lookaside buffer slot.
|
|
2179
|
-
**
|
|
2180
|
-
**
|
|
2181
|
-
**
|
|
2182
|
-
**
|
|
2183
|
-
**
|
|
2273
|
+
** The first argument may be NULL in which case SQLite will allocate the
|
|
2274
|
+
** lookaside buffer itself using [sqlite3_malloc()].
|
|
2275
|
+
** <li><P>The second argument ("sz") is the
|
|
2276
|
+
** size of each lookaside buffer slot. Lookaside is disabled if "sz"
|
|
2277
|
+
** is less than 8. The "sz" argument should be a multiple of 8 less than
|
|
2278
|
+
** 65536. If "sz" does not meet this constraint, it is reduced in size until
|
|
2279
|
+
** it does.
|
|
2280
|
+
** <li><p>The third argument ("cnt") is the number of slots. Lookaside is disabled
|
|
2281
|
+
** if "cnt"is less than 1. The "cnt" value will be reduced, if necessary, so
|
|
2282
|
+
** that the product of "sz" and "cnt" does not exceed 2,147,418,112. The "cnt"
|
|
2283
|
+
** parameter is usually chosen so that the product of "sz" and "cnt" is less
|
|
2284
|
+
** than 1,000,000.
|
|
2285
|
+
** </ol>
|
|
2286
|
+
** <p>If the "buf" argument is not NULL, then it must
|
|
2287
|
+
** point to a memory buffer with a size that is greater than
|
|
2288
|
+
** or equal to the product of "sz" and "cnt".
|
|
2289
|
+
** The buffer must be aligned to an 8-byte boundary.
|
|
2290
|
+
** The lookaside memory
|
|
2184
2291
|
** configuration for a database connection can only be changed when that
|
|
2185
2292
|
** connection is not currently using lookaside memory, or in other words
|
|
2186
|
-
** when the
|
|
2187
|
-
** [sqlite3_db_status](D,[SQLITE_DBSTATUS_LOOKASIDE_USED],...) is zero.
|
|
2293
|
+
** when the value returned by [SQLITE_DBSTATUS_LOOKASIDE_USED] is zero.
|
|
2188
2294
|
** Any attempt to change the lookaside memory configuration when lookaside
|
|
2189
2295
|
** memory is in use leaves the configuration unchanged and returns
|
|
2190
|
-
** [SQLITE_BUSY].
|
|
2296
|
+
** [SQLITE_BUSY].
|
|
2297
|
+
** If the "buf" argument is NULL and an attempt
|
|
2298
|
+
** to allocate memory based on "sz" and "cnt" fails, then
|
|
2299
|
+
** lookaside is silently disabled.
|
|
2300
|
+
** <p>
|
|
2301
|
+
** The [SQLITE_CONFIG_LOOKASIDE] configuration option can be used to set the
|
|
2302
|
+
** default lookaside configuration at initialization. The
|
|
2303
|
+
** [-DSQLITE_DEFAULT_LOOKASIDE] option can be used to set the default lookaside
|
|
2304
|
+
** configuration at compile-time. Typical values for lookaside are 1200 for
|
|
2305
|
+
** "sz" and 40 to 100 for "cnt".
|
|
2306
|
+
** </dd>
|
|
2191
2307
|
**
|
|
2192
2308
|
** [[SQLITE_DBCONFIG_ENABLE_FKEY]]
|
|
2193
2309
|
** <dt>SQLITE_DBCONFIG_ENABLE_FKEY</dt>
|
|
2194
2310
|
** <dd> ^This option is used to enable or disable the enforcement of
|
|
2195
|
-
** [foreign key constraints].
|
|
2311
|
+
** [foreign key constraints]. This is the same setting that is
|
|
2312
|
+
** enabled or disabled by the [PRAGMA foreign_keys] statement.
|
|
2196
2313
|
** The first argument is an integer which is 0 to disable FK enforcement,
|
|
2197
2314
|
** positive to enable FK enforcement or negative to leave FK enforcement
|
|
2198
2315
|
** unchanged. The second parameter is a pointer to an integer into which
|
|
@@ -2214,13 +2331,13 @@ struct sqlite3_mem_methods {
|
|
|
2214
2331
|
** <p>Originally this option disabled all triggers. ^(However, since
|
|
2215
2332
|
** SQLite version 3.35.0, TEMP triggers are still allowed even if
|
|
2216
2333
|
** this option is off. So, in other words, this option now only disables
|
|
2217
|
-
** triggers in the main database schema or in the schemas of ATTACH-ed
|
|
2334
|
+
** triggers in the main database schema or in the schemas of [ATTACH]-ed
|
|
2218
2335
|
** databases.)^ </dd>
|
|
2219
2336
|
**
|
|
2220
2337
|
** [[SQLITE_DBCONFIG_ENABLE_VIEW]]
|
|
2221
2338
|
** <dt>SQLITE_DBCONFIG_ENABLE_VIEW</dt>
|
|
2222
2339
|
** <dd> ^This option is used to enable or disable [CREATE VIEW | views].
|
|
2223
|
-
** There
|
|
2340
|
+
** There must be two additional arguments.
|
|
2224
2341
|
** The first argument is an integer which is 0 to disable views,
|
|
2225
2342
|
** positive to enable views or negative to leave the setting unchanged.
|
|
2226
2343
|
** The second parameter is a pointer to an integer into which
|
|
@@ -2236,17 +2353,20 @@ struct sqlite3_mem_methods {
|
|
|
2236
2353
|
**
|
|
2237
2354
|
** [[SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER]]
|
|
2238
2355
|
** <dt>SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER</dt>
|
|
2239
|
-
** <dd> ^This option is used to enable or disable the
|
|
2240
|
-
** [fts3_tokenizer()] function
|
|
2241
|
-
**
|
|
2242
|
-
** There
|
|
2243
|
-
**
|
|
2244
|
-
**
|
|
2245
|
-
**
|
|
2246
|
-
**
|
|
2247
|
-
**
|
|
2248
|
-
**
|
|
2249
|
-
**
|
|
2356
|
+
** <dd> ^This option is used to enable or disable using the
|
|
2357
|
+
** [fts3_tokenizer()] function - part of the [FTS3] full-text search engine
|
|
2358
|
+
** extension - without using bound parameters as the parameters. Doing so
|
|
2359
|
+
** is disabled by default. There must be two additional arguments. The first
|
|
2360
|
+
** argument is an integer. If it is passed 0, then using fts3_tokenizer()
|
|
2361
|
+
** without bound parameters is disabled. If it is passed a positive value,
|
|
2362
|
+
** then calling fts3_tokenizer without bound parameters is enabled. If it
|
|
2363
|
+
** is passed a negative value, this setting is not modified - this can be
|
|
2364
|
+
** used to query for the current setting. The second parameter is a pointer
|
|
2365
|
+
** to an integer into which is written 0 or 1 to indicate the current value
|
|
2366
|
+
** of this setting (after it is modified, if applicable). The second
|
|
2367
|
+
** parameter may be a NULL pointer, in which case the value of the setting
|
|
2368
|
+
** is not reported back. Refer to [FTS3] documentation for further details.
|
|
2369
|
+
** </dd>
|
|
2250
2370
|
**
|
|
2251
2371
|
** [[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION]]
|
|
2252
2372
|
** <dt>SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION</dt>
|
|
@@ -2254,12 +2374,12 @@ struct sqlite3_mem_methods {
|
|
|
2254
2374
|
** interface independently of the [load_extension()] SQL function.
|
|
2255
2375
|
** The [sqlite3_enable_load_extension()] API enables or disables both the
|
|
2256
2376
|
** C-API [sqlite3_load_extension()] and the SQL function [load_extension()].
|
|
2257
|
-
** There
|
|
2377
|
+
** There must be two additional arguments.
|
|
2258
2378
|
** When the first argument to this interface is 1, then only the C-API is
|
|
2259
2379
|
** enabled and the SQL function remains disabled. If the first argument to
|
|
2260
2380
|
** this interface is 0, then both the C-API and the SQL function are disabled.
|
|
2261
|
-
** If the first argument is -1, then no changes are made to state of either
|
|
2262
|
-
** C-API or the SQL function.
|
|
2381
|
+
** If the first argument is -1, then no changes are made to the state of either
|
|
2382
|
+
** the C-API or the SQL function.
|
|
2263
2383
|
** The second parameter is a pointer to an integer into which
|
|
2264
2384
|
** is written 0 or 1 to indicate whether [sqlite3_load_extension()] interface
|
|
2265
2385
|
** is disabled or enabled following this call. The second parameter may
|
|
@@ -2268,23 +2388,30 @@ struct sqlite3_mem_methods {
|
|
|
2268
2388
|
**
|
|
2269
2389
|
** [[SQLITE_DBCONFIG_MAINDBNAME]] <dt>SQLITE_DBCONFIG_MAINDBNAME</dt>
|
|
2270
2390
|
** <dd> ^This option is used to change the name of the "main" database
|
|
2271
|
-
** schema.
|
|
2272
|
-
**
|
|
2273
|
-
**
|
|
2274
|
-
**
|
|
2275
|
-
**
|
|
2391
|
+
** schema. This option does not follow the
|
|
2392
|
+
** [DBCONFIG arguments|usual SQLITE_DBCONFIG argument format].
|
|
2393
|
+
** This option takes exactly one additional argument so that the
|
|
2394
|
+
** [sqlite3_db_config()] call has a total of three parameters. The
|
|
2395
|
+
** extra argument must be a pointer to a constant UTF8 string which
|
|
2396
|
+
** will become the new schema name in place of "main". ^SQLite does
|
|
2397
|
+
** not make a copy of the new main schema name string, so the application
|
|
2398
|
+
** must ensure that the argument passed into SQLITE_DBCONFIG MAINDBNAME
|
|
2399
|
+
** is unchanged until after the database connection closes.
|
|
2276
2400
|
** </dd>
|
|
2277
2401
|
**
|
|
2278
2402
|
** [[SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE]]
|
|
2279
2403
|
** <dt>SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE</dt>
|
|
2280
|
-
** <dd> Usually, when a database in
|
|
2281
|
-
** database handle, SQLite checks if
|
|
2282
|
-
**
|
|
2283
|
-
**
|
|
2284
|
-
**
|
|
2285
|
-
**
|
|
2286
|
-
**
|
|
2287
|
-
**
|
|
2404
|
+
** <dd> Usually, when a database in [WAL mode] is closed or detached from a
|
|
2405
|
+
** database handle, SQLite checks if if there are other connections to the
|
|
2406
|
+
** same database, and if there are no other database connection (if the
|
|
2407
|
+
** connection being closed is the last open connection to the database),
|
|
2408
|
+
** then SQLite performs a [checkpoint] before closing the connection and
|
|
2409
|
+
** deletes the WAL file. The SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE option can
|
|
2410
|
+
** be used to override that behavior. The first argument passed to this
|
|
2411
|
+
** operation (the third parameter to [sqlite3_db_config()]) is an integer
|
|
2412
|
+
** which is positive to disable checkpoints-on-close, or zero (the default)
|
|
2413
|
+
** to enable them, and negative to leave the setting unchanged.
|
|
2414
|
+
** The second argument (the fourth parameter) is a pointer to an integer
|
|
2288
2415
|
** into which is written 0 or 1 to indicate whether checkpoints-on-close
|
|
2289
2416
|
** have been disabled - 0 if they are not disabled, 1 if they are.
|
|
2290
2417
|
** </dd>
|
|
@@ -2370,7 +2497,7 @@ struct sqlite3_mem_methods {
|
|
|
2370
2497
|
** [[SQLITE_DBCONFIG_LEGACY_ALTER_TABLE]]
|
|
2371
2498
|
** <dt>SQLITE_DBCONFIG_LEGACY_ALTER_TABLE</dt>
|
|
2372
2499
|
** <dd>The SQLITE_DBCONFIG_LEGACY_ALTER_TABLE option activates or deactivates
|
|
2373
|
-
** the legacy behavior of the [ALTER TABLE RENAME] command such it
|
|
2500
|
+
** the legacy behavior of the [ALTER TABLE RENAME] command such that it
|
|
2374
2501
|
** behaves as it did prior to [version 3.24.0] (2018-06-04). See the
|
|
2375
2502
|
** "Compatibility Notice" on the [ALTER TABLE RENAME documentation] for
|
|
2376
2503
|
** additional information. This feature can also be turned on and off
|
|
@@ -2378,7 +2505,7 @@ struct sqlite3_mem_methods {
|
|
|
2378
2505
|
** </dd>
|
|
2379
2506
|
**
|
|
2380
2507
|
** [[SQLITE_DBCONFIG_DQS_DML]]
|
|
2381
|
-
** <dt>SQLITE_DBCONFIG_DQS_DML</
|
|
2508
|
+
** <dt>SQLITE_DBCONFIG_DQS_DML</dt>
|
|
2382
2509
|
** <dd>The SQLITE_DBCONFIG_DQS_DML option activates or deactivates
|
|
2383
2510
|
** the legacy [double-quoted string literal] misfeature for DML statements
|
|
2384
2511
|
** only, that is DELETE, INSERT, SELECT, and UPDATE statements. The
|
|
@@ -2387,7 +2514,7 @@ struct sqlite3_mem_methods {
|
|
|
2387
2514
|
** </dd>
|
|
2388
2515
|
**
|
|
2389
2516
|
** [[SQLITE_DBCONFIG_DQS_DDL]]
|
|
2390
|
-
** <dt>SQLITE_DBCONFIG_DQS_DDL</
|
|
2517
|
+
** <dt>SQLITE_DBCONFIG_DQS_DDL</dt>
|
|
2391
2518
|
** <dd>The SQLITE_DBCONFIG_DQS option activates or deactivates
|
|
2392
2519
|
** the legacy [double-quoted string literal] misfeature for DDL statements,
|
|
2393
2520
|
** such as CREATE TABLE and CREATE INDEX. The
|
|
@@ -2396,7 +2523,7 @@ struct sqlite3_mem_methods {
|
|
|
2396
2523
|
** </dd>
|
|
2397
2524
|
**
|
|
2398
2525
|
** [[SQLITE_DBCONFIG_TRUSTED_SCHEMA]]
|
|
2399
|
-
** <dt>SQLITE_DBCONFIG_TRUSTED_SCHEMA</
|
|
2526
|
+
** <dt>SQLITE_DBCONFIG_TRUSTED_SCHEMA</dt>
|
|
2400
2527
|
** <dd>The SQLITE_DBCONFIG_TRUSTED_SCHEMA option tells SQLite to
|
|
2401
2528
|
** assume that database schemas are untainted by malicious content.
|
|
2402
2529
|
** When the SQLITE_DBCONFIG_TRUSTED_SCHEMA option is disabled, SQLite
|
|
@@ -2416,16 +2543,16 @@ struct sqlite3_mem_methods {
|
|
|
2416
2543
|
** </dd>
|
|
2417
2544
|
**
|
|
2418
2545
|
** [[SQLITE_DBCONFIG_LEGACY_FILE_FORMAT]]
|
|
2419
|
-
** <dt>SQLITE_DBCONFIG_LEGACY_FILE_FORMAT</
|
|
2546
|
+
** <dt>SQLITE_DBCONFIG_LEGACY_FILE_FORMAT</dt>
|
|
2420
2547
|
** <dd>The SQLITE_DBCONFIG_LEGACY_FILE_FORMAT option activates or deactivates
|
|
2421
2548
|
** the legacy file format flag. When activated, this flag causes all newly
|
|
2422
|
-
** created database
|
|
2549
|
+
** created database files to have a schema format version number (the 4-byte
|
|
2423
2550
|
** integer found at offset 44 into the database header) of 1. This in turn
|
|
2424
2551
|
** means that the resulting database file will be readable and writable by
|
|
2425
2552
|
** any SQLite version back to 3.0.0 ([dateof:3.0.0]). Without this setting,
|
|
2426
2553
|
** newly created databases are generally not understandable by SQLite versions
|
|
2427
2554
|
** prior to 3.3.0 ([dateof:3.3.0]). As these words are written, there
|
|
2428
|
-
** is now scarcely any need to
|
|
2555
|
+
** is now scarcely any need to generate database files that are compatible
|
|
2429
2556
|
** all the way back to version 3.0.0, and so this setting is of little
|
|
2430
2557
|
** practical use, but is provided so that SQLite can continue to claim the
|
|
2431
2558
|
** ability to generate new database files that are compatible with version
|
|
@@ -2434,9 +2561,110 @@ struct sqlite3_mem_methods {
|
|
|
2434
2561
|
** the [VACUUM] command will fail with an obscure error when attempting to
|
|
2435
2562
|
** process a table with generated columns and a descending index. This is
|
|
2436
2563
|
** not considered a bug since SQLite versions 3.3.0 and earlier do not support
|
|
2437
|
-
** either generated columns or
|
|
2564
|
+
** either generated columns or descending indexes.
|
|
2438
2565
|
** </dd>
|
|
2566
|
+
**
|
|
2567
|
+
** [[SQLITE_DBCONFIG_STMT_SCANSTATUS]]
|
|
2568
|
+
** <dt>SQLITE_DBCONFIG_STMT_SCANSTATUS</dt>
|
|
2569
|
+
** <dd>The SQLITE_DBCONFIG_STMT_SCANSTATUS option is only useful in
|
|
2570
|
+
** SQLITE_ENABLE_STMT_SCANSTATUS builds. In this case, it sets or clears
|
|
2571
|
+
** a flag that enables collection of the sqlite3_stmt_scanstatus_v2()
|
|
2572
|
+
** statistics. For statistics to be collected, the flag must be set on
|
|
2573
|
+
** the database handle both when the SQL statement is prepared and when it
|
|
2574
|
+
** is stepped. The flag is set (collection of statistics is enabled)
|
|
2575
|
+
** by default. <p>This option takes two arguments: an integer and a pointer to
|
|
2576
|
+
** an integer. The first argument is 1, 0, or -1 to enable, disable, or
|
|
2577
|
+
** leave unchanged the statement scanstatus option. If the second argument
|
|
2578
|
+
** is not NULL, then the value of the statement scanstatus setting after
|
|
2579
|
+
** processing the first argument is written into the integer that the second
|
|
2580
|
+
** argument points to.
|
|
2581
|
+
** </dd>
|
|
2582
|
+
**
|
|
2583
|
+
** [[SQLITE_DBCONFIG_REVERSE_SCANORDER]]
|
|
2584
|
+
** <dt>SQLITE_DBCONFIG_REVERSE_SCANORDER</dt>
|
|
2585
|
+
** <dd>The SQLITE_DBCONFIG_REVERSE_SCANORDER option changes the default order
|
|
2586
|
+
** in which tables and indexes are scanned so that the scans start at the end
|
|
2587
|
+
** and work toward the beginning rather than starting at the beginning and
|
|
2588
|
+
** working toward the end. Setting SQLITE_DBCONFIG_REVERSE_SCANORDER is the
|
|
2589
|
+
** same as setting [PRAGMA reverse_unordered_selects]. <p>This option takes
|
|
2590
|
+
** two arguments which are an integer and a pointer to an integer. The first
|
|
2591
|
+
** argument is 1, 0, or -1 to enable, disable, or leave unchanged the
|
|
2592
|
+
** reverse scan order flag, respectively. If the second argument is not NULL,
|
|
2593
|
+
** then 0 or 1 is written into the integer that the second argument points to
|
|
2594
|
+
** depending on if the reverse scan order flag is set after processing the
|
|
2595
|
+
** first argument.
|
|
2596
|
+
** </dd>
|
|
2597
|
+
**
|
|
2598
|
+
** [[SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE]]
|
|
2599
|
+
** <dt>SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE</dt>
|
|
2600
|
+
** <dd>The SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE option enables or disables
|
|
2601
|
+
** the ability of the [ATTACH DATABASE] SQL command to create a new database
|
|
2602
|
+
** file if the database filed named in the ATTACH command does not already
|
|
2603
|
+
** exist. This ability of ATTACH to create a new database is enabled by
|
|
2604
|
+
** default. Applications can disable or reenable the ability for ATTACH to
|
|
2605
|
+
** create new database files using this DBCONFIG option.<p>
|
|
2606
|
+
** This option takes two arguments which are an integer and a pointer
|
|
2607
|
+
** to an integer. The first argument is 1, 0, or -1 to enable, disable, or
|
|
2608
|
+
** leave unchanged the attach-create flag, respectively. If the second
|
|
2609
|
+
** argument is not NULL, then 0 or 1 is written into the integer that the
|
|
2610
|
+
** second argument points to depending on if the attach-create flag is set
|
|
2611
|
+
** after processing the first argument.
|
|
2612
|
+
** </dd>
|
|
2613
|
+
**
|
|
2614
|
+
** [[SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE]]
|
|
2615
|
+
** <dt>SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE</dt>
|
|
2616
|
+
** <dd>The SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE option enables or disables the
|
|
2617
|
+
** ability of the [ATTACH DATABASE] SQL command to open a database for writing.
|
|
2618
|
+
** This capability is enabled by default. Applications can disable or
|
|
2619
|
+
** reenable this capability using the current DBCONFIG option. If
|
|
2620
|
+
** this capability is disabled, the [ATTACH] command will still work,
|
|
2621
|
+
** but the database will be opened read-only. If this option is disabled,
|
|
2622
|
+
** then the ability to create a new database using [ATTACH] is also disabled,
|
|
2623
|
+
** regardless of the value of the [SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE]
|
|
2624
|
+
** option.<p>
|
|
2625
|
+
** This option takes two arguments which are an integer and a pointer
|
|
2626
|
+
** to an integer. The first argument is 1, 0, or -1 to enable, disable, or
|
|
2627
|
+
** leave unchanged the ability to ATTACH another database for writing,
|
|
2628
|
+
** respectively. If the second argument is not NULL, then 0 or 1 is written
|
|
2629
|
+
** into the integer to which the second argument points, depending on whether
|
|
2630
|
+
** the ability to ATTACH a read/write database is enabled or disabled
|
|
2631
|
+
** after processing the first argument.
|
|
2632
|
+
** </dd>
|
|
2633
|
+
**
|
|
2634
|
+
** [[SQLITE_DBCONFIG_ENABLE_COMMENTS]]
|
|
2635
|
+
** <dt>SQLITE_DBCONFIG_ENABLE_COMMENTS</dt>
|
|
2636
|
+
** <dd>The SQLITE_DBCONFIG_ENABLE_COMMENTS option enables or disables the
|
|
2637
|
+
** ability to include comments in SQL text. Comments are enabled by default.
|
|
2638
|
+
** An application can disable or reenable comments in SQL text using this
|
|
2639
|
+
** DBCONFIG option.<p>
|
|
2640
|
+
** This option takes two arguments which are an integer and a pointer
|
|
2641
|
+
** to an integer. The first argument is 1, 0, or -1 to enable, disable, or
|
|
2642
|
+
** leave unchanged the ability to use comments in SQL text,
|
|
2643
|
+
** respectively. If the second argument is not NULL, then 0 or 1 is written
|
|
2644
|
+
** into the integer that the second argument points to depending on if
|
|
2645
|
+
** comments are allowed in SQL text after processing the first argument.
|
|
2646
|
+
** </dd>
|
|
2647
|
+
**
|
|
2439
2648
|
** </dl>
|
|
2649
|
+
**
|
|
2650
|
+
** [[DBCONFIG arguments]] <h3>Arguments To SQLITE_DBCONFIG Options</h3>
|
|
2651
|
+
**
|
|
2652
|
+
** <p>Most of the SQLITE_DBCONFIG options take two arguments, so that the
|
|
2653
|
+
** overall call to [sqlite3_db_config()] has a total of four parameters.
|
|
2654
|
+
** The first argument (the third parameter to sqlite3_db_config()) is an integer.
|
|
2655
|
+
** The second argument is a pointer to an integer. If the first argument is 1,
|
|
2656
|
+
** then the option becomes enabled. If the first integer argument is 0, then the
|
|
2657
|
+
** option is disabled. If the first argument is -1, then the option setting
|
|
2658
|
+
** is unchanged. The second argument, the pointer to an integer, may be NULL.
|
|
2659
|
+
** If the second argument is not NULL, then a value of 0 or 1 is written into
|
|
2660
|
+
** the integer to which the second argument points, depending on whether the
|
|
2661
|
+
** setting is disabled or enabled after applying any changes specified by
|
|
2662
|
+
** the first argument.
|
|
2663
|
+
**
|
|
2664
|
+
** <p>While most SQLITE_DBCONFIG options use the argument format
|
|
2665
|
+
** described in the previous paragraph, the [SQLITE_DBCONFIG_MAINDBNAME]
|
|
2666
|
+
** and [SQLITE_DBCONFIG_LOOKASIDE] options are different. See the
|
|
2667
|
+
** documentation of those exceptional options for details.
|
|
2440
2668
|
*/
|
|
2441
2669
|
#define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
|
|
2442
2670
|
#define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */
|
|
@@ -2456,7 +2684,12 @@ struct sqlite3_mem_methods {
|
|
|
2456
2684
|
#define SQLITE_DBCONFIG_ENABLE_VIEW 1015 /* int int* */
|
|
2457
2685
|
#define SQLITE_DBCONFIG_LEGACY_FILE_FORMAT 1016 /* int int* */
|
|
2458
2686
|
#define SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017 /* int int* */
|
|
2459
|
-
#define
|
|
2687
|
+
#define SQLITE_DBCONFIG_STMT_SCANSTATUS 1018 /* int int* */
|
|
2688
|
+
#define SQLITE_DBCONFIG_REVERSE_SCANORDER 1019 /* int int* */
|
|
2689
|
+
#define SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE 1020 /* int int* */
|
|
2690
|
+
#define SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE 1021 /* int int* */
|
|
2691
|
+
#define SQLITE_DBCONFIG_ENABLE_COMMENTS 1022 /* int int* */
|
|
2692
|
+
#define SQLITE_DBCONFIG_MAX 1022 /* Largest DBCONFIG */
|
|
2460
2693
|
|
|
2461
2694
|
/*
|
|
2462
2695
|
** CAPI3REF: Enable Or Disable Extended Result Codes
|
|
@@ -2548,10 +2781,14 @@ SQLITE_API void sqlite3_set_last_insert_rowid(sqlite3*,sqlite3_int64);
|
|
|
2548
2781
|
** deleted by the most recently completed INSERT, UPDATE or DELETE
|
|
2549
2782
|
** statement on the database connection specified by the only parameter.
|
|
2550
2783
|
** The two functions are identical except for the type of the return value
|
|
2551
|
-
** and that if the number of rows modified by the most recent INSERT, UPDATE
|
|
2784
|
+
** and that if the number of rows modified by the most recent INSERT, UPDATE,
|
|
2552
2785
|
** or DELETE is greater than the maximum value supported by type "int", then
|
|
2553
2786
|
** the return value of sqlite3_changes() is undefined. ^Executing any other
|
|
2554
2787
|
** type of SQL statement does not modify the value returned by these functions.
|
|
2788
|
+
** For the purposes of this interface, a CREATE TABLE AS SELECT statement
|
|
2789
|
+
** does not count as an INSERT, UPDATE or DELETE statement and hence the rows
|
|
2790
|
+
** added to the new table by the CREATE TABLE AS SELECT statement are not
|
|
2791
|
+
** counted.
|
|
2555
2792
|
**
|
|
2556
2793
|
** ^Only changes made directly by the INSERT, UPDATE or DELETE statement are
|
|
2557
2794
|
** considered - auxiliary changes caused by [CREATE TRIGGER | triggers],
|
|
@@ -2681,6 +2918,7 @@ SQLITE_API sqlite3_int64 sqlite3_total_changes64(sqlite3*);
|
|
|
2681
2918
|
**
|
|
2682
2919
|
** ^The [sqlite3_is_interrupted(D)] interface can be used to determine whether
|
|
2683
2920
|
** or not an interrupt is currently in effect for [database connection] D.
|
|
2921
|
+
** It returns 1 if an interrupt is currently in effect, or 0 otherwise.
|
|
2684
2922
|
*/
|
|
2685
2923
|
SQLITE_API void sqlite3_interrupt(sqlite3*);
|
|
2686
2924
|
SQLITE_API int sqlite3_is_interrupted(sqlite3*);
|
|
@@ -2703,7 +2941,7 @@ SQLITE_API int sqlite3_is_interrupted(sqlite3*);
|
|
|
2703
2941
|
** ^These routines return 0 if the statement is incomplete. ^If a
|
|
2704
2942
|
** memory allocation fails, then SQLITE_NOMEM is returned.
|
|
2705
2943
|
**
|
|
2706
|
-
** ^These routines do not parse the SQL statements thus
|
|
2944
|
+
** ^These routines do not parse the SQL statements and thus
|
|
2707
2945
|
** will not detect syntactically incorrect SQL.
|
|
2708
2946
|
**
|
|
2709
2947
|
** ^(If SQLite has not been initialized using [sqlite3_initialize()] prior
|
|
@@ -2805,6 +3043,44 @@ SQLITE_API int sqlite3_busy_handler(sqlite3*,int(*)(void*,int),void*);
|
|
|
2805
3043
|
*/
|
|
2806
3044
|
SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms);
|
|
2807
3045
|
|
|
3046
|
+
/*
|
|
3047
|
+
** CAPI3REF: Set the Setlk Timeout
|
|
3048
|
+
** METHOD: sqlite3
|
|
3049
|
+
**
|
|
3050
|
+
** This routine is only useful in SQLITE_ENABLE_SETLK_TIMEOUT builds. If
|
|
3051
|
+
** the VFS supports blocking locks, it sets the timeout in ms used by
|
|
3052
|
+
** eligible locks taken on wal mode databases by the specified database
|
|
3053
|
+
** handle. In non-SQLITE_ENABLE_SETLK_TIMEOUT builds, or if the VFS does
|
|
3054
|
+
** not support blocking locks, this function is a no-op.
|
|
3055
|
+
**
|
|
3056
|
+
** Passing 0 to this function disables blocking locks altogether. Passing
|
|
3057
|
+
** -1 to this function requests that the VFS blocks for a long time -
|
|
3058
|
+
** indefinitely if possible. The results of passing any other negative value
|
|
3059
|
+
** are undefined.
|
|
3060
|
+
**
|
|
3061
|
+
** Internally, each SQLite database handle stores two timeout values - the
|
|
3062
|
+
** busy-timeout (used for rollback mode databases, or if the VFS does not
|
|
3063
|
+
** support blocking locks) and the setlk-timeout (used for blocking locks
|
|
3064
|
+
** on wal-mode databases). The sqlite3_busy_timeout() method sets both
|
|
3065
|
+
** values, this function sets only the setlk-timeout value. Therefore,
|
|
3066
|
+
** to configure separate busy-timeout and setlk-timeout values for a single
|
|
3067
|
+
** database handle, call sqlite3_busy_timeout() followed by this function.
|
|
3068
|
+
**
|
|
3069
|
+
** Whenever the number of connections to a wal mode database falls from
|
|
3070
|
+
** 1 to 0, the last connection takes an exclusive lock on the database,
|
|
3071
|
+
** then checkpoints and deletes the wal file. While it is doing this, any
|
|
3072
|
+
** new connection that tries to read from the database fails with an
|
|
3073
|
+
** SQLITE_BUSY error. Or, if the SQLITE_SETLK_BLOCK_ON_CONNECT flag is
|
|
3074
|
+
** passed to this API, the new connection blocks until the exclusive lock
|
|
3075
|
+
** has been released.
|
|
3076
|
+
*/
|
|
3077
|
+
SQLITE_API int sqlite3_setlk_timeout(sqlite3*, int ms, int flags);
|
|
3078
|
+
|
|
3079
|
+
/*
|
|
3080
|
+
** CAPI3REF: Flags for sqlite3_setlk_timeout()
|
|
3081
|
+
*/
|
|
3082
|
+
#define SQLITE_SETLK_BLOCK_ON_CONNECT 0x01
|
|
3083
|
+
|
|
2808
3084
|
/*
|
|
2809
3085
|
** CAPI3REF: Convenience Routines For Running Queries
|
|
2810
3086
|
** METHOD: sqlite3
|
|
@@ -2812,7 +3088,7 @@ SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms);
|
|
|
2812
3088
|
** This is a legacy interface that is preserved for backwards compatibility.
|
|
2813
3089
|
** Use of this interface is not recommended.
|
|
2814
3090
|
**
|
|
2815
|
-
** Definition: A <b>result table</b> is memory data structure created by the
|
|
3091
|
+
** Definition: A <b>result table</b> is a memory data structure created by the
|
|
2816
3092
|
** [sqlite3_get_table()] interface. A result table records the
|
|
2817
3093
|
** complete query results from one or more queries.
|
|
2818
3094
|
**
|
|
@@ -2955,7 +3231,7 @@ SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list);
|
|
|
2955
3231
|
** ^Calling sqlite3_free() with a pointer previously returned
|
|
2956
3232
|
** by sqlite3_malloc() or sqlite3_realloc() releases that memory so
|
|
2957
3233
|
** that it might be reused. ^The sqlite3_free() routine is
|
|
2958
|
-
** a no-op if is called with a NULL pointer. Passing a NULL pointer
|
|
3234
|
+
** a no-op if it is called with a NULL pointer. Passing a NULL pointer
|
|
2959
3235
|
** to sqlite3_free() is harmless. After being freed, memory
|
|
2960
3236
|
** should neither be read nor written. Even reading previously freed
|
|
2961
3237
|
** memory might result in a segmentation fault or other severe error.
|
|
@@ -2973,13 +3249,13 @@ SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list);
|
|
|
2973
3249
|
** sqlite3_free(X).
|
|
2974
3250
|
** ^sqlite3_realloc(X,N) returns a pointer to a memory allocation
|
|
2975
3251
|
** of at least N bytes in size or NULL if insufficient memory is available.
|
|
2976
|
-
** ^If M is the size of the prior allocation, then min(N,M) bytes
|
|
2977
|
-
**
|
|
3252
|
+
** ^If M is the size of the prior allocation, then min(N,M) bytes of the
|
|
3253
|
+
** prior allocation are copied into the beginning of the buffer returned
|
|
2978
3254
|
** by sqlite3_realloc(X,N) and the prior allocation is freed.
|
|
2979
3255
|
** ^If sqlite3_realloc(X,N) returns NULL and N is positive, then the
|
|
2980
3256
|
** prior allocation is not freed.
|
|
2981
3257
|
**
|
|
2982
|
-
** ^The sqlite3_realloc64(X,N)
|
|
3258
|
+
** ^The sqlite3_realloc64(X,N) interface works the same as
|
|
2983
3259
|
** sqlite3_realloc(X,N) except that N is a 64-bit unsigned integer instead
|
|
2984
3260
|
** of a 32-bit signed integer.
|
|
2985
3261
|
**
|
|
@@ -3029,7 +3305,7 @@ SQLITE_API sqlite3_uint64 sqlite3_msize(void*);
|
|
|
3029
3305
|
** was last reset. ^The values returned by [sqlite3_memory_used()] and
|
|
3030
3306
|
** [sqlite3_memory_highwater()] include any overhead
|
|
3031
3307
|
** added by SQLite in its implementation of [sqlite3_malloc()],
|
|
3032
|
-
** but not overhead added by
|
|
3308
|
+
** but not overhead added by any underlying system library
|
|
3033
3309
|
** routines that [sqlite3_malloc()] may call.
|
|
3034
3310
|
**
|
|
3035
3311
|
** ^The memory high-water mark is reset to the current value of
|
|
@@ -3230,8 +3506,8 @@ SQLITE_API int sqlite3_set_authorizer(
|
|
|
3230
3506
|
#define SQLITE_RECURSIVE 33 /* NULL NULL */
|
|
3231
3507
|
|
|
3232
3508
|
/*
|
|
3233
|
-
** CAPI3REF: Tracing And Profiling Functions
|
|
3234
|
-
**
|
|
3509
|
+
** CAPI3REF: Deprecated Tracing And Profiling Functions
|
|
3510
|
+
** DEPRECATED
|
|
3235
3511
|
**
|
|
3236
3512
|
** These routines are deprecated. Use the [sqlite3_trace_v2()] interface
|
|
3237
3513
|
** instead of the routines described here.
|
|
@@ -3334,8 +3610,10 @@ SQLITE_API SQLITE_DEPRECATED void *sqlite3_profile(sqlite3*,
|
|
|
3334
3610
|
** M argument should be the bitwise OR-ed combination of
|
|
3335
3611
|
** zero or more [SQLITE_TRACE] constants.
|
|
3336
3612
|
**
|
|
3337
|
-
** ^Each call to either sqlite3_trace() or sqlite3_trace_v2()
|
|
3338
|
-
** (cancels)
|
|
3613
|
+
** ^Each call to either sqlite3_trace(D,X,P) or sqlite3_trace_v2(D,M,X,P)
|
|
3614
|
+
** overrides (cancels) all prior calls to sqlite3_trace(D,X,P) or
|
|
3615
|
+
** sqlite3_trace_v2(D,M,X,P) for the [database connection] D. Each
|
|
3616
|
+
** database connection may have at most one trace callback.
|
|
3339
3617
|
**
|
|
3340
3618
|
** ^The X callback is invoked whenever any of the events identified by
|
|
3341
3619
|
** mask M occur. ^The integer return value from the callback is currently
|
|
@@ -3479,7 +3757,7 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
|
|
|
3479
3757
|
** there is no harm in trying.)
|
|
3480
3758
|
**
|
|
3481
3759
|
** ^(<dt>[SQLITE_OPEN_SHAREDCACHE]</dt>
|
|
3482
|
-
** <dd>The database is opened [shared cache] enabled, overriding
|
|
3760
|
+
** <dd>The database is opened with [shared cache] enabled, overriding
|
|
3483
3761
|
** the default shared cache setting provided by
|
|
3484
3762
|
** [sqlite3_enable_shared_cache()].)^
|
|
3485
3763
|
** The [use of shared cache mode is discouraged] and hence shared cache
|
|
@@ -3487,14 +3765,14 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
|
|
|
3487
3765
|
** this option is a no-op.
|
|
3488
3766
|
**
|
|
3489
3767
|
** ^(<dt>[SQLITE_OPEN_PRIVATECACHE]</dt>
|
|
3490
|
-
** <dd>The database is opened [shared cache] disabled, overriding
|
|
3768
|
+
** <dd>The database is opened with [shared cache] disabled, overriding
|
|
3491
3769
|
** the default shared cache setting provided by
|
|
3492
3770
|
** [sqlite3_enable_shared_cache()].)^
|
|
3493
3771
|
**
|
|
3494
3772
|
** [[OPEN_EXRESCODE]] ^(<dt>[SQLITE_OPEN_EXRESCODE]</dt>
|
|
3495
3773
|
** <dd>The database connection comes up in "extended result code mode".
|
|
3496
|
-
** In other words, the database behaves
|
|
3497
|
-
** [sqlite3_extended_result_codes(db,1)]
|
|
3774
|
+
** In other words, the database behaves as if
|
|
3775
|
+
** [sqlite3_extended_result_codes(db,1)] were called on the database
|
|
3498
3776
|
** connection as soon as the connection is created. In addition to setting
|
|
3499
3777
|
** the extended result code mode, this flag also causes [sqlite3_open_v2()]
|
|
3500
3778
|
** to return an extended result code.</dd>
|
|
@@ -3704,7 +3982,7 @@ SQLITE_API int sqlite3_open_v2(
|
|
|
3704
3982
|
** as F) must be one of:
|
|
3705
3983
|
** <ul>
|
|
3706
3984
|
** <li> A database filename pointer created by the SQLite core and
|
|
3707
|
-
** passed into the xOpen() method of a VFS
|
|
3985
|
+
** passed into the xOpen() method of a VFS implementation, or
|
|
3708
3986
|
** <li> A filename obtained from [sqlite3_db_filename()], or
|
|
3709
3987
|
** <li> A new filename constructed using [sqlite3_create_filename()].
|
|
3710
3988
|
** </ul>
|
|
@@ -3817,12 +4095,12 @@ SQLITE_API sqlite3_file *sqlite3_database_file_object(const char*);
|
|
|
3817
4095
|
/*
|
|
3818
4096
|
** CAPI3REF: Create and Destroy VFS Filenames
|
|
3819
4097
|
**
|
|
3820
|
-
** These
|
|
4098
|
+
** These interfaces are provided for use by [VFS shim] implementations and
|
|
3821
4099
|
** are not useful outside of that context.
|
|
3822
4100
|
**
|
|
3823
4101
|
** The sqlite3_create_filename(D,J,W,N,P) allocates memory to hold a version of
|
|
3824
4102
|
** database filename D with corresponding journal file J and WAL file W and
|
|
3825
|
-
**
|
|
4103
|
+
** an array P of N URI Key/Value pairs. The result from
|
|
3826
4104
|
** sqlite3_create_filename(D,J,W,N,P) is a pointer to a database filename that
|
|
3827
4105
|
** is safe to pass to routines like:
|
|
3828
4106
|
** <ul>
|
|
@@ -3896,21 +4174,24 @@ SQLITE_API void sqlite3_free_filename(sqlite3_filename);
|
|
|
3896
4174
|
** </ul>
|
|
3897
4175
|
**
|
|
3898
4176
|
** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
|
|
3899
|
-
** text that describes the error, as either UTF-8 or UTF-16 respectively
|
|
4177
|
+
** text that describes the error, as either UTF-8 or UTF-16 respectively,
|
|
4178
|
+
** or NULL if no error message is available.
|
|
4179
|
+
** (See how SQLite handles [invalid UTF] for exceptions to this rule.)
|
|
3900
4180
|
** ^(Memory to hold the error message string is managed internally.
|
|
3901
4181
|
** The application does not need to worry about freeing the result.
|
|
3902
4182
|
** However, the error string might be overwritten or deallocated by
|
|
3903
4183
|
** subsequent calls to other SQLite interface functions.)^
|
|
3904
4184
|
**
|
|
3905
|
-
** ^The sqlite3_errstr() interface returns the English-language text
|
|
3906
|
-
** that describes the [result code], as UTF-8
|
|
4185
|
+
** ^The sqlite3_errstr(E) interface returns the English-language text
|
|
4186
|
+
** that describes the [result code] E, as UTF-8, or NULL if E is not a
|
|
4187
|
+
** result code for which a text error message is available.
|
|
3907
4188
|
** ^(Memory to hold the error message string is managed internally
|
|
3908
4189
|
** and must not be freed by the application)^.
|
|
3909
4190
|
**
|
|
3910
4191
|
** ^If the most recent error references a specific token in the input
|
|
3911
4192
|
** SQL, the sqlite3_error_offset() interface returns the byte offset
|
|
3912
4193
|
** of the start of that token. ^The byte offset returned by
|
|
3913
|
-
** sqlite3_error_offset() assumes that the input SQL is
|
|
4194
|
+
** sqlite3_error_offset() assumes that the input SQL is UTF-8.
|
|
3914
4195
|
** ^If the most recent error does not reference a specific token in the input
|
|
3915
4196
|
** SQL, then the sqlite3_error_offset() function returns -1.
|
|
3916
4197
|
**
|
|
@@ -3935,6 +4216,34 @@ SQLITE_API const void *sqlite3_errmsg16(sqlite3*);
|
|
|
3935
4216
|
SQLITE_API const char *sqlite3_errstr(int);
|
|
3936
4217
|
SQLITE_API int sqlite3_error_offset(sqlite3 *db);
|
|
3937
4218
|
|
|
4219
|
+
/*
|
|
4220
|
+
** CAPI3REF: Set Error Codes And Message
|
|
4221
|
+
** METHOD: sqlite3
|
|
4222
|
+
**
|
|
4223
|
+
** Set the error code of the database handle passed as the first argument
|
|
4224
|
+
** to errcode, and the error message to a copy of nul-terminated string
|
|
4225
|
+
** zErrMsg. If zErrMsg is passed NULL, then the error message is set to
|
|
4226
|
+
** the default message associated with the supplied error code. Subsequent
|
|
4227
|
+
** calls to [sqlite3_errcode()] and [sqlite3_errmsg()] and similar will
|
|
4228
|
+
** return the values set by this routine in place of what was previously
|
|
4229
|
+
** set by SQLite itself.
|
|
4230
|
+
**
|
|
4231
|
+
** This function returns SQLITE_OK if the error code and error message are
|
|
4232
|
+
** successfully set, SQLITE_NOMEM if an OOM occurs, and SQLITE_MISUSE if
|
|
4233
|
+
** the database handle is NULL or invalid.
|
|
4234
|
+
**
|
|
4235
|
+
** The error code and message set by this routine remains in effect until
|
|
4236
|
+
** they are changed, either by another call to this routine or until they are
|
|
4237
|
+
** changed to by SQLite itself to reflect the result of some subsquent
|
|
4238
|
+
** API call.
|
|
4239
|
+
**
|
|
4240
|
+
** This function is intended for use by SQLite extensions or wrappers. The
|
|
4241
|
+
** idea is that an extension or wrapper can use this routine to set error
|
|
4242
|
+
** messages and error codes and thus behave more like a core SQLite
|
|
4243
|
+
** feature from the point of view of an application.
|
|
4244
|
+
*/
|
|
4245
|
+
SQLITE_API int sqlite3_set_errmsg(sqlite3 *db, int errcode, const char *zErrMsg);
|
|
4246
|
+
|
|
3938
4247
|
/*
|
|
3939
4248
|
** CAPI3REF: Prepared Statement Object
|
|
3940
4249
|
** KEYWORDS: {prepared statement} {prepared statements}
|
|
@@ -4009,8 +4318,8 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
|
|
|
4009
4318
|
**
|
|
4010
4319
|
** These constants define various performance limits
|
|
4011
4320
|
** that can be lowered at run-time using [sqlite3_limit()].
|
|
4012
|
-
**
|
|
4013
|
-
**
|
|
4321
|
+
** A concise description of these limits follows, and additional information
|
|
4322
|
+
** is available at [limits | Limits in SQLite].
|
|
4014
4323
|
**
|
|
4015
4324
|
** <dl>
|
|
4016
4325
|
** [[SQLITE_LIMIT_LENGTH]] ^(<dt>SQLITE_LIMIT_LENGTH</dt>
|
|
@@ -4075,7 +4384,7 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
|
|
|
4075
4384
|
/*
|
|
4076
4385
|
** CAPI3REF: Prepare Flags
|
|
4077
4386
|
**
|
|
4078
|
-
** These constants define various flags that can be passed into
|
|
4387
|
+
** These constants define various flags that can be passed into the
|
|
4079
4388
|
** "prepFlags" parameter of the [sqlite3_prepare_v3()] and
|
|
4080
4389
|
** [sqlite3_prepare16_v3()] interfaces.
|
|
4081
4390
|
**
|
|
@@ -4105,11 +4414,22 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
|
|
|
4105
4414
|
** <dd>The SQLITE_PREPARE_NO_VTAB flag causes the SQL compiler
|
|
4106
4415
|
** to return an error (error code SQLITE_ERROR) if the statement uses
|
|
4107
4416
|
** any virtual tables.
|
|
4417
|
+
**
|
|
4418
|
+
** [[SQLITE_PREPARE_DONT_LOG]] <dt>SQLITE_PREPARE_DONT_LOG</dt>
|
|
4419
|
+
** <dd>The SQLITE_PREPARE_DONT_LOG flag prevents SQL compiler
|
|
4420
|
+
** errors from being sent to the error log defined by
|
|
4421
|
+
** [SQLITE_CONFIG_LOG]. This can be used, for example, to do test
|
|
4422
|
+
** compiles to see if some SQL syntax is well-formed, without generating
|
|
4423
|
+
** messages on the global error log when it is not. If the test compile
|
|
4424
|
+
** fails, the sqlite3_prepare_v3() call returns the same error indications
|
|
4425
|
+
** with or without this flag; it just omits the call to [sqlite3_log()] that
|
|
4426
|
+
** logs the error.
|
|
4108
4427
|
** </dl>
|
|
4109
4428
|
*/
|
|
4110
4429
|
#define SQLITE_PREPARE_PERSISTENT 0x01
|
|
4111
4430
|
#define SQLITE_PREPARE_NORMALIZE 0x02
|
|
4112
4431
|
#define SQLITE_PREPARE_NO_VTAB 0x04
|
|
4432
|
+
#define SQLITE_PREPARE_DONT_LOG 0x10
|
|
4113
4433
|
|
|
4114
4434
|
/*
|
|
4115
4435
|
** CAPI3REF: Compiling An SQL Statement
|
|
@@ -4142,13 +4462,17 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
|
|
|
4142
4462
|
** and sqlite3_prepare16_v3() use UTF-16.
|
|
4143
4463
|
**
|
|
4144
4464
|
** ^If the nByte argument is negative, then zSql is read up to the
|
|
4145
|
-
** first zero terminator. ^If nByte is positive, then it is the
|
|
4146
|
-
** number of bytes read from zSql.
|
|
4465
|
+
** first zero terminator. ^If nByte is positive, then it is the maximum
|
|
4466
|
+
** number of bytes read from zSql. When nByte is positive, zSql is read
|
|
4467
|
+
** up to the first zero terminator or until the nByte bytes have been read,
|
|
4468
|
+
** whichever comes first. ^If nByte is zero, then no prepared
|
|
4147
4469
|
** statement is generated.
|
|
4148
4470
|
** If the caller knows that the supplied string is nul-terminated, then
|
|
4149
4471
|
** there is a small performance advantage to passing an nByte parameter that
|
|
4150
4472
|
** is the number of bytes in the input string <i>including</i>
|
|
4151
4473
|
** the nul-terminator.
|
|
4474
|
+
** Note that nByte measures the length of the input in bytes, not
|
|
4475
|
+
** characters, even for the UTF-16 interfaces.
|
|
4152
4476
|
**
|
|
4153
4477
|
** ^If pzTail is not NULL then *pzTail is made to point to the first byte
|
|
4154
4478
|
** past the end of the first SQL statement in zSql. These routines only
|
|
@@ -4281,7 +4605,7 @@ SQLITE_API int sqlite3_prepare16_v3(
|
|
|
4281
4605
|
**
|
|
4282
4606
|
** ^The sqlite3_expanded_sql() interface returns NULL if insufficient memory
|
|
4283
4607
|
** is available to hold the result, or if the result would exceed the
|
|
4284
|
-
**
|
|
4608
|
+
** maximum string length determined by the [SQLITE_LIMIT_LENGTH].
|
|
4285
4609
|
**
|
|
4286
4610
|
** ^The [SQLITE_TRACE_SIZE_LIMIT] compile-time option limits the size of
|
|
4287
4611
|
** bound parameter expansions. ^The [SQLITE_OMIT_TRACE] compile-time
|
|
@@ -4364,6 +4688,41 @@ SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
|
|
|
4364
4688
|
*/
|
|
4365
4689
|
SQLITE_API int sqlite3_stmt_isexplain(sqlite3_stmt *pStmt);
|
|
4366
4690
|
|
|
4691
|
+
/*
|
|
4692
|
+
** CAPI3REF: Change The EXPLAIN Setting For A Prepared Statement
|
|
4693
|
+
** METHOD: sqlite3_stmt
|
|
4694
|
+
**
|
|
4695
|
+
** The sqlite3_stmt_explain(S,E) interface changes the EXPLAIN
|
|
4696
|
+
** setting for [prepared statement] S. If E is zero, then S becomes
|
|
4697
|
+
** a normal prepared statement. If E is 1, then S behaves as if
|
|
4698
|
+
** its SQL text began with "[EXPLAIN]". If E is 2, then S behaves as if
|
|
4699
|
+
** its SQL text began with "[EXPLAIN QUERY PLAN]".
|
|
4700
|
+
**
|
|
4701
|
+
** Calling sqlite3_stmt_explain(S,E) might cause S to be reprepared.
|
|
4702
|
+
** SQLite tries to avoid a reprepare, but a reprepare might be necessary
|
|
4703
|
+
** on the first transition into EXPLAIN or EXPLAIN QUERY PLAN mode.
|
|
4704
|
+
**
|
|
4705
|
+
** Because of the potential need to reprepare, a call to
|
|
4706
|
+
** sqlite3_stmt_explain(S,E) will fail with SQLITE_ERROR if S cannot be
|
|
4707
|
+
** reprepared because it was created using [sqlite3_prepare()] instead of
|
|
4708
|
+
** the newer [sqlite3_prepare_v2()] or [sqlite3_prepare_v3()] interfaces and
|
|
4709
|
+
** hence has no saved SQL text with which to reprepare.
|
|
4710
|
+
**
|
|
4711
|
+
** Changing the explain setting for a prepared statement does not change
|
|
4712
|
+
** the original SQL text for the statement. Hence, if the SQL text originally
|
|
4713
|
+
** began with EXPLAIN or EXPLAIN QUERY PLAN, but sqlite3_stmt_explain(S,0)
|
|
4714
|
+
** is called to convert the statement into an ordinary statement, the EXPLAIN
|
|
4715
|
+
** or EXPLAIN QUERY PLAN keywords will still appear in the sqlite3_sql(S)
|
|
4716
|
+
** output, even though the statement now acts like a normal SQL statement.
|
|
4717
|
+
**
|
|
4718
|
+
** This routine returns SQLITE_OK if the explain mode is successfully
|
|
4719
|
+
** changed, or an error code if the explain mode could not be changed.
|
|
4720
|
+
** The explain mode cannot be changed while a statement is active.
|
|
4721
|
+
** Hence, it is good practice to call [sqlite3_reset(S)]
|
|
4722
|
+
** immediately prior to calling sqlite3_stmt_explain(S,E).
|
|
4723
|
+
*/
|
|
4724
|
+
SQLITE_API int sqlite3_stmt_explain(sqlite3_stmt *pStmt, int eMode);
|
|
4725
|
+
|
|
4367
4726
|
/*
|
|
4368
4727
|
** CAPI3REF: Determine If A Prepared Statement Has Been Reset
|
|
4369
4728
|
** METHOD: sqlite3_stmt
|
|
@@ -4434,7 +4793,7 @@ typedef struct sqlite3_value sqlite3_value;
|
|
|
4434
4793
|
**
|
|
4435
4794
|
** The context in which an SQL function executes is stored in an
|
|
4436
4795
|
** sqlite3_context object. ^A pointer to an sqlite3_context object
|
|
4437
|
-
** is always first parameter to [application-defined SQL functions].
|
|
4796
|
+
** is always the first parameter to [application-defined SQL functions].
|
|
4438
4797
|
** The application-defined SQL function implementation will pass this
|
|
4439
4798
|
** pointer through into calls to [sqlite3_result_int | sqlite3_result()],
|
|
4440
4799
|
** [sqlite3_aggregate_context()], [sqlite3_user_data()],
|
|
@@ -4450,7 +4809,7 @@ typedef struct sqlite3_context sqlite3_context;
|
|
|
4450
4809
|
** METHOD: sqlite3_stmt
|
|
4451
4810
|
**
|
|
4452
4811
|
** ^(In the SQL statement text input to [sqlite3_prepare_v2()] and its variants,
|
|
4453
|
-
** literals may be replaced by a [parameter] that matches one of following
|
|
4812
|
+
** literals may be replaced by a [parameter] that matches one of the following
|
|
4454
4813
|
** templates:
|
|
4455
4814
|
**
|
|
4456
4815
|
** <ul>
|
|
@@ -4495,7 +4854,7 @@ typedef struct sqlite3_context sqlite3_context;
|
|
|
4495
4854
|
**
|
|
4496
4855
|
** [[byte-order determination rules]] ^The byte-order of
|
|
4497
4856
|
** UTF16 input text is determined by the byte-order mark (BOM, U+FEFF)
|
|
4498
|
-
** found in first character, which is removed, or in the absence of a BOM
|
|
4857
|
+
** found in the first character, which is removed, or in the absence of a BOM
|
|
4499
4858
|
** the byte order is the native byte order of the host
|
|
4500
4859
|
** machine for sqlite3_bind_text16() or the byte order specified in
|
|
4501
4860
|
** the 6th parameter for sqlite3_bind_text64().)^
|
|
@@ -4515,7 +4874,7 @@ typedef struct sqlite3_context sqlite3_context;
|
|
|
4515
4874
|
** or sqlite3_bind_text16() or sqlite3_bind_text64() then
|
|
4516
4875
|
** that parameter must be the byte offset
|
|
4517
4876
|
** where the NUL terminator would occur assuming the string were NUL
|
|
4518
|
-
** terminated. If any NUL characters
|
|
4877
|
+
** terminated. If any NUL characters occur at byte offsets less than
|
|
4519
4878
|
** the value of the fourth parameter then the resulting string value will
|
|
4520
4879
|
** contain embedded NULs. The result of expressions involving strings
|
|
4521
4880
|
** with embedded NULs is undefined.
|
|
@@ -4527,7 +4886,7 @@ typedef struct sqlite3_context sqlite3_context;
|
|
|
4527
4886
|
** with it may be passed. ^It is called to dispose of the BLOB or string even
|
|
4528
4887
|
** if the call to the bind API fails, except the destructor is not called if
|
|
4529
4888
|
** the third parameter is a NULL pointer or the fourth parameter is negative.
|
|
4530
|
-
** ^ (2) The special constant, [SQLITE_STATIC], may be
|
|
4889
|
+
** ^ (2) The special constant, [SQLITE_STATIC], may be passed to indicate that
|
|
4531
4890
|
** the application remains responsible for disposing of the object. ^In this
|
|
4532
4891
|
** case, the object and the provided pointer to it must remain valid until
|
|
4533
4892
|
** either the prepared statement is finalized or the same SQL parameter is
|
|
@@ -4558,9 +4917,11 @@ typedef struct sqlite3_context sqlite3_context;
|
|
|
4558
4917
|
** associated with the pointer P of type T. ^D is either a NULL pointer or
|
|
4559
4918
|
** a pointer to a destructor function for P. ^SQLite will invoke the
|
|
4560
4919
|
** destructor D with a single argument of P when it is finished using
|
|
4561
|
-
** P
|
|
4562
|
-
**
|
|
4563
|
-
**
|
|
4920
|
+
** P, even if the call to sqlite3_bind_pointer() fails. Due to a
|
|
4921
|
+
** historical design quirk, results are undefined if D is
|
|
4922
|
+
** SQLITE_TRANSIENT. The T parameter should be a static string,
|
|
4923
|
+
** preferably a string literal. The sqlite3_bind_pointer() routine is
|
|
4924
|
+
** part of the [pointer passing interface] added for SQLite 3.20.0.
|
|
4564
4925
|
**
|
|
4565
4926
|
** ^If any of the sqlite3_bind_*() routines are called with a NULL pointer
|
|
4566
4927
|
** for the [prepared statement] or with a prepared statement for which
|
|
@@ -4727,7 +5088,7 @@ SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt*, int N);
|
|
|
4727
5088
|
** METHOD: sqlite3_stmt
|
|
4728
5089
|
**
|
|
4729
5090
|
** ^These routines provide a means to determine the database, table, and
|
|
4730
|
-
** table column that is the origin of a particular result column in
|
|
5091
|
+
** table column that is the origin of a particular result column in a
|
|
4731
5092
|
** [SELECT] statement.
|
|
4732
5093
|
** ^The name of the database or table or column can be returned as
|
|
4733
5094
|
** either a UTF-8 or UTF-16 string. ^The _database_ routines return
|
|
@@ -4865,7 +5226,7 @@ SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
|
|
|
4865
5226
|
** other than [SQLITE_ROW] before any subsequent invocation of
|
|
4866
5227
|
** sqlite3_step(). Failure to reset the prepared statement using
|
|
4867
5228
|
** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from
|
|
4868
|
-
** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1],
|
|
5229
|
+
** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1]),
|
|
4869
5230
|
** sqlite3_step() began
|
|
4870
5231
|
** calling [sqlite3_reset()] automatically in this circumstance rather
|
|
4871
5232
|
** than returning [SQLITE_MISUSE]. This is not considered a compatibility
|
|
@@ -5171,7 +5532,7 @@ SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol);
|
|
|
5171
5532
|
**
|
|
5172
5533
|
** ^The sqlite3_finalize() function is called to delete a [prepared statement].
|
|
5173
5534
|
** ^If the most recent evaluation of the statement encountered no errors
|
|
5174
|
-
** or if the statement
|
|
5535
|
+
** or if the statement has never been evaluated, then sqlite3_finalize() returns
|
|
5175
5536
|
** SQLITE_OK. ^If the most recent evaluation of statement S failed, then
|
|
5176
5537
|
** sqlite3_finalize(S) returns the appropriate [error code] or
|
|
5177
5538
|
** [extended error code].
|
|
@@ -5206,20 +5567,33 @@ SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt);
|
|
|
5206
5567
|
** ^The [sqlite3_reset(S)] interface resets the [prepared statement] S
|
|
5207
5568
|
** back to the beginning of its program.
|
|
5208
5569
|
**
|
|
5209
|
-
** ^
|
|
5210
|
-
**
|
|
5211
|
-
**
|
|
5212
|
-
**
|
|
5570
|
+
** ^The return code from [sqlite3_reset(S)] indicates whether or not
|
|
5571
|
+
** the previous evaluation of prepared statement S completed successfully.
|
|
5572
|
+
** ^If [sqlite3_step(S)] has never before been called on S or if
|
|
5573
|
+
** [sqlite3_step(S)] has not been called since the previous call
|
|
5574
|
+
** to [sqlite3_reset(S)], then [sqlite3_reset(S)] will return
|
|
5575
|
+
** [SQLITE_OK].
|
|
5213
5576
|
**
|
|
5214
5577
|
** ^If the most recent call to [sqlite3_step(S)] for the
|
|
5215
5578
|
** [prepared statement] S indicated an error, then
|
|
5216
5579
|
** [sqlite3_reset(S)] returns an appropriate [error code].
|
|
5580
|
+
** ^The [sqlite3_reset(S)] interface might also return an [error code]
|
|
5581
|
+
** if there were no prior errors but the process of resetting
|
|
5582
|
+
** the prepared statement caused a new error. ^For example, if an
|
|
5583
|
+
** [INSERT] statement with a [RETURNING] clause is only stepped one time,
|
|
5584
|
+
** that one call to [sqlite3_step(S)] might return SQLITE_ROW but
|
|
5585
|
+
** the overall statement might still fail and the [sqlite3_reset(S)] call
|
|
5586
|
+
** might return SQLITE_BUSY if locking constraints prevent the
|
|
5587
|
+
** database change from committing. Therefore, it is important that
|
|
5588
|
+
** applications check the return code from [sqlite3_reset(S)] even if
|
|
5589
|
+
** no prior call to [sqlite3_step(S)] indicated a problem.
|
|
5217
5590
|
**
|
|
5218
5591
|
** ^The [sqlite3_reset(S)] interface does not change the values
|
|
5219
5592
|
** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S.
|
|
5220
5593
|
*/
|
|
5221
5594
|
SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
|
|
5222
5595
|
|
|
5596
|
+
|
|
5223
5597
|
/*
|
|
5224
5598
|
** CAPI3REF: Create Or Redefine SQL Functions
|
|
5225
5599
|
** KEYWORDS: {function creation routines}
|
|
@@ -5283,8 +5657,8 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
|
|
|
5283
5657
|
**
|
|
5284
5658
|
** For best security, the [SQLITE_DIRECTONLY] flag is recommended for
|
|
5285
5659
|
** all application-defined SQL functions that do not need to be
|
|
5286
|
-
** used inside of triggers,
|
|
5287
|
-
** the database schema. This
|
|
5660
|
+
** used inside of triggers, views, CHECK constraints, or other elements of
|
|
5661
|
+
** the database schema. This flag is especially recommended for SQL
|
|
5288
5662
|
** functions that have side effects or reveal internal application state.
|
|
5289
5663
|
** Without this flag, an attacker might be able to modify the schema of
|
|
5290
5664
|
** a database file to include invocations of the function with parameters
|
|
@@ -5315,7 +5689,7 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
|
|
|
5315
5689
|
** [user-defined window functions|available here].
|
|
5316
5690
|
**
|
|
5317
5691
|
** ^(If the final parameter to sqlite3_create_function_v2() or
|
|
5318
|
-
** sqlite3_create_window_function() is not NULL, then it is destructor for
|
|
5692
|
+
** sqlite3_create_window_function() is not NULL, then it is the destructor for
|
|
5319
5693
|
** the application data pointer. The destructor is invoked when the function
|
|
5320
5694
|
** is deleted, either by being overloaded or when the database connection
|
|
5321
5695
|
** closes.)^ ^The destructor is also invoked if the call to
|
|
@@ -5390,7 +5764,7 @@ SQLITE_API int sqlite3_create_window_function(
|
|
|
5390
5764
|
/*
|
|
5391
5765
|
** CAPI3REF: Text Encodings
|
|
5392
5766
|
**
|
|
5393
|
-
** These
|
|
5767
|
+
** These constants define integer codes that represent the various
|
|
5394
5768
|
** text encodings supported by SQLite.
|
|
5395
5769
|
*/
|
|
5396
5770
|
#define SQLITE_UTF8 1 /* IMP: R-37514-35566 */
|
|
@@ -5430,7 +5804,7 @@ SQLITE_API int sqlite3_create_window_function(
|
|
|
5430
5804
|
** [application-defined SQL function]
|
|
5431
5805
|
** that has side-effects or that could potentially leak sensitive information.
|
|
5432
5806
|
** This will prevent attacks in which an application is tricked
|
|
5433
|
-
** into using a database file that has had its schema
|
|
5807
|
+
** into using a database file that has had its schema surreptitiously
|
|
5434
5808
|
** modified to invoke the application-defined function in ways that are
|
|
5435
5809
|
** harmful.
|
|
5436
5810
|
** <p>
|
|
@@ -5466,13 +5840,36 @@ SQLITE_API int sqlite3_create_window_function(
|
|
|
5466
5840
|
** </dd>
|
|
5467
5841
|
**
|
|
5468
5842
|
** [[SQLITE_SUBTYPE]] <dt>SQLITE_SUBTYPE</dt><dd>
|
|
5469
|
-
** The SQLITE_SUBTYPE flag indicates to SQLite that a function
|
|
5843
|
+
** The SQLITE_SUBTYPE flag indicates to SQLite that a function might call
|
|
5470
5844
|
** [sqlite3_value_subtype()] to inspect the sub-types of its arguments.
|
|
5471
|
-
**
|
|
5472
|
-
**
|
|
5473
|
-
**
|
|
5474
|
-
**
|
|
5475
|
-
**
|
|
5845
|
+
** This flag instructs SQLite to omit some corner-case optimizations that
|
|
5846
|
+
** might disrupt the operation of the [sqlite3_value_subtype()] function,
|
|
5847
|
+
** causing it to return zero rather than the correct subtype().
|
|
5848
|
+
** All SQL functions that invoke [sqlite3_value_subtype()] should have this
|
|
5849
|
+
** property. If the SQLITE_SUBTYPE property is omitted, then the return
|
|
5850
|
+
** value from [sqlite3_value_subtype()] might sometimes be zero even though
|
|
5851
|
+
** a non-zero subtype was specified by the function argument expression.
|
|
5852
|
+
**
|
|
5853
|
+
** [[SQLITE_RESULT_SUBTYPE]] <dt>SQLITE_RESULT_SUBTYPE</dt><dd>
|
|
5854
|
+
** The SQLITE_RESULT_SUBTYPE flag indicates to SQLite that a function might call
|
|
5855
|
+
** [sqlite3_result_subtype()] to cause a sub-type to be associated with its
|
|
5856
|
+
** result.
|
|
5857
|
+
** Every function that invokes [sqlite3_result_subtype()] should have this
|
|
5858
|
+
** property. If it does not, then the call to [sqlite3_result_subtype()]
|
|
5859
|
+
** might become a no-op if the function is used as a term in an
|
|
5860
|
+
** [expression index]. On the other hand, SQL functions that never invoke
|
|
5861
|
+
** [sqlite3_result_subtype()] should avoid setting this property, as the
|
|
5862
|
+
** purpose of this property is to disable certain optimizations that are
|
|
5863
|
+
** incompatible with subtypes.
|
|
5864
|
+
**
|
|
5865
|
+
** [[SQLITE_SELFORDER1]] <dt>SQLITE_SELFORDER1</dt><dd>
|
|
5866
|
+
** The SQLITE_SELFORDER1 flag indicates that the function is an aggregate
|
|
5867
|
+
** that internally orders the values provided to the first argument. The
|
|
5868
|
+
** ordered-set aggregate SQL notation with a single ORDER BY term can be
|
|
5869
|
+
** used to invoke this function. If the ordered-set aggregate notation is
|
|
5870
|
+
** used on a function that lacks this flag, then an error is raised. Note
|
|
5871
|
+
** that the ordered-set aggregate syntax is only available if SQLite is
|
|
5872
|
+
** built using the -DSQLITE_ENABLE_ORDERED_SET_AGGREGATES compile-time option.
|
|
5476
5873
|
** </dd>
|
|
5477
5874
|
** </dl>
|
|
5478
5875
|
*/
|
|
@@ -5480,6 +5877,8 @@ SQLITE_API int sqlite3_create_window_function(
|
|
|
5480
5877
|
#define SQLITE_DIRECTONLY 0x000080000
|
|
5481
5878
|
#define SQLITE_SUBTYPE 0x000100000
|
|
5482
5879
|
#define SQLITE_INNOCUOUS 0x000200000
|
|
5880
|
+
#define SQLITE_RESULT_SUBTYPE 0x001000000
|
|
5881
|
+
#define SQLITE_SELFORDER1 0x002000000
|
|
5483
5882
|
|
|
5484
5883
|
/*
|
|
5485
5884
|
** CAPI3REF: Deprecated Functions
|
|
@@ -5584,7 +5983,7 @@ SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int6
|
|
|
5584
5983
|
** sqlite3_value_nochange(X) interface returns true if and only if
|
|
5585
5984
|
** the column corresponding to X is unchanged by the UPDATE operation
|
|
5586
5985
|
** that the xUpdate method call was invoked to implement and if
|
|
5587
|
-
**
|
|
5986
|
+
** the prior [xColumn] method call that was invoked to extract
|
|
5588
5987
|
** the value for that column returned without setting a result (probably
|
|
5589
5988
|
** because it queried [sqlite3_vtab_nochange()] and found that the column
|
|
5590
5989
|
** was unchanging). ^Within an [xUpdate] method, any value for which
|
|
@@ -5676,6 +6075,12 @@ SQLITE_API int sqlite3_value_encoding(sqlite3_value*);
|
|
|
5676
6075
|
** information can be used to pass a limited amount of context from
|
|
5677
6076
|
** one SQL function to another. Use the [sqlite3_result_subtype()]
|
|
5678
6077
|
** routine to set the subtype for the return value of an SQL function.
|
|
6078
|
+
**
|
|
6079
|
+
** Every [application-defined SQL function] that invokes this interface
|
|
6080
|
+
** should include the [SQLITE_SUBTYPE] property in the text
|
|
6081
|
+
** encoding argument when the function is [sqlite3_create_function|registered].
|
|
6082
|
+
** If the [SQLITE_SUBTYPE] property is omitted, then sqlite3_value_subtype()
|
|
6083
|
+
** might return zero instead of the upstream subtype in some corner cases.
|
|
5679
6084
|
*/
|
|
5680
6085
|
SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value*);
|
|
5681
6086
|
|
|
@@ -5684,7 +6089,7 @@ SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value*);
|
|
|
5684
6089
|
** METHOD: sqlite3_value
|
|
5685
6090
|
**
|
|
5686
6091
|
** ^The sqlite3_value_dup(V) interface makes a copy of the [sqlite3_value]
|
|
5687
|
-
** object
|
|
6092
|
+
** object V and returns a pointer to that copy. ^The [sqlite3_value] returned
|
|
5688
6093
|
** is a [protected sqlite3_value] object even if the input is not.
|
|
5689
6094
|
** ^The sqlite3_value_dup(V) interface returns NULL if V is NULL or if a
|
|
5690
6095
|
** memory allocation fails. ^If V is a [pointer value], then the result
|
|
@@ -5722,7 +6127,7 @@ SQLITE_API void sqlite3_value_free(sqlite3_value*);
|
|
|
5722
6127
|
** allocation error occurs.
|
|
5723
6128
|
**
|
|
5724
6129
|
** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is
|
|
5725
|
-
** determined by the N parameter on first successful call. Changing the
|
|
6130
|
+
** determined by the N parameter on the first successful call. Changing the
|
|
5726
6131
|
** value of N in any subsequent call to sqlite3_aggregate_context() within
|
|
5727
6132
|
** the same aggregate function instance will not resize the memory
|
|
5728
6133
|
** allocation.)^ Within the xFinal callback, it is customary to set
|
|
@@ -5774,48 +6179,56 @@ SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*);
|
|
|
5774
6179
|
** METHOD: sqlite3_context
|
|
5775
6180
|
**
|
|
5776
6181
|
** These functions may be used by (non-aggregate) SQL functions to
|
|
5777
|
-
** associate
|
|
5778
|
-
** multiple invocations of the same SQL function during
|
|
5779
|
-
** some circumstances the associated
|
|
5780
|
-
** of where this might be useful is in a
|
|
5781
|
-
** function. The compiled version of the regular
|
|
5782
|
-
**
|
|
6182
|
+
** associate auxiliary data with argument values. If the same argument
|
|
6183
|
+
** value is passed to multiple invocations of the same SQL function during
|
|
6184
|
+
** query execution, under some circumstances the associated auxiliary data
|
|
6185
|
+
** might be preserved. An example of where this might be useful is in a
|
|
6186
|
+
** regular-expression matching function. The compiled version of the regular
|
|
6187
|
+
** expression can be stored as auxiliary data associated with the pattern string.
|
|
5783
6188
|
** Then as long as the pattern string remains the same,
|
|
5784
6189
|
** the compiled regular expression can be reused on multiple
|
|
5785
6190
|
** invocations of the same function.
|
|
5786
6191
|
**
|
|
5787
|
-
** ^The sqlite3_get_auxdata(C,N) interface returns a pointer to the
|
|
6192
|
+
** ^The sqlite3_get_auxdata(C,N) interface returns a pointer to the auxiliary data
|
|
5788
6193
|
** associated by the sqlite3_set_auxdata(C,N,P,X) function with the Nth argument
|
|
5789
6194
|
** value to the application-defined function. ^N is zero for the left-most
|
|
5790
|
-
** function argument. ^If there is no
|
|
6195
|
+
** function argument. ^If there is no auxiliary data
|
|
5791
6196
|
** associated with the function argument, the sqlite3_get_auxdata(C,N) interface
|
|
5792
6197
|
** returns a NULL pointer.
|
|
5793
6198
|
**
|
|
5794
|
-
** ^The sqlite3_set_auxdata(C,N,P,X) interface saves P as
|
|
5795
|
-
** argument of the application-defined function. ^Subsequent
|
|
6199
|
+
** ^The sqlite3_set_auxdata(C,N,P,X) interface saves P as auxiliary data for the
|
|
6200
|
+
** N-th argument of the application-defined function. ^Subsequent
|
|
5796
6201
|
** calls to sqlite3_get_auxdata(C,N) return P from the most recent
|
|
5797
|
-
** sqlite3_set_auxdata(C,N,P,X) call if the
|
|
5798
|
-
** NULL if the
|
|
6202
|
+
** sqlite3_set_auxdata(C,N,P,X) call if the auxiliary data is still valid or
|
|
6203
|
+
** NULL if the auxiliary data has been discarded.
|
|
5799
6204
|
** ^After each call to sqlite3_set_auxdata(C,N,P,X) where X is not NULL,
|
|
5800
6205
|
** SQLite will invoke the destructor function X with parameter P exactly
|
|
5801
|
-
** once, when the
|
|
5802
|
-
** SQLite is free to discard the
|
|
6206
|
+
** once, when the auxiliary data is discarded.
|
|
6207
|
+
** SQLite is free to discard the auxiliary data at any time, including: <ul>
|
|
5803
6208
|
** <li> ^(when the corresponding function parameter changes)^, or
|
|
5804
6209
|
** <li> ^(when [sqlite3_reset()] or [sqlite3_finalize()] is called for the
|
|
5805
6210
|
** SQL statement)^, or
|
|
5806
6211
|
** <li> ^(when sqlite3_set_auxdata() is invoked again on the same
|
|
5807
6212
|
** parameter)^, or
|
|
5808
6213
|
** <li> ^(during the original sqlite3_set_auxdata() call when a memory
|
|
5809
|
-
** allocation error occurs.)^
|
|
6214
|
+
** allocation error occurs.)^
|
|
6215
|
+
** <li> ^(during the original sqlite3_set_auxdata() call if the function
|
|
6216
|
+
** is evaluated during query planning instead of during query execution,
|
|
6217
|
+
** as sometimes happens with [SQLITE_ENABLE_STAT4].)^ </ul>
|
|
5810
6218
|
**
|
|
5811
|
-
** Note the last
|
|
6219
|
+
** Note the last two bullets in particular. The destructor X in
|
|
5812
6220
|
** sqlite3_set_auxdata(C,N,P,X) might be called immediately, before the
|
|
5813
6221
|
** sqlite3_set_auxdata() interface even returns. Hence sqlite3_set_auxdata()
|
|
5814
6222
|
** should be called near the end of the function implementation and the
|
|
5815
6223
|
** function implementation should not make any use of P after
|
|
5816
|
-
** sqlite3_set_auxdata() has been called.
|
|
5817
|
-
**
|
|
5818
|
-
**
|
|
6224
|
+
** sqlite3_set_auxdata() has been called. Furthermore, a call to
|
|
6225
|
+
** sqlite3_get_auxdata() that occurs immediately after a corresponding call
|
|
6226
|
+
** to sqlite3_set_auxdata() might still return NULL if an out-of-memory
|
|
6227
|
+
** condition occurred during the sqlite3_set_auxdata() call or if the
|
|
6228
|
+
** function is being evaluated during query planning rather than during
|
|
6229
|
+
** query execution.
|
|
6230
|
+
**
|
|
6231
|
+
** ^(In practice, auxiliary data is preserved between function calls for
|
|
5819
6232
|
** function parameters that are compile-time constants, including literal
|
|
5820
6233
|
** values and [parameters] and expressions composed from the same.)^
|
|
5821
6234
|
**
|
|
@@ -5825,10 +6238,68 @@ SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*);
|
|
|
5825
6238
|
**
|
|
5826
6239
|
** These routines must be called from the same thread in which
|
|
5827
6240
|
** the SQL function is running.
|
|
6241
|
+
**
|
|
6242
|
+
** See also: [sqlite3_get_clientdata()] and [sqlite3_set_clientdata()].
|
|
5828
6243
|
*/
|
|
5829
6244
|
SQLITE_API void *sqlite3_get_auxdata(sqlite3_context*, int N);
|
|
5830
6245
|
SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*));
|
|
5831
6246
|
|
|
6247
|
+
/*
|
|
6248
|
+
** CAPI3REF: Database Connection Client Data
|
|
6249
|
+
** METHOD: sqlite3
|
|
6250
|
+
**
|
|
6251
|
+
** These functions are used to associate one or more named pointers
|
|
6252
|
+
** with a [database connection].
|
|
6253
|
+
** A call to sqlite3_set_clientdata(D,N,P,X) causes the pointer P
|
|
6254
|
+
** to be attached to [database connection] D using name N. Subsequent
|
|
6255
|
+
** calls to sqlite3_get_clientdata(D,N) will return a copy of pointer P
|
|
6256
|
+
** or a NULL pointer if there were no prior calls to
|
|
6257
|
+
** sqlite3_set_clientdata() with the same values of D and N.
|
|
6258
|
+
** Names are compared using strcmp() and are thus case sensitive.
|
|
6259
|
+
** It returns 0 on success and SQLITE_NOMEM on allocation failure.
|
|
6260
|
+
**
|
|
6261
|
+
** If P and X are both non-NULL, then the destructor X is invoked with
|
|
6262
|
+
** argument P on the first of the following occurrences:
|
|
6263
|
+
** <ul>
|
|
6264
|
+
** <li> An out-of-memory error occurs during the call to
|
|
6265
|
+
** sqlite3_set_clientdata() which attempts to register pointer P.
|
|
6266
|
+
** <li> A subsequent call to sqlite3_set_clientdata(D,N,P,X) is made
|
|
6267
|
+
** with the same D and N parameters.
|
|
6268
|
+
** <li> The database connection closes. SQLite does not make any guarantees
|
|
6269
|
+
** about the order in which destructors are called, only that all
|
|
6270
|
+
** destructors will be called exactly once at some point during the
|
|
6271
|
+
** database connection closing process.
|
|
6272
|
+
** </ul>
|
|
6273
|
+
**
|
|
6274
|
+
** SQLite does not do anything with client data other than invoke
|
|
6275
|
+
** destructors on the client data at the appropriate time. The intended
|
|
6276
|
+
** use for client data is to provide a mechanism for wrapper libraries
|
|
6277
|
+
** to store additional information about an SQLite database connection.
|
|
6278
|
+
**
|
|
6279
|
+
** There is no limit (other than available memory) on the number of different
|
|
6280
|
+
** client data pointers (with different names) that can be attached to a
|
|
6281
|
+
** single database connection. However, the implementation is optimized
|
|
6282
|
+
** for the case of having only one or two different client data names.
|
|
6283
|
+
** Applications and wrapper libraries are discouraged from using more than
|
|
6284
|
+
** one client data name each.
|
|
6285
|
+
**
|
|
6286
|
+
** There is no way to enumerate the client data pointers
|
|
6287
|
+
** associated with a database connection. The N parameter can be thought
|
|
6288
|
+
** of as a secret key such that only code that knows the secret key is able
|
|
6289
|
+
** to access the associated data.
|
|
6290
|
+
**
|
|
6291
|
+
** Security Warning: These interfaces should not be exposed in scripting
|
|
6292
|
+
** languages or in other circumstances where it might be possible for an
|
|
6293
|
+
** attacker to invoke them. Any agent that can invoke these interfaces
|
|
6294
|
+
** can probably also take control of the process.
|
|
6295
|
+
**
|
|
6296
|
+
** Database connection client data is only available for SQLite
|
|
6297
|
+
** version 3.44.0 ([dateof:3.44.0]) and later.
|
|
6298
|
+
**
|
|
6299
|
+
** See also: [sqlite3_set_auxdata()] and [sqlite3_get_auxdata()].
|
|
6300
|
+
*/
|
|
6301
|
+
SQLITE_API void *sqlite3_get_clientdata(sqlite3*,const char*);
|
|
6302
|
+
SQLITE_API int sqlite3_set_clientdata(sqlite3*, const char*, void*, void(*)(void*));
|
|
5832
6303
|
|
|
5833
6304
|
/*
|
|
5834
6305
|
** CAPI3REF: Constants Defining Special Destructor Behavior
|
|
@@ -5933,7 +6404,7 @@ typedef void (*sqlite3_destructor_type)(void*);
|
|
|
5933
6404
|
** pointed to by the 2nd parameter are taken as the application-defined
|
|
5934
6405
|
** function result. If the 3rd parameter is non-negative, then it
|
|
5935
6406
|
** must be the byte offset into the string where the NUL terminator would
|
|
5936
|
-
** appear if the string
|
|
6407
|
+
** appear if the string were NUL terminated. If any NUL characters occur
|
|
5937
6408
|
** in the string at a byte offset that is less than the value of the 3rd
|
|
5938
6409
|
** parameter, then the resulting string will contain embedded NULs and the
|
|
5939
6410
|
** result of expressions operating on strings with embedded NULs is undefined.
|
|
@@ -5991,7 +6462,7 @@ typedef void (*sqlite3_destructor_type)(void*);
|
|
|
5991
6462
|
** string and preferably a string literal. The sqlite3_result_pointer()
|
|
5992
6463
|
** routine is part of the [pointer passing interface] added for SQLite 3.20.0.
|
|
5993
6464
|
**
|
|
5994
|
-
** If these routines are called from within
|
|
6465
|
+
** If these routines are called from within a different thread
|
|
5995
6466
|
** than the one containing the application-defined function that received
|
|
5996
6467
|
** the [sqlite3_context] pointer, the results are undefined.
|
|
5997
6468
|
*/
|
|
@@ -6030,6 +6501,20 @@ SQLITE_API int sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n);
|
|
|
6030
6501
|
** higher order bits are discarded.
|
|
6031
6502
|
** The number of subtype bytes preserved by SQLite might increase
|
|
6032
6503
|
** in future releases of SQLite.
|
|
6504
|
+
**
|
|
6505
|
+
** Every [application-defined SQL function] that invokes this interface
|
|
6506
|
+
** should include the [SQLITE_RESULT_SUBTYPE] property in its
|
|
6507
|
+
** text encoding argument when the SQL function is
|
|
6508
|
+
** [sqlite3_create_function|registered]. If the [SQLITE_RESULT_SUBTYPE]
|
|
6509
|
+
** property is omitted from the function that invokes sqlite3_result_subtype(),
|
|
6510
|
+
** then in some cases the sqlite3_result_subtype() might fail to set
|
|
6511
|
+
** the result subtype.
|
|
6512
|
+
**
|
|
6513
|
+
** If SQLite is compiled with -DSQLITE_STRICT_SUBTYPE=1, then any
|
|
6514
|
+
** SQL function that invokes the sqlite3_result_subtype() interface
|
|
6515
|
+
** and that does not have the SQLITE_RESULT_SUBTYPE property will raise
|
|
6516
|
+
** an error. Future versions of SQLite might enable -DSQLITE_STRICT_SUBTYPE=1
|
|
6517
|
+
** by default.
|
|
6033
6518
|
*/
|
|
6034
6519
|
SQLITE_API void sqlite3_result_subtype(sqlite3_context*,unsigned int);
|
|
6035
6520
|
|
|
@@ -6201,6 +6686,13 @@ SQLITE_API void sqlite3_activate_cerod(
|
|
|
6201
6686
|
** of the default VFS is not implemented correctly, or not implemented at
|
|
6202
6687
|
** all, then the behavior of sqlite3_sleep() may deviate from the description
|
|
6203
6688
|
** in the previous paragraphs.
|
|
6689
|
+
**
|
|
6690
|
+
** If a negative argument is passed to sqlite3_sleep() the results vary by
|
|
6691
|
+
** VFS and operating system. Some system treat a negative argument as an
|
|
6692
|
+
** instruction to sleep forever. Others understand it to mean do not sleep
|
|
6693
|
+
** at all. ^In SQLite version 3.42.0 and later, a negative
|
|
6694
|
+
** argument passed into sqlite3_sleep() is changed to zero before it is relayed
|
|
6695
|
+
** down into the xSleep method of the VFS.
|
|
6204
6696
|
*/
|
|
6205
6697
|
SQLITE_API int sqlite3_sleep(int);
|
|
6206
6698
|
|
|
@@ -6376,7 +6868,7 @@ SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*);
|
|
|
6376
6868
|
** METHOD: sqlite3
|
|
6377
6869
|
**
|
|
6378
6870
|
** ^The sqlite3_db_name(D,N) interface returns a pointer to the schema name
|
|
6379
|
-
** for the N-th database on database connection D, or a NULL pointer
|
|
6871
|
+
** for the N-th database on database connection D, or a NULL pointer if N is
|
|
6380
6872
|
** out of range. An N value of 0 means the main database file. An N of 1 is
|
|
6381
6873
|
** the "temp" schema. Larger values of N correspond to various ATTACH-ed
|
|
6382
6874
|
** databases.
|
|
@@ -6454,7 +6946,7 @@ SQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName);
|
|
|
6454
6946
|
SQLITE_API int sqlite3_txn_state(sqlite3*,const char *zSchema);
|
|
6455
6947
|
|
|
6456
6948
|
/*
|
|
6457
|
-
** CAPI3REF: Allowed return values from
|
|
6949
|
+
** CAPI3REF: Allowed return values from sqlite3_txn_state()
|
|
6458
6950
|
** KEYWORDS: {transaction state}
|
|
6459
6951
|
**
|
|
6460
6952
|
** These constants define the current transaction state of a database file.
|
|
@@ -6471,7 +6963,7 @@ SQLITE_API int sqlite3_txn_state(sqlite3*,const char *zSchema);
|
|
|
6471
6963
|
** <dd>The SQLITE_TXN_READ state means that the database is currently
|
|
6472
6964
|
** in a read transaction. Content has been read from the database file
|
|
6473
6965
|
** but nothing in the database file has changed. The transaction state
|
|
6474
|
-
** will advanced to SQLITE_TXN_WRITE if any changes occur and there are
|
|
6966
|
+
** will be advanced to SQLITE_TXN_WRITE if any changes occur and there are
|
|
6475
6967
|
** no other conflicting concurrent write transactions. The transaction
|
|
6476
6968
|
** state will revert to SQLITE_TXN_NONE following a [ROLLBACK] or
|
|
6477
6969
|
** [COMMIT].</dd>
|
|
@@ -6480,7 +6972,7 @@ SQLITE_API int sqlite3_txn_state(sqlite3*,const char *zSchema);
|
|
|
6480
6972
|
** <dd>The SQLITE_TXN_WRITE state means that the database is currently
|
|
6481
6973
|
** in a write transaction. Content has been written to the database file
|
|
6482
6974
|
** but has not yet committed. The transaction state will change to
|
|
6483
|
-
**
|
|
6975
|
+
** SQLITE_TXN_NONE at the next [ROLLBACK] or [COMMIT].</dd>
|
|
6484
6976
|
*/
|
|
6485
6977
|
#define SQLITE_TXN_NONE 0
|
|
6486
6978
|
#define SQLITE_TXN_READ 1
|
|
@@ -6586,7 +7078,7 @@ SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
|
|
|
6586
7078
|
** ^Each call to the sqlite3_autovacuum_pages() interface overrides all
|
|
6587
7079
|
** previous invocations for that database connection. ^If the callback
|
|
6588
7080
|
** argument (C) to sqlite3_autovacuum_pages(D,C,P,X) is a NULL pointer,
|
|
6589
|
-
** then the autovacuum steps callback is
|
|
7081
|
+
** then the autovacuum steps callback is canceled. The return value
|
|
6590
7082
|
** from sqlite3_autovacuum_pages() is normally SQLITE_OK, but might
|
|
6591
7083
|
** be some other error code if something goes wrong. The current
|
|
6592
7084
|
** implementation will only return SQLITE_OK or SQLITE_MISUSE, but other
|
|
@@ -6631,6 +7123,8 @@ SQLITE_API int sqlite3_autovacuum_pages(
|
|
|
6631
7123
|
**
|
|
6632
7124
|
** ^The second argument is a pointer to the function to invoke when a
|
|
6633
7125
|
** row is updated, inserted or deleted in a rowid table.
|
|
7126
|
+
** ^The update hook is disabled by invoking sqlite3_update_hook()
|
|
7127
|
+
** with a NULL pointer as the second parameter.
|
|
6634
7128
|
** ^The first argument to the callback is a copy of the third argument
|
|
6635
7129
|
** to sqlite3_update_hook().
|
|
6636
7130
|
** ^The second callback argument is one of [SQLITE_INSERT], [SQLITE_DELETE],
|
|
@@ -6652,6 +7146,12 @@ SQLITE_API int sqlite3_autovacuum_pages(
|
|
|
6652
7146
|
** The exceptions defined in this paragraph might change in a future
|
|
6653
7147
|
** release of SQLite.
|
|
6654
7148
|
**
|
|
7149
|
+
** Whether the update hook is invoked before or after the
|
|
7150
|
+
** corresponding change is currently unspecified and may differ
|
|
7151
|
+
** depending on the type of change. Do not rely on the order of the
|
|
7152
|
+
** hook call with regards to the final result of the operation which
|
|
7153
|
+
** triggers the hook.
|
|
7154
|
+
**
|
|
6655
7155
|
** The update hook implementation must not do anything that will modify
|
|
6656
7156
|
** the database connection that invoked the update hook. Any actions
|
|
6657
7157
|
** to modify the database connection must be deferred until after the
|
|
@@ -6753,7 +7253,7 @@ SQLITE_API int sqlite3_db_release_memory(sqlite3*);
|
|
|
6753
7253
|
** CAPI3REF: Impose A Limit On Heap Size
|
|
6754
7254
|
**
|
|
6755
7255
|
** These interfaces impose limits on the amount of heap memory that will be
|
|
6756
|
-
** by all database connections within a single process.
|
|
7256
|
+
** used by all database connections within a single process.
|
|
6757
7257
|
**
|
|
6758
7258
|
** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the
|
|
6759
7259
|
** soft limit on the amount of heap memory that may be allocated by SQLite.
|
|
@@ -6811,7 +7311,7 @@ SQLITE_API int sqlite3_db_release_memory(sqlite3*);
|
|
|
6811
7311
|
** </ul>)^
|
|
6812
7312
|
**
|
|
6813
7313
|
** The circumstances under which SQLite will enforce the heap limits may
|
|
6814
|
-
**
|
|
7314
|
+
** change in future releases of SQLite.
|
|
6815
7315
|
*/
|
|
6816
7316
|
SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N);
|
|
6817
7317
|
SQLITE_API sqlite3_int64 sqlite3_hard_heap_limit64(sqlite3_int64 N);
|
|
@@ -6926,8 +7426,8 @@ SQLITE_API int sqlite3_table_column_metadata(
|
|
|
6926
7426
|
** ^The entry point is zProc.
|
|
6927
7427
|
** ^(zProc may be 0, in which case SQLite will try to come up with an
|
|
6928
7428
|
** entry point name on its own. It first tries "sqlite3_extension_init".
|
|
6929
|
-
** If that does not work, it constructs a name "sqlite3_X_init" where
|
|
6930
|
-
** X
|
|
7429
|
+
** If that does not work, it constructs a name "sqlite3_X_init" where
|
|
7430
|
+
** X consists of the lower-case equivalent of all ASCII alphabetic
|
|
6931
7431
|
** characters in the filename from the last "/" to the first following
|
|
6932
7432
|
** "." and omitting any initial "lib".)^
|
|
6933
7433
|
** ^The sqlite3_load_extension() interface returns
|
|
@@ -6998,7 +7498,7 @@ SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff);
|
|
|
6998
7498
|
** ^(Even though the function prototype shows that xEntryPoint() takes
|
|
6999
7499
|
** no arguments and returns void, SQLite invokes xEntryPoint() with three
|
|
7000
7500
|
** arguments and expects an integer result as if the signature of the
|
|
7001
|
-
** entry point
|
|
7501
|
+
** entry point were as follows:
|
|
7002
7502
|
**
|
|
7003
7503
|
** <blockquote><pre>
|
|
7004
7504
|
** int xEntryPoint(
|
|
@@ -7105,6 +7605,10 @@ struct sqlite3_module {
|
|
|
7105
7605
|
/* The methods above are in versions 1 and 2 of the sqlite_module object.
|
|
7106
7606
|
** Those below are for version 3 and greater. */
|
|
7107
7607
|
int (*xShadowName)(const char*);
|
|
7608
|
+
/* The methods above are in versions 1 through 3 of the sqlite_module object.
|
|
7609
|
+
** Those below are for version 4 and greater. */
|
|
7610
|
+
int (*xIntegrity)(sqlite3_vtab *pVTab, const char *zSchema,
|
|
7611
|
+
const char *zTabName, int mFlags, char **pzErr);
|
|
7108
7612
|
};
|
|
7109
7613
|
|
|
7110
7614
|
/*
|
|
@@ -7158,7 +7662,7 @@ struct sqlite3_module {
|
|
|
7158
7662
|
** virtual table and might not be checked again by the byte code.)^ ^(The
|
|
7159
7663
|
** aConstraintUsage[].omit flag is an optimization hint. When the omit flag
|
|
7160
7664
|
** is left in its default setting of false, the constraint will always be
|
|
7161
|
-
** checked separately in byte code. If the omit flag is
|
|
7665
|
+
** checked separately in byte code. If the omit flag is changed to true, then
|
|
7162
7666
|
** the constraint may or may not be checked in byte code. In other words,
|
|
7163
7667
|
** when the omit flag is true there is no guarantee that the constraint will
|
|
7164
7668
|
** not be checked again using byte code.)^
|
|
@@ -7182,9 +7686,11 @@ struct sqlite3_module {
|
|
|
7182
7686
|
** will be returned by the strategy.
|
|
7183
7687
|
**
|
|
7184
7688
|
** The xBestIndex method may optionally populate the idxFlags field with a
|
|
7185
|
-
** mask of SQLITE_INDEX_SCAN_* flags.
|
|
7186
|
-
**
|
|
7187
|
-
**
|
|
7689
|
+
** mask of SQLITE_INDEX_SCAN_* flags. One such flag is
|
|
7690
|
+
** [SQLITE_INDEX_SCAN_HEX], which if set causes the [EXPLAIN QUERY PLAN]
|
|
7691
|
+
** output to show the idxNum as hex instead of as decimal. Another flag is
|
|
7692
|
+
** SQLITE_INDEX_SCAN_UNIQUE, which if set indicates that the query plan will
|
|
7693
|
+
** return at most one row.
|
|
7188
7694
|
**
|
|
7189
7695
|
** Additionally, if xBestIndex sets the SQLITE_INDEX_SCAN_UNIQUE flag, then
|
|
7190
7696
|
** SQLite also assumes that if a call to the xUpdate() method is made as
|
|
@@ -7248,7 +7754,9 @@ struct sqlite3_index_info {
|
|
|
7248
7754
|
** [sqlite3_index_info].idxFlags field to some combination of
|
|
7249
7755
|
** these bits.
|
|
7250
7756
|
*/
|
|
7251
|
-
#define SQLITE_INDEX_SCAN_UNIQUE
|
|
7757
|
+
#define SQLITE_INDEX_SCAN_UNIQUE 0x00000001 /* Scan visits at most 1 row */
|
|
7758
|
+
#define SQLITE_INDEX_SCAN_HEX 0x00000002 /* Display idxNum as hex */
|
|
7759
|
+
/* in EXPLAIN QUERY PLAN */
|
|
7252
7760
|
|
|
7253
7761
|
/*
|
|
7254
7762
|
** CAPI3REF: Virtual Table Constraint Operator Codes
|
|
@@ -7321,7 +7829,7 @@ struct sqlite3_index_info {
|
|
|
7321
7829
|
** the implementation of the [virtual table module]. ^The fourth
|
|
7322
7830
|
** parameter is an arbitrary client data pointer that is passed through
|
|
7323
7831
|
** into the [xCreate] and [xConnect] methods of the virtual table module
|
|
7324
|
-
** when a new virtual table is
|
|
7832
|
+
** when a new virtual table is being created or reinitialized.
|
|
7325
7833
|
**
|
|
7326
7834
|
** ^The sqlite3_create_module_v2() interface has a fifth parameter which
|
|
7327
7835
|
** is a pointer to a destructor for the pClientData. ^SQLite will
|
|
@@ -7486,7 +7994,7 @@ typedef struct sqlite3_blob sqlite3_blob;
|
|
|
7486
7994
|
** in *ppBlob. Otherwise an [error code] is returned and, unless the error
|
|
7487
7995
|
** code is SQLITE_MISUSE, *ppBlob is set to NULL.)^ ^This means that, provided
|
|
7488
7996
|
** the API is not misused, it is always safe to call [sqlite3_blob_close()]
|
|
7489
|
-
** on *ppBlob after this function
|
|
7997
|
+
** on *ppBlob after this function returns.
|
|
7490
7998
|
**
|
|
7491
7999
|
** This function fails with SQLITE_ERROR if any of the following are true:
|
|
7492
8000
|
** <ul>
|
|
@@ -7592,7 +8100,7 @@ SQLITE_API int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64);
|
|
|
7592
8100
|
** code is returned and the transaction rolled back.
|
|
7593
8101
|
**
|
|
7594
8102
|
** Calling this function with an argument that is not a NULL pointer or an
|
|
7595
|
-
** open blob handle results in undefined
|
|
8103
|
+
** open blob handle results in undefined behavior. ^Calling this routine
|
|
7596
8104
|
** with a null pointer (such as would be returned by a failed call to
|
|
7597
8105
|
** [sqlite3_blob_open()]) is a harmless no-op. ^Otherwise, if this function
|
|
7598
8106
|
** is passed a valid open blob handle, the values returned by the
|
|
@@ -7606,7 +8114,7 @@ SQLITE_API int sqlite3_blob_close(sqlite3_blob *);
|
|
|
7606
8114
|
**
|
|
7607
8115
|
** ^Returns the size in bytes of the BLOB accessible via the
|
|
7608
8116
|
** successfully opened [BLOB handle] in its only argument. ^The
|
|
7609
|
-
** incremental blob I/O routines can only read or
|
|
8117
|
+
** incremental blob I/O routines can only read or overwrite existing
|
|
7610
8118
|
** blob content; they cannot change the size of a blob.
|
|
7611
8119
|
**
|
|
7612
8120
|
** This routine only works on a [BLOB handle] which has been created
|
|
@@ -7756,7 +8264,7 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
|
|
|
7756
8264
|
** ^The sqlite3_mutex_alloc() routine allocates a new
|
|
7757
8265
|
** mutex and returns a pointer to it. ^The sqlite3_mutex_alloc()
|
|
7758
8266
|
** routine returns NULL if it is unable to allocate the requested
|
|
7759
|
-
** mutex. The argument to sqlite3_mutex_alloc() must one of these
|
|
8267
|
+
** mutex. The argument to sqlite3_mutex_alloc() must be one of these
|
|
7760
8268
|
** integer constants:
|
|
7761
8269
|
**
|
|
7762
8270
|
** <ul>
|
|
@@ -7819,18 +8327,20 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
|
|
|
7819
8327
|
**
|
|
7820
8328
|
** ^(Some systems (for example, Windows 95) do not support the operation
|
|
7821
8329
|
** implemented by sqlite3_mutex_try(). On those systems, sqlite3_mutex_try()
|
|
7822
|
-
** will always return SQLITE_BUSY.
|
|
7823
|
-
** sqlite3_mutex_try() as an optimization so this is acceptable
|
|
7824
|
-
** behavior.
|
|
8330
|
+
** will always return SQLITE_BUSY. In most cases the SQLite core only uses
|
|
8331
|
+
** sqlite3_mutex_try() as an optimization, so this is acceptable
|
|
8332
|
+
** behavior. The exceptions are unix builds that set the
|
|
8333
|
+
** SQLITE_ENABLE_SETLK_TIMEOUT build option. In that case a working
|
|
8334
|
+
** sqlite3_mutex_try() is required.)^
|
|
7825
8335
|
**
|
|
7826
8336
|
** ^The sqlite3_mutex_leave() routine exits a mutex that was
|
|
7827
8337
|
** previously entered by the same thread. The behavior
|
|
7828
8338
|
** is undefined if the mutex is not currently entered by the
|
|
7829
8339
|
** calling thread or is not currently allocated.
|
|
7830
8340
|
**
|
|
7831
|
-
** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(),
|
|
7832
|
-
** sqlite3_mutex_leave() is a NULL pointer,
|
|
7833
|
-
**
|
|
8341
|
+
** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(),
|
|
8342
|
+
** sqlite3_mutex_leave(), or sqlite3_mutex_free() is a NULL pointer,
|
|
8343
|
+
** then any of the four routines behaves as a no-op.
|
|
7834
8344
|
**
|
|
7835
8345
|
** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()].
|
|
7836
8346
|
*/
|
|
@@ -7987,7 +8497,7 @@ SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*);
|
|
|
7987
8497
|
** CAPI3REF: Retrieve the mutex for a database connection
|
|
7988
8498
|
** METHOD: sqlite3
|
|
7989
8499
|
**
|
|
7990
|
-
** ^This interface returns a pointer the [sqlite3_mutex] object that
|
|
8500
|
+
** ^This interface returns a pointer to the [sqlite3_mutex] object that
|
|
7991
8501
|
** serializes access to the [database connection] given in the argument
|
|
7992
8502
|
** when the [threading mode] is Serialized.
|
|
7993
8503
|
** ^If the [threading mode] is Single-thread or Multi-thread then this
|
|
@@ -8072,6 +8582,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
|
|
|
8072
8582
|
#define SQLITE_TESTCTRL_PRNG_SAVE 5
|
|
8073
8583
|
#define SQLITE_TESTCTRL_PRNG_RESTORE 6
|
|
8074
8584
|
#define SQLITE_TESTCTRL_PRNG_RESET 7 /* NOT USED */
|
|
8585
|
+
#define SQLITE_TESTCTRL_FK_NO_ACTION 7
|
|
8075
8586
|
#define SQLITE_TESTCTRL_BITVEC_TEST 8
|
|
8076
8587
|
#define SQLITE_TESTCTRL_FAULT_INSTALL 9
|
|
8077
8588
|
#define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10
|
|
@@ -8079,8 +8590,10 @@ SQLITE_API int sqlite3_test_control(int op, ...);
|
|
|
8079
8590
|
#define SQLITE_TESTCTRL_ASSERT 12
|
|
8080
8591
|
#define SQLITE_TESTCTRL_ALWAYS 13
|
|
8081
8592
|
#define SQLITE_TESTCTRL_RESERVE 14 /* NOT USED */
|
|
8593
|
+
#define SQLITE_TESTCTRL_JSON_SELFCHECK 14
|
|
8082
8594
|
#define SQLITE_TESTCTRL_OPTIMIZATIONS 15
|
|
8083
8595
|
#define SQLITE_TESTCTRL_ISKEYWORD 16 /* NOT USED */
|
|
8596
|
+
#define SQLITE_TESTCTRL_GETOPT 16
|
|
8084
8597
|
#define SQLITE_TESTCTRL_SCRATCHMALLOC 17 /* NOT USED */
|
|
8085
8598
|
#define SQLITE_TESTCTRL_INTERNAL_FUNCTIONS 17
|
|
8086
8599
|
#define SQLITE_TESTCTRL_LOCALTIME_FAULT 18
|
|
@@ -8100,20 +8613,21 @@ SQLITE_API int sqlite3_test_control(int op, ...);
|
|
|
8100
8613
|
#define SQLITE_TESTCTRL_TRACEFLAGS 31
|
|
8101
8614
|
#define SQLITE_TESTCTRL_TUNE 32
|
|
8102
8615
|
#define SQLITE_TESTCTRL_LOGEST 33
|
|
8103
|
-
#define
|
|
8616
|
+
#define SQLITE_TESTCTRL_USELONGDOUBLE 34 /* NOT USED */
|
|
8617
|
+
#define SQLITE_TESTCTRL_LAST 34 /* Largest TESTCTRL */
|
|
8104
8618
|
|
|
8105
8619
|
/*
|
|
8106
8620
|
** CAPI3REF: SQL Keyword Checking
|
|
8107
8621
|
**
|
|
8108
8622
|
** These routines provide access to the set of SQL language keywords
|
|
8109
|
-
** recognized by SQLite. Applications can
|
|
8623
|
+
** recognized by SQLite. Applications can use these routines to determine
|
|
8110
8624
|
** whether or not a specific identifier needs to be escaped (for example,
|
|
8111
8625
|
** by enclosing in double-quotes) so as not to confuse the parser.
|
|
8112
8626
|
**
|
|
8113
8627
|
** The sqlite3_keyword_count() interface returns the number of distinct
|
|
8114
8628
|
** keywords understood by SQLite.
|
|
8115
8629
|
**
|
|
8116
|
-
** The sqlite3_keyword_name(N,Z,L) interface finds the N-th keyword and
|
|
8630
|
+
** The sqlite3_keyword_name(N,Z,L) interface finds the 0-based N-th keyword and
|
|
8117
8631
|
** makes *Z point to that keyword expressed as UTF8 and writes the number
|
|
8118
8632
|
** of bytes in the keyword into *L. The string that *Z points to is not
|
|
8119
8633
|
** zero-terminated. The sqlite3_keyword_name(N,Z,L) routine returns
|
|
@@ -8274,7 +8788,7 @@ SQLITE_API void sqlite3_str_reset(sqlite3_str*);
|
|
|
8274
8788
|
** content of the dynamic string under construction in X. The value
|
|
8275
8789
|
** returned by [sqlite3_str_value(X)] is managed by the sqlite3_str object X
|
|
8276
8790
|
** and might be freed or altered by any subsequent method on the same
|
|
8277
|
-
** [sqlite3_str] object. Applications must not
|
|
8791
|
+
** [sqlite3_str] object. Applications must not use the pointer returned by
|
|
8278
8792
|
** [sqlite3_str_value(X)] after any subsequent method call on the same
|
|
8279
8793
|
** object. ^Applications may change the content of the string returned
|
|
8280
8794
|
** by [sqlite3_str_value(X)] as long as they do not write into any bytes
|
|
@@ -8360,7 +8874,7 @@ SQLITE_API int sqlite3_status64(
|
|
|
8360
8874
|
** allocation which could not be satisfied by the [SQLITE_CONFIG_PAGECACHE]
|
|
8361
8875
|
** buffer and where forced to overflow to [sqlite3_malloc()]. The
|
|
8362
8876
|
** returned value includes allocations that overflowed because they
|
|
8363
|
-
**
|
|
8877
|
+
** were too large (they were larger than the "sz" parameter to
|
|
8364
8878
|
** [SQLITE_CONFIG_PAGECACHE]) and allocations that overflowed because
|
|
8365
8879
|
** no space was left in the page cache.</dd>)^
|
|
8366
8880
|
**
|
|
@@ -8419,9 +8933,18 @@ SQLITE_API int sqlite3_status64(
|
|
|
8419
8933
|
** ^The sqlite3_db_status() routine returns SQLITE_OK on success and a
|
|
8420
8934
|
** non-zero [error code] on failure.
|
|
8421
8935
|
**
|
|
8936
|
+
** ^The sqlite3_db_status64(D,O,C,H,R) routine works exactly the same
|
|
8937
|
+
** way as sqlite3_db_status(D,O,C,H,R) routine except that the C and H
|
|
8938
|
+
** parameters are pointer to 64-bit integers (type: sqlite3_int64) instead
|
|
8939
|
+
** of pointers to 32-bit integers, which allows larger status values
|
|
8940
|
+
** to be returned. If a status value exceeds 2,147,483,647 then
|
|
8941
|
+
** sqlite3_db_status() will truncate the value whereas sqlite3_db_status64()
|
|
8942
|
+
** will return the full value.
|
|
8943
|
+
**
|
|
8422
8944
|
** See also: [sqlite3_status()] and [sqlite3_stmt_status()].
|
|
8423
8945
|
*/
|
|
8424
8946
|
SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
|
|
8947
|
+
SQLITE_API int sqlite3_db_status64(sqlite3*,int,sqlite3_int64*,sqlite3_int64*,int);
|
|
8425
8948
|
|
|
8426
8949
|
/*
|
|
8427
8950
|
** CAPI3REF: Status Parameters for database connections
|
|
@@ -8444,28 +8967,29 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
|
|
|
8444
8967
|
** [[SQLITE_DBSTATUS_LOOKASIDE_HIT]] ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_HIT</dt>
|
|
8445
8968
|
** <dd>This parameter returns the number of malloc attempts that were
|
|
8446
8969
|
** satisfied using lookaside memory. Only the high-water value is meaningful;
|
|
8447
|
-
** the current value is always zero
|
|
8970
|
+
** the current value is always zero.</dd>)^
|
|
8448
8971
|
**
|
|
8449
8972
|
** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE]]
|
|
8450
8973
|
** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE</dt>
|
|
8451
|
-
** <dd>This parameter returns the number malloc attempts that might have
|
|
8974
|
+
** <dd>This parameter returns the number of malloc attempts that might have
|
|
8452
8975
|
** been satisfied using lookaside memory but failed due to the amount of
|
|
8453
8976
|
** memory requested being larger than the lookaside slot size.
|
|
8454
8977
|
** Only the high-water value is meaningful;
|
|
8455
|
-
** the current value is always zero
|
|
8978
|
+
** the current value is always zero.</dd>)^
|
|
8456
8979
|
**
|
|
8457
8980
|
** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL]]
|
|
8458
8981
|
** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL</dt>
|
|
8459
|
-
** <dd>This parameter returns the number malloc attempts that might have
|
|
8982
|
+
** <dd>This parameter returns the number of malloc attempts that might have
|
|
8460
8983
|
** been satisfied using lookaside memory but failed due to all lookaside
|
|
8461
8984
|
** memory already being in use.
|
|
8462
8985
|
** Only the high-water value is meaningful;
|
|
8463
|
-
** the current value is always zero
|
|
8986
|
+
** the current value is always zero.</dd>)^
|
|
8464
8987
|
**
|
|
8465
8988
|
** [[SQLITE_DBSTATUS_CACHE_USED]] ^(<dt>SQLITE_DBSTATUS_CACHE_USED</dt>
|
|
8466
8989
|
** <dd>This parameter returns the approximate number of bytes of heap
|
|
8467
8990
|
** memory used by all pager caches associated with the database connection.)^
|
|
8468
8991
|
** ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always 0.
|
|
8992
|
+
** </dd>
|
|
8469
8993
|
**
|
|
8470
8994
|
** [[SQLITE_DBSTATUS_CACHE_USED_SHARED]]
|
|
8471
8995
|
** ^(<dt>SQLITE_DBSTATUS_CACHE_USED_SHARED</dt>
|
|
@@ -8474,10 +8998,10 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
|
|
|
8474
8998
|
** memory used by that pager cache is divided evenly between the attached
|
|
8475
8999
|
** connections.)^ In other words, if none of the pager caches associated
|
|
8476
9000
|
** with the database connection are shared, this request returns the same
|
|
8477
|
-
** value as DBSTATUS_CACHE_USED. Or, if one or more
|
|
9001
|
+
** value as DBSTATUS_CACHE_USED. Or, if one or more of the pager caches are
|
|
8478
9002
|
** shared, the value returned by this call will be smaller than that returned
|
|
8479
9003
|
** by DBSTATUS_CACHE_USED. ^The highwater mark associated with
|
|
8480
|
-
** SQLITE_DBSTATUS_CACHE_USED_SHARED is always 0
|
|
9004
|
+
** SQLITE_DBSTATUS_CACHE_USED_SHARED is always 0.</dd>
|
|
8481
9005
|
**
|
|
8482
9006
|
** [[SQLITE_DBSTATUS_SCHEMA_USED]] ^(<dt>SQLITE_DBSTATUS_SCHEMA_USED</dt>
|
|
8483
9007
|
** <dd>This parameter returns the approximate number of bytes of heap
|
|
@@ -8487,6 +9011,7 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
|
|
|
8487
9011
|
** schema memory is shared with other database connections due to
|
|
8488
9012
|
** [shared cache mode] being enabled.
|
|
8489
9013
|
** ^The highwater mark associated with SQLITE_DBSTATUS_SCHEMA_USED is always 0.
|
|
9014
|
+
** </dd>
|
|
8490
9015
|
**
|
|
8491
9016
|
** [[SQLITE_DBSTATUS_STMT_USED]] ^(<dt>SQLITE_DBSTATUS_STMT_USED</dt>
|
|
8492
9017
|
** <dd>This parameter returns the approximate number of bytes of heap
|
|
@@ -8516,6 +9041,10 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
|
|
|
8516
9041
|
** If an IO or other error occurs while writing a page to disk, the effect
|
|
8517
9042
|
** on subsequent SQLITE_DBSTATUS_CACHE_WRITE requests is undefined.)^ ^The
|
|
8518
9043
|
** highwater mark associated with SQLITE_DBSTATUS_CACHE_WRITE is always 0.
|
|
9044
|
+
** <p>
|
|
9045
|
+
** ^(There is overlap between the quantities measured by this parameter
|
|
9046
|
+
** (SQLITE_DBSTATUS_CACHE_WRITE) and SQLITE_DBSTATUS_TEMPBUF_SPILL.
|
|
9047
|
+
** Resetting one will reduce the other.)^
|
|
8519
9048
|
** </dd>
|
|
8520
9049
|
**
|
|
8521
9050
|
** [[SQLITE_DBSTATUS_CACHE_SPILL]] ^(<dt>SQLITE_DBSTATUS_CACHE_SPILL</dt>
|
|
@@ -8523,7 +9052,7 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
|
|
|
8523
9052
|
** been written to disk in the middle of a transaction due to the page
|
|
8524
9053
|
** cache overflowing. Transactions are more efficient if they are written
|
|
8525
9054
|
** to disk all at once. When pages spill mid-transaction, that introduces
|
|
8526
|
-
** additional overhead. This parameter can be used help identify
|
|
9055
|
+
** additional overhead. This parameter can be used to help identify
|
|
8527
9056
|
** inefficiencies that can be resolved by increasing the cache size.
|
|
8528
9057
|
** </dd>
|
|
8529
9058
|
**
|
|
@@ -8531,6 +9060,18 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
|
|
|
8531
9060
|
** <dd>This parameter returns zero for the current value if and only if
|
|
8532
9061
|
** all foreign key constraints (deferred or immediate) have been
|
|
8533
9062
|
** resolved.)^ ^The highwater mark is always 0.
|
|
9063
|
+
**
|
|
9064
|
+
** [[SQLITE_DBSTATUS_TEMPBUF_SPILL] ^(<dt>SQLITE_DBSTATUS_TEMPBUF_SPILL</dt>
|
|
9065
|
+
** <dd>^(This parameter returns the number of bytes written to temporary
|
|
9066
|
+
** files on disk that could have been kept in memory had sufficient memory
|
|
9067
|
+
** been available. This value includes writes to intermediate tables that
|
|
9068
|
+
** are part of complex queries, external sorts that spill to disk, and
|
|
9069
|
+
** writes to TEMP tables.)^
|
|
9070
|
+
** ^The highwater mark is always 0.
|
|
9071
|
+
** <p>
|
|
9072
|
+
** ^(There is overlap between the quantities measured by this parameter
|
|
9073
|
+
** (SQLITE_DBSTATUS_TEMPBUF_SPILL) and SQLITE_DBSTATUS_CACHE_WRITE.
|
|
9074
|
+
** Resetting one will reduce the other.)^
|
|
8534
9075
|
** </dd>
|
|
8535
9076
|
** </dl>
|
|
8536
9077
|
*/
|
|
@@ -8547,7 +9088,8 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
|
|
|
8547
9088
|
#define SQLITE_DBSTATUS_DEFERRED_FKS 10
|
|
8548
9089
|
#define SQLITE_DBSTATUS_CACHE_USED_SHARED 11
|
|
8549
9090
|
#define SQLITE_DBSTATUS_CACHE_SPILL 12
|
|
8550
|
-
#define
|
|
9091
|
+
#define SQLITE_DBSTATUS_TEMPBUF_SPILL 13
|
|
9092
|
+
#define SQLITE_DBSTATUS_MAX 13 /* Largest defined DBSTATUS */
|
|
8551
9093
|
|
|
8552
9094
|
|
|
8553
9095
|
/*
|
|
@@ -8594,13 +9136,13 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
|
|
|
8594
9136
|
** [[SQLITE_STMTSTATUS_SORT]] <dt>SQLITE_STMTSTATUS_SORT</dt>
|
|
8595
9137
|
** <dd>^This is the number of sort operations that have occurred.
|
|
8596
9138
|
** A non-zero value in this counter may indicate an opportunity to
|
|
8597
|
-
**
|
|
9139
|
+
** improve performance through careful use of indices.</dd>
|
|
8598
9140
|
**
|
|
8599
9141
|
** [[SQLITE_STMTSTATUS_AUTOINDEX]] <dt>SQLITE_STMTSTATUS_AUTOINDEX</dt>
|
|
8600
9142
|
** <dd>^This is the number of rows inserted into transient indices that
|
|
8601
9143
|
** were created automatically in order to help joins run faster.
|
|
8602
9144
|
** A non-zero value in this counter may indicate an opportunity to
|
|
8603
|
-
**
|
|
9145
|
+
** improve performance by adding permanent indices that do not
|
|
8604
9146
|
** need to be reinitialized each time the statement is run.</dd>
|
|
8605
9147
|
**
|
|
8606
9148
|
** [[SQLITE_STMTSTATUS_VM_STEP]] <dt>SQLITE_STMTSTATUS_VM_STEP</dt>
|
|
@@ -8609,19 +9151,19 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
|
|
|
8609
9151
|
** to 2147483647. The number of virtual machine operations can be
|
|
8610
9152
|
** used as a proxy for the total work done by the prepared statement.
|
|
8611
9153
|
** If the number of virtual machine operations exceeds 2147483647
|
|
8612
|
-
** then the value returned by this statement status code is undefined
|
|
9154
|
+
** then the value returned by this statement status code is undefined.</dd>
|
|
8613
9155
|
**
|
|
8614
9156
|
** [[SQLITE_STMTSTATUS_REPREPARE]] <dt>SQLITE_STMTSTATUS_REPREPARE</dt>
|
|
8615
9157
|
** <dd>^This is the number of times that the prepare statement has been
|
|
8616
9158
|
** automatically regenerated due to schema changes or changes to
|
|
8617
|
-
** [bound parameters] that might affect the query plan
|
|
9159
|
+
** [bound parameters] that might affect the query plan.</dd>
|
|
8618
9160
|
**
|
|
8619
9161
|
** [[SQLITE_STMTSTATUS_RUN]] <dt>SQLITE_STMTSTATUS_RUN</dt>
|
|
8620
9162
|
** <dd>^This is the number of times that the prepared statement has
|
|
8621
9163
|
** been run. A single "run" for the purposes of this counter is one
|
|
8622
9164
|
** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()].
|
|
8623
9165
|
** The counter is incremented on the first [sqlite3_step()] call of each
|
|
8624
|
-
** cycle
|
|
9166
|
+
** cycle.</dd>
|
|
8625
9167
|
**
|
|
8626
9168
|
** [[SQLITE_STMTSTATUS_FILTER_MISS]]
|
|
8627
9169
|
** [[SQLITE_STMTSTATUS_FILTER HIT]]
|
|
@@ -8631,7 +9173,7 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
|
|
|
8631
9173
|
** step was bypassed because a Bloom filter returned not-found. The
|
|
8632
9174
|
** corresponding SQLITE_STMTSTATUS_FILTER_MISS value is the number of
|
|
8633
9175
|
** times that the Bloom filter returned a find, and thus the join step
|
|
8634
|
-
** had to be processed as normal
|
|
9176
|
+
** had to be processed as normal.</dd>
|
|
8635
9177
|
**
|
|
8636
9178
|
** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt>
|
|
8637
9179
|
** <dd>^This is the approximate number of bytes of heap memory
|
|
@@ -8736,9 +9278,9 @@ struct sqlite3_pcache_page {
|
|
|
8736
9278
|
** SQLite will typically create one cache instance for each open database file,
|
|
8737
9279
|
** though this is not guaranteed. ^The
|
|
8738
9280
|
** first parameter, szPage, is the size in bytes of the pages that must
|
|
8739
|
-
** be allocated by the cache. ^szPage will always a power of two. ^The
|
|
9281
|
+
** be allocated by the cache. ^szPage will always be a power of two. ^The
|
|
8740
9282
|
** second parameter szExtra is a number of bytes of extra storage
|
|
8741
|
-
** associated with each page cache entry. ^The szExtra parameter will
|
|
9283
|
+
** associated with each page cache entry. ^The szExtra parameter will be
|
|
8742
9284
|
** a number less than 250. SQLite will use the
|
|
8743
9285
|
** extra szExtra bytes on each page to store metadata about the underlying
|
|
8744
9286
|
** database page on disk. The value passed into szExtra depends
|
|
@@ -8746,17 +9288,17 @@ struct sqlite3_pcache_page {
|
|
|
8746
9288
|
** ^The third argument to xCreate(), bPurgeable, is true if the cache being
|
|
8747
9289
|
** created will be used to cache database pages of a file stored on disk, or
|
|
8748
9290
|
** false if it is used for an in-memory database. The cache implementation
|
|
8749
|
-
** does not have to do anything special based
|
|
9291
|
+
** does not have to do anything special based upon the value of bPurgeable;
|
|
8750
9292
|
** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will
|
|
8751
9293
|
** never invoke xUnpin() except to deliberately delete a page.
|
|
8752
9294
|
** ^In other words, calls to xUnpin() on a cache with bPurgeable set to
|
|
8753
9295
|
** false will always have the "discard" flag set to true.
|
|
8754
|
-
** ^Hence, a cache created with bPurgeable false will
|
|
9296
|
+
** ^Hence, a cache created with bPurgeable set to false will
|
|
8755
9297
|
** never contain any unpinned pages.
|
|
8756
9298
|
**
|
|
8757
9299
|
** [[the xCachesize() page cache method]]
|
|
8758
9300
|
** ^(The xCachesize() method may be called at any time by SQLite to set the
|
|
8759
|
-
** suggested maximum cache-size (number of pages stored
|
|
9301
|
+
** suggested maximum cache-size (number of pages stored) for the cache
|
|
8760
9302
|
** instance passed as the first argument. This is the value configured using
|
|
8761
9303
|
** the SQLite "[PRAGMA cache_size]" command.)^ As with the bPurgeable
|
|
8762
9304
|
** parameter, the implementation is not required to do anything with this
|
|
@@ -8783,12 +9325,12 @@ struct sqlite3_pcache_page {
|
|
|
8783
9325
|
** implementation must return a pointer to the page buffer with its content
|
|
8784
9326
|
** intact. If the requested page is not already in the cache, then the
|
|
8785
9327
|
** cache implementation should use the value of the createFlag
|
|
8786
|
-
** parameter to help it
|
|
9328
|
+
** parameter to help it determine what action to take:
|
|
8787
9329
|
**
|
|
8788
9330
|
** <table border=1 width=85% align=center>
|
|
8789
9331
|
** <tr><th> createFlag <th> Behavior when page is not already in cache
|
|
8790
9332
|
** <tr><td> 0 <td> Do not allocate a new page. Return NULL.
|
|
8791
|
-
** <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so.
|
|
9333
|
+
** <tr><td> 1 <td> Allocate a new page if it is easy and convenient to do so.
|
|
8792
9334
|
** Otherwise return NULL.
|
|
8793
9335
|
** <tr><td> 2 <td> Make every effort to allocate a new page. Only return
|
|
8794
9336
|
** NULL if allocating a new page is effectively impossible.
|
|
@@ -8805,7 +9347,7 @@ struct sqlite3_pcache_page {
|
|
|
8805
9347
|
** as its second argument. If the third parameter, discard, is non-zero,
|
|
8806
9348
|
** then the page must be evicted from the cache.
|
|
8807
9349
|
** ^If the discard parameter is
|
|
8808
|
-
** zero, then the page may be discarded or retained at the discretion of
|
|
9350
|
+
** zero, then the page may be discarded or retained at the discretion of the
|
|
8809
9351
|
** page cache implementation. ^The page cache implementation
|
|
8810
9352
|
** may choose to evict unpinned pages at any time.
|
|
8811
9353
|
**
|
|
@@ -8823,7 +9365,7 @@ struct sqlite3_pcache_page {
|
|
|
8823
9365
|
** When SQLite calls the xTruncate() method, the cache must discard all
|
|
8824
9366
|
** existing cache entries with page numbers (keys) greater than or equal
|
|
8825
9367
|
** to the value of the iLimit parameter passed to xTruncate(). If any
|
|
8826
|
-
** of these pages are pinned, they
|
|
9368
|
+
** of these pages are pinned, they become implicitly unpinned, meaning that
|
|
8827
9369
|
** they can be safely discarded.
|
|
8828
9370
|
**
|
|
8829
9371
|
** [[the xDestroy() page cache method]]
|
|
@@ -9003,7 +9545,7 @@ typedef struct sqlite3_backup sqlite3_backup;
|
|
|
9003
9545
|
** external process or via a database connection other than the one being
|
|
9004
9546
|
** used by the backup operation, then the backup will be automatically
|
|
9005
9547
|
** restarted by the next call to sqlite3_backup_step(). ^If the source
|
|
9006
|
-
** database is modified by
|
|
9548
|
+
** database is modified by using the same database connection as is used
|
|
9007
9549
|
** by the backup operation, then the backup database is automatically
|
|
9008
9550
|
** updated at the same time.
|
|
9009
9551
|
**
|
|
@@ -9020,7 +9562,7 @@ typedef struct sqlite3_backup sqlite3_backup;
|
|
|
9020
9562
|
** and may not be used following a call to sqlite3_backup_finish().
|
|
9021
9563
|
**
|
|
9022
9564
|
** ^The value returned by sqlite3_backup_finish is [SQLITE_OK] if no
|
|
9023
|
-
** sqlite3_backup_step() errors occurred, regardless
|
|
9565
|
+
** sqlite3_backup_step() errors occurred, regardless of whether or not
|
|
9024
9566
|
** sqlite3_backup_step() completed.
|
|
9025
9567
|
** ^If an out-of-memory condition or IO error occurred during any prior
|
|
9026
9568
|
** sqlite3_backup_step() call on the same [sqlite3_backup] object, then
|
|
@@ -9075,6 +9617,16 @@ typedef struct sqlite3_backup sqlite3_backup;
|
|
|
9075
9617
|
** APIs are not strictly speaking threadsafe. If they are invoked at the
|
|
9076
9618
|
** same time as another thread is invoking sqlite3_backup_step() it is
|
|
9077
9619
|
** possible that they return invalid values.
|
|
9620
|
+
**
|
|
9621
|
+
** <b>Alternatives To Using The Backup API</b>
|
|
9622
|
+
**
|
|
9623
|
+
** Other techniques for safely creating a consistent backup of an SQLite
|
|
9624
|
+
** database include:
|
|
9625
|
+
**
|
|
9626
|
+
** <ul>
|
|
9627
|
+
** <li> The [VACUUM INTO] command.
|
|
9628
|
+
** <li> The [sqlite3_rsync] utility program.
|
|
9629
|
+
** </ul>
|
|
9078
9630
|
*/
|
|
9079
9631
|
SQLITE_API sqlite3_backup *sqlite3_backup_init(
|
|
9080
9632
|
sqlite3 *pDest, /* Destination database handle */
|
|
@@ -9112,7 +9664,7 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p);
|
|
|
9112
9664
|
** application receives an SQLITE_LOCKED error, it may call the
|
|
9113
9665
|
** sqlite3_unlock_notify() method with the blocked connection handle as
|
|
9114
9666
|
** the first argument to register for a callback that will be invoked
|
|
9115
|
-
** when the blocking
|
|
9667
|
+
** when the blocking connection's current transaction is concluded. ^The
|
|
9116
9668
|
** callback is invoked from within the [sqlite3_step] or [sqlite3_close]
|
|
9117
9669
|
** call that concludes the blocking connection's transaction.
|
|
9118
9670
|
**
|
|
@@ -9132,7 +9684,7 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p);
|
|
|
9132
9684
|
** blocked connection already has a registered unlock-notify callback,
|
|
9133
9685
|
** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is
|
|
9134
9686
|
** called with a NULL pointer as its second argument, then any existing
|
|
9135
|
-
** unlock-notify callback is canceled. ^The blocked
|
|
9687
|
+
** unlock-notify callback is canceled. ^The blocked connection's
|
|
9136
9688
|
** unlock-notify callback may also be canceled by closing the blocked
|
|
9137
9689
|
** connection using [sqlite3_close()].
|
|
9138
9690
|
**
|
|
@@ -9302,7 +9854,7 @@ SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);
|
|
|
9302
9854
|
** is the number of pages currently in the write-ahead log file,
|
|
9303
9855
|
** including those that were just committed.
|
|
9304
9856
|
**
|
|
9305
|
-
** The callback function should normally return [SQLITE_OK]. ^If an error
|
|
9857
|
+
** ^The callback function should normally return [SQLITE_OK]. ^If an error
|
|
9306
9858
|
** code is returned, that error will propagate back up through the
|
|
9307
9859
|
** SQLite code base to cause the statement that provoked the callback
|
|
9308
9860
|
** to report an error, though the commit will have still occurred. If the
|
|
@@ -9310,13 +9862,26 @@ SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);
|
|
|
9310
9862
|
** that does not correspond to any valid SQLite error code, the results
|
|
9311
9863
|
** are undefined.
|
|
9312
9864
|
**
|
|
9313
|
-
** A single database handle may have at most a single write-ahead log
|
|
9314
|
-
** registered at one time. ^Calling [sqlite3_wal_hook()]
|
|
9315
|
-
** previously registered write-ahead
|
|
9316
|
-
**
|
|
9317
|
-
**
|
|
9318
|
-
**
|
|
9319
|
-
**
|
|
9865
|
+
** ^A single database handle may have at most a single write-ahead log
|
|
9866
|
+
** callback registered at one time. ^Calling [sqlite3_wal_hook()]
|
|
9867
|
+
** replaces the default behavior or previously registered write-ahead
|
|
9868
|
+
** log callback.
|
|
9869
|
+
**
|
|
9870
|
+
** ^The return value is a copy of the third parameter from the
|
|
9871
|
+
** previous call, if any, or 0.
|
|
9872
|
+
**
|
|
9873
|
+
** ^The [sqlite3_wal_autocheckpoint()] interface and the
|
|
9874
|
+
** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and
|
|
9875
|
+
** will overwrite any prior [sqlite3_wal_hook()] settings.
|
|
9876
|
+
**
|
|
9877
|
+
** ^If a write-ahead log callback is set using this function then
|
|
9878
|
+
** [sqlite3_wal_checkpoint_v2()] or [PRAGMA wal_checkpoint]
|
|
9879
|
+
** should be invoked periodically to keep the write-ahead log file
|
|
9880
|
+
** from growing without bound.
|
|
9881
|
+
**
|
|
9882
|
+
** ^Passing a NULL pointer for the callback disables automatic
|
|
9883
|
+
** checkpointing entirely. To re-enable the default behavior, call
|
|
9884
|
+
** sqlite3_wal_autocheckpoint(db,1000) or use [PRAGMA wal_checkpoint].
|
|
9320
9885
|
*/
|
|
9321
9886
|
SQLITE_API void *sqlite3_wal_hook(
|
|
9322
9887
|
sqlite3*,
|
|
@@ -9333,7 +9898,7 @@ SQLITE_API void *sqlite3_wal_hook(
|
|
|
9333
9898
|
** to automatically [checkpoint]
|
|
9334
9899
|
** after committing a transaction if there are N or
|
|
9335
9900
|
** more frames in the [write-ahead log] file. ^Passing zero or
|
|
9336
|
-
** a negative value as the
|
|
9901
|
+
** a negative value as the N parameter disables automatic
|
|
9337
9902
|
** checkpoints entirely.
|
|
9338
9903
|
**
|
|
9339
9904
|
** ^The callback registered by this function replaces any existing callback
|
|
@@ -9349,9 +9914,10 @@ SQLITE_API void *sqlite3_wal_hook(
|
|
|
9349
9914
|
**
|
|
9350
9915
|
** ^Every new [database connection] defaults to having the auto-checkpoint
|
|
9351
9916
|
** enabled with a threshold of 1000 or [SQLITE_DEFAULT_WAL_AUTOCHECKPOINT]
|
|
9352
|
-
** pages.
|
|
9353
|
-
**
|
|
9354
|
-
**
|
|
9917
|
+
** pages.
|
|
9918
|
+
**
|
|
9919
|
+
** ^The use of this interface is only necessary if the default setting
|
|
9920
|
+
** is found to be suboptimal for a particular application.
|
|
9355
9921
|
*/
|
|
9356
9922
|
SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
|
|
9357
9923
|
|
|
@@ -9416,6 +9982,11 @@ SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
|
|
|
9416
9982
|
** ^This mode works the same way as SQLITE_CHECKPOINT_RESTART with the
|
|
9417
9983
|
** addition that it also truncates the log file to zero bytes just prior
|
|
9418
9984
|
** to a successful return.
|
|
9985
|
+
**
|
|
9986
|
+
** <dt>SQLITE_CHECKPOINT_NOOP<dd>
|
|
9987
|
+
** ^This mode always checkpoints zero frames. The only reason to invoke
|
|
9988
|
+
** a NOOP checkpoint is to access the values returned by
|
|
9989
|
+
** sqlite3_wal_checkpoint_v2() via output parameters *pnLog and *pnCkpt.
|
|
9419
9990
|
** </dl>
|
|
9420
9991
|
**
|
|
9421
9992
|
** ^If pnLog is not NULL, then *pnLog is set to the total number of frames in
|
|
@@ -9486,6 +10057,7 @@ SQLITE_API int sqlite3_wal_checkpoint_v2(
|
|
|
9486
10057
|
** See the [sqlite3_wal_checkpoint_v2()] documentation for details on the
|
|
9487
10058
|
** meaning of each of these checkpoint modes.
|
|
9488
10059
|
*/
|
|
10060
|
+
#define SQLITE_CHECKPOINT_NOOP -1 /* Do no work at all */
|
|
9489
10061
|
#define SQLITE_CHECKPOINT_PASSIVE 0 /* Do as much as possible w/o blocking */
|
|
9490
10062
|
#define SQLITE_CHECKPOINT_FULL 1 /* Wait for writers, then checkpoint */
|
|
9491
10063
|
#define SQLITE_CHECKPOINT_RESTART 2 /* Like FULL but wait for readers */
|
|
@@ -9530,7 +10102,7 @@ SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);
|
|
|
9530
10102
|
** support constraints. In this configuration (which is the default) if
|
|
9531
10103
|
** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire
|
|
9532
10104
|
** statement is rolled back as if [ON CONFLICT | OR ABORT] had been
|
|
9533
|
-
** specified as part of the
|
|
10105
|
+
** specified as part of the user's SQL statement, regardless of the actual
|
|
9534
10106
|
** ON CONFLICT mode specified.
|
|
9535
10107
|
**
|
|
9536
10108
|
** If X is non-zero, then the virtual table implementation guarantees
|
|
@@ -9556,7 +10128,7 @@ SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);
|
|
|
9556
10128
|
** [[SQLITE_VTAB_DIRECTONLY]]<dt>SQLITE_VTAB_DIRECTONLY</dt>
|
|
9557
10129
|
** <dd>Calls of the form
|
|
9558
10130
|
** [sqlite3_vtab_config](db,SQLITE_VTAB_DIRECTONLY) from within the
|
|
9559
|
-
** the [xConnect] or [xCreate] methods of a [virtual table]
|
|
10131
|
+
** the [xConnect] or [xCreate] methods of a [virtual table] implementation
|
|
9560
10132
|
** prohibits that virtual table from being used from within triggers and
|
|
9561
10133
|
** views.
|
|
9562
10134
|
** </dd>
|
|
@@ -9564,18 +10136,28 @@ SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);
|
|
|
9564
10136
|
** [[SQLITE_VTAB_INNOCUOUS]]<dt>SQLITE_VTAB_INNOCUOUS</dt>
|
|
9565
10137
|
** <dd>Calls of the form
|
|
9566
10138
|
** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the
|
|
9567
|
-
**
|
|
10139
|
+
** [xConnect] or [xCreate] methods of a [virtual table] implementation
|
|
9568
10140
|
** identify that virtual table as being safe to use from within triggers
|
|
9569
10141
|
** and views. Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the
|
|
9570
10142
|
** virtual table can do no serious harm even if it is controlled by a
|
|
9571
10143
|
** malicious hacker. Developers should avoid setting the SQLITE_VTAB_INNOCUOUS
|
|
9572
10144
|
** flag unless absolutely necessary.
|
|
9573
10145
|
** </dd>
|
|
10146
|
+
**
|
|
10147
|
+
** [[SQLITE_VTAB_USES_ALL_SCHEMAS]]<dt>SQLITE_VTAB_USES_ALL_SCHEMAS</dt>
|
|
10148
|
+
** <dd>Calls of the form
|
|
10149
|
+
** [sqlite3_vtab_config](db,SQLITE_VTAB_USES_ALL_SCHEMA) from within the
|
|
10150
|
+
** the [xConnect] or [xCreate] methods of a [virtual table] implementation
|
|
10151
|
+
** instruct the query planner to begin at least a read transaction on
|
|
10152
|
+
** all schemas ("main", "temp", and any ATTACH-ed databases) whenever the
|
|
10153
|
+
** virtual table is used.
|
|
10154
|
+
** </dd>
|
|
9574
10155
|
** </dl>
|
|
9575
10156
|
*/
|
|
9576
10157
|
#define SQLITE_VTAB_CONSTRAINT_SUPPORT 1
|
|
9577
10158
|
#define SQLITE_VTAB_INNOCUOUS 2
|
|
9578
10159
|
#define SQLITE_VTAB_DIRECTONLY 3
|
|
10160
|
+
#define SQLITE_VTAB_USES_ALL_SCHEMAS 4
|
|
9579
10161
|
|
|
9580
10162
|
/*
|
|
9581
10163
|
** CAPI3REF: Determine The Virtual Table Conflict Policy
|
|
@@ -9682,26 +10264,47 @@ SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
|
|
|
9682
10264
|
** <li value="2"><p>
|
|
9683
10265
|
** ^(If the sqlite3_vtab_distinct() interface returns 2, that means
|
|
9684
10266
|
** that the query planner does not need the rows returned in any particular
|
|
9685
|
-
** order, as long as rows with the same values in all
|
|
9686
|
-
** are adjacent.)^ ^(Furthermore,
|
|
9687
|
-
**
|
|
9688
|
-
**
|
|
9689
|
-
**
|
|
9690
|
-
**
|
|
9691
|
-
**
|
|
9692
|
-
** ^However omitting the extra rows is optional.
|
|
10267
|
+
** order, as long as rows with the same values in all columns identified
|
|
10268
|
+
** by "aOrderBy" are adjacent.)^ ^(Furthermore, when two or more rows
|
|
10269
|
+
** contain the same values for all columns identified by "colUsed", all but
|
|
10270
|
+
** one such row may optionally be omitted from the result.)^
|
|
10271
|
+
** The virtual table is not required to omit rows that are duplicates
|
|
10272
|
+
** over the "colUsed" columns, but if the virtual table can do that without
|
|
10273
|
+
** too much extra effort, it could potentially help the query to run faster.
|
|
9693
10274
|
** This mode is used for a DISTINCT query.
|
|
9694
10275
|
** <li value="3"><p>
|
|
9695
|
-
** ^(If the sqlite3_vtab_distinct() interface returns 3, that means
|
|
9696
|
-
**
|
|
9697
|
-
**
|
|
9698
|
-
**
|
|
9699
|
-
**
|
|
10276
|
+
** ^(If the sqlite3_vtab_distinct() interface returns 3, that means the
|
|
10277
|
+
** virtual table must return rows in the order defined by "aOrderBy" as
|
|
10278
|
+
** if the sqlite3_vtab_distinct() interface had returned 0. However if
|
|
10279
|
+
** two or more rows in the result have the same values for all columns
|
|
10280
|
+
** identified by "colUsed", then all but one such row may optionally be
|
|
10281
|
+
** omitted.)^ Like when the return value is 2, the virtual table
|
|
10282
|
+
** is not required to omit rows that are duplicates over the "colUsed"
|
|
10283
|
+
** columns, but if the virtual table can do that without
|
|
10284
|
+
** too much extra effort, it could potentially help the query to run faster.
|
|
10285
|
+
** This mode is used for queries
|
|
9700
10286
|
** that have both DISTINCT and ORDER BY clauses.
|
|
9701
10287
|
** </ol>
|
|
9702
10288
|
**
|
|
10289
|
+
** <p>The following table summarizes the conditions under which the
|
|
10290
|
+
** virtual table is allowed to set the "orderByConsumed" flag based on
|
|
10291
|
+
** the value returned by sqlite3_vtab_distinct(). This table is a
|
|
10292
|
+
** restatement of the previous four paragraphs:
|
|
10293
|
+
**
|
|
10294
|
+
** <table border=1 cellspacing=0 cellpadding=10 width="90%">
|
|
10295
|
+
** <tr>
|
|
10296
|
+
** <td valign="top">sqlite3_vtab_distinct() return value
|
|
10297
|
+
** <td valign="top">Rows are returned in aOrderBy order
|
|
10298
|
+
** <td valign="top">Rows with the same value in all aOrderBy columns are adjacent
|
|
10299
|
+
** <td valign="top">Duplicates over all colUsed columns may be omitted
|
|
10300
|
+
** <tr><td>0<td>yes<td>yes<td>no
|
|
10301
|
+
** <tr><td>1<td>no<td>yes<td>no
|
|
10302
|
+
** <tr><td>2<td>no<td>yes<td>yes
|
|
10303
|
+
** <tr><td>3<td>yes<td>yes<td>yes
|
|
10304
|
+
** </table>
|
|
10305
|
+
**
|
|
9703
10306
|
** ^For the purposes of comparing virtual table output values to see if the
|
|
9704
|
-
** values are same value for sorting purposes, two NULL values are considered
|
|
10307
|
+
** values are the same value for sorting purposes, two NULL values are considered
|
|
9705
10308
|
** to be the same. In other words, the comparison operator is "IS"
|
|
9706
10309
|
** (or "IS NOT DISTINCT FROM") and not "==".
|
|
9707
10310
|
**
|
|
@@ -9711,7 +10314,7 @@ SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
|
|
|
9711
10314
|
**
|
|
9712
10315
|
** ^A virtual table implementation is always free to return rows in any order
|
|
9713
10316
|
** it wants, as long as the "orderByConsumed" flag is not set. ^When the
|
|
9714
|
-
**
|
|
10317
|
+
** "orderByConsumed" flag is unset, the query planner will add extra
|
|
9715
10318
|
** [bytecode] to ensure that the final results returned by the SQL query are
|
|
9716
10319
|
** ordered correctly. The use of the "orderByConsumed" flag and the
|
|
9717
10320
|
** sqlite3_vtab_distinct() interface is merely an optimization. ^Careful
|
|
@@ -9736,7 +10339,7 @@ SQLITE_API int sqlite3_vtab_distinct(sqlite3_index_info*);
|
|
|
9736
10339
|
** communicated to the xBestIndex method as a
|
|
9737
10340
|
** [SQLITE_INDEX_CONSTRAINT_EQ] constraint.)^ If xBestIndex wants to use
|
|
9738
10341
|
** this constraint, it must set the corresponding
|
|
9739
|
-
** aConstraintUsage[].argvIndex to a
|
|
10342
|
+
** aConstraintUsage[].argvIndex to a positive integer. ^(Then, under
|
|
9740
10343
|
** the usual mode of handling IN operators, SQLite generates [bytecode]
|
|
9741
10344
|
** that invokes the [xFilter|xFilter() method] once for each value
|
|
9742
10345
|
** on the right-hand side of the IN operator.)^ Thus the virtual table
|
|
@@ -9808,7 +10411,7 @@ SQLITE_API int sqlite3_vtab_in(sqlite3_index_info*, int iCons, int bHandle);
|
|
|
9808
10411
|
** sqlite3_vtab_in_next(X,P) should be one of the parameters to the
|
|
9809
10412
|
** xFilter method which invokes these routines, and specifically
|
|
9810
10413
|
** a parameter that was previously selected for all-at-once IN constraint
|
|
9811
|
-
** processing
|
|
10414
|
+
** processing using the [sqlite3_vtab_in()] interface in the
|
|
9812
10415
|
** [xBestIndex|xBestIndex method]. ^(If the X parameter is not
|
|
9813
10416
|
** an xFilter argument that was selected for all-at-once IN constraint
|
|
9814
10417
|
** processing, then these routines return [SQLITE_ERROR].)^
|
|
@@ -9863,7 +10466,7 @@ SQLITE_API int sqlite3_vtab_in_next(sqlite3_value *pVal, sqlite3_value **ppOut);
|
|
|
9863
10466
|
** and only if *V is set to a value. ^The sqlite3_vtab_rhs_value(P,J,V)
|
|
9864
10467
|
** inteface returns SQLITE_NOTFOUND if the right-hand side of the J-th
|
|
9865
10468
|
** constraint is not available. ^The sqlite3_vtab_rhs_value() interface
|
|
9866
|
-
** can return
|
|
10469
|
+
** can return a result code other than SQLITE_OK or SQLITE_NOTFOUND if
|
|
9867
10470
|
** something goes wrong.
|
|
9868
10471
|
**
|
|
9869
10472
|
** The sqlite3_vtab_rhs_value() interface is usually only successful if
|
|
@@ -9891,8 +10494,8 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
|
|
|
9891
10494
|
** KEYWORDS: {conflict resolution mode}
|
|
9892
10495
|
**
|
|
9893
10496
|
** These constants are returned by [sqlite3_vtab_on_conflict()] to
|
|
9894
|
-
** inform a [virtual table] implementation
|
|
9895
|
-
**
|
|
10497
|
+
** inform a [virtual table] implementation of the [ON CONFLICT] mode
|
|
10498
|
+
** for the SQL statement being evaluated.
|
|
9896
10499
|
**
|
|
9897
10500
|
** Note that the [SQLITE_IGNORE] constant is also used as a potential
|
|
9898
10501
|
** return value from the [sqlite3_set_authorizer()] callback and that
|
|
@@ -9932,39 +10535,39 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
|
|
|
9932
10535
|
** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt>
|
|
9933
10536
|
** <dd>^The "double" variable pointed to by the V parameter will be set to the
|
|
9934
10537
|
** query planner's estimate for the average number of rows output from each
|
|
9935
|
-
** iteration of the X-th loop. If the query planner's
|
|
10538
|
+
** iteration of the X-th loop. If the query planner's estimate was accurate,
|
|
9936
10539
|
** then this value will approximate the quotient NVISIT/NLOOP and the
|
|
9937
10540
|
** product of this value for all prior loops with the same SELECTID will
|
|
9938
|
-
** be the NLOOP value for the current loop
|
|
10541
|
+
** be the NLOOP value for the current loop.</dd>
|
|
9939
10542
|
**
|
|
9940
10543
|
** [[SQLITE_SCANSTAT_NAME]] <dt>SQLITE_SCANSTAT_NAME</dt>
|
|
9941
10544
|
** <dd>^The "const char *" variable pointed to by the V parameter will be set
|
|
9942
10545
|
** to a zero-terminated UTF-8 string containing the name of the index or table
|
|
9943
|
-
** used for the X-th loop
|
|
10546
|
+
** used for the X-th loop.</dd>
|
|
9944
10547
|
**
|
|
9945
10548
|
** [[SQLITE_SCANSTAT_EXPLAIN]] <dt>SQLITE_SCANSTAT_EXPLAIN</dt>
|
|
9946
10549
|
** <dd>^The "const char *" variable pointed to by the V parameter will be set
|
|
9947
10550
|
** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN]
|
|
9948
|
-
** description for the X-th loop
|
|
10551
|
+
** description for the X-th loop.</dd>
|
|
9949
10552
|
**
|
|
9950
10553
|
** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECTID</dt>
|
|
9951
10554
|
** <dd>^The "int" variable pointed to by the V parameter will be set to the
|
|
9952
10555
|
** id for the X-th query plan element. The id value is unique within the
|
|
9953
10556
|
** statement. The select-id is the same value as is output in the first
|
|
9954
|
-
** column of an [EXPLAIN QUERY PLAN] query
|
|
10557
|
+
** column of an [EXPLAIN QUERY PLAN] query.</dd>
|
|
9955
10558
|
**
|
|
9956
10559
|
** [[SQLITE_SCANSTAT_PARENTID]] <dt>SQLITE_SCANSTAT_PARENTID</dt>
|
|
9957
10560
|
** <dd>The "int" variable pointed to by the V parameter will be set to the
|
|
9958
|
-
**
|
|
10561
|
+
** id of the parent of the current query element, if applicable, or
|
|
9959
10562
|
** to zero if the query element has no parent. This is the same value as
|
|
9960
|
-
** returned in the second column of an [EXPLAIN QUERY PLAN] query
|
|
10563
|
+
** returned in the second column of an [EXPLAIN QUERY PLAN] query.</dd>
|
|
9961
10564
|
**
|
|
9962
10565
|
** [[SQLITE_SCANSTAT_NCYCLE]] <dt>SQLITE_SCANSTAT_NCYCLE</dt>
|
|
9963
10566
|
** <dd>The sqlite3_int64 output value is set to the number of cycles,
|
|
9964
10567
|
** according to the processor time-stamp counter, that elapsed while the
|
|
9965
10568
|
** query element was being processed. This value is not available for
|
|
9966
10569
|
** all query elements - if it is unavailable the output variable is
|
|
9967
|
-
** set to -1
|
|
10570
|
+
** set to -1.</dd>
|
|
9968
10571
|
** </dl>
|
|
9969
10572
|
*/
|
|
9970
10573
|
#define SQLITE_SCANSTAT_NLOOP 0
|
|
@@ -10005,8 +10608,8 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
|
|
|
10005
10608
|
** sqlite3_stmt_scanstatus_v2() with a zeroed flags parameter.
|
|
10006
10609
|
**
|
|
10007
10610
|
** Parameter "idx" identifies the specific query element to retrieve statistics
|
|
10008
|
-
** for. Query elements are numbered starting from zero. A value of -1 may
|
|
10009
|
-
**
|
|
10611
|
+
** for. Query elements are numbered starting from zero. A value of -1 may
|
|
10612
|
+
** retrieve statistics for the entire query. ^If idx is out of range
|
|
10010
10613
|
** - less than -1 or greater than or equal to the total number of query
|
|
10011
10614
|
** elements used to implement the statement - a non-zero value is returned and
|
|
10012
10615
|
** the variable that pOut points to is unchanged.
|
|
@@ -10049,7 +10652,7 @@ SQLITE_API void sqlite3_stmt_scanstatus_reset(sqlite3_stmt*);
|
|
|
10049
10652
|
** METHOD: sqlite3
|
|
10050
10653
|
**
|
|
10051
10654
|
** ^If a write-transaction is open on [database connection] D when the
|
|
10052
|
-
** [sqlite3_db_cacheflush(D)] interface invoked, any dirty
|
|
10655
|
+
** [sqlite3_db_cacheflush(D)] interface is invoked, any dirty
|
|
10053
10656
|
** pages in the pager-cache that are not currently in use are written out
|
|
10054
10657
|
** to disk. A dirty page may be in use if a database cursor created by an
|
|
10055
10658
|
** active SQL statement is reading from it, or if it is page 1 of a database
|
|
@@ -10163,9 +10766,9 @@ SQLITE_API int sqlite3_db_cacheflush(sqlite3*);
|
|
|
10163
10766
|
** triggers; and so forth.
|
|
10164
10767
|
**
|
|
10165
10768
|
** When the [sqlite3_blob_write()] API is used to update a blob column,
|
|
10166
|
-
** the pre-update hook is invoked with SQLITE_DELETE
|
|
10167
|
-
**
|
|
10168
|
-
** callback made with op==SQLITE_DELETE is
|
|
10769
|
+
** the pre-update hook is invoked with SQLITE_DELETE, because
|
|
10770
|
+
** the new values are not yet available. In this case, when a
|
|
10771
|
+
** callback made with op==SQLITE_DELETE is actually a write using the
|
|
10169
10772
|
** sqlite3_blob_write() API, the [sqlite3_preupdate_blobwrite()] returns
|
|
10170
10773
|
** the index of the column being written. In other cases, where the
|
|
10171
10774
|
** pre-update hook is being invoked for some other reason, including a
|
|
@@ -10243,6 +10846,14 @@ typedef struct sqlite3_snapshot {
|
|
|
10243
10846
|
** If there is not already a read-transaction open on schema S when
|
|
10244
10847
|
** this function is called, one is opened automatically.
|
|
10245
10848
|
**
|
|
10849
|
+
** If a read-transaction is opened by this function, then it is guaranteed
|
|
10850
|
+
** that the returned snapshot object may not be invalidated by a database
|
|
10851
|
+
** writer or checkpointer until after the read-transaction is closed. This
|
|
10852
|
+
** is not guaranteed if a read-transaction is already open when this
|
|
10853
|
+
** function is called. In that case, any subsequent write or checkpoint
|
|
10854
|
+
** operation on the database may invalidate the returned snapshot handle,
|
|
10855
|
+
** even while the read-transaction remains open.
|
|
10856
|
+
**
|
|
10246
10857
|
** The following must be true for this function to succeed. If any of
|
|
10247
10858
|
** the following statements are false when sqlite3_snapshot_get() is
|
|
10248
10859
|
** called, SQLITE_ERROR is returned. The final value of *P is undefined
|
|
@@ -10274,7 +10885,7 @@ typedef struct sqlite3_snapshot {
|
|
|
10274
10885
|
** The [sqlite3_snapshot_get()] interface is only available when the
|
|
10275
10886
|
** [SQLITE_ENABLE_SNAPSHOT] compile-time option is used.
|
|
10276
10887
|
*/
|
|
10277
|
-
SQLITE_API
|
|
10888
|
+
SQLITE_API int sqlite3_snapshot_get(
|
|
10278
10889
|
sqlite3 *db,
|
|
10279
10890
|
const char *zSchema,
|
|
10280
10891
|
sqlite3_snapshot **ppSnapshot
|
|
@@ -10323,7 +10934,7 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_get(
|
|
|
10323
10934
|
** The [sqlite3_snapshot_open()] interface is only available when the
|
|
10324
10935
|
** [SQLITE_ENABLE_SNAPSHOT] compile-time option is used.
|
|
10325
10936
|
*/
|
|
10326
|
-
SQLITE_API
|
|
10937
|
+
SQLITE_API int sqlite3_snapshot_open(
|
|
10327
10938
|
sqlite3 *db,
|
|
10328
10939
|
const char *zSchema,
|
|
10329
10940
|
sqlite3_snapshot *pSnapshot
|
|
@@ -10340,7 +10951,7 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_open(
|
|
|
10340
10951
|
** The [sqlite3_snapshot_free()] interface is only available when the
|
|
10341
10952
|
** [SQLITE_ENABLE_SNAPSHOT] compile-time option is used.
|
|
10342
10953
|
*/
|
|
10343
|
-
SQLITE_API
|
|
10954
|
+
SQLITE_API void sqlite3_snapshot_free(sqlite3_snapshot*);
|
|
10344
10955
|
|
|
10345
10956
|
/*
|
|
10346
10957
|
** CAPI3REF: Compare the ages of two snapshot handles.
|
|
@@ -10367,7 +10978,7 @@ SQLITE_API SQLITE_EXPERIMENTAL void sqlite3_snapshot_free(sqlite3_snapshot*);
|
|
|
10367
10978
|
** This interface is only available if SQLite is compiled with the
|
|
10368
10979
|
** [SQLITE_ENABLE_SNAPSHOT] option.
|
|
10369
10980
|
*/
|
|
10370
|
-
SQLITE_API
|
|
10981
|
+
SQLITE_API int sqlite3_snapshot_cmp(
|
|
10371
10982
|
sqlite3_snapshot *p1,
|
|
10372
10983
|
sqlite3_snapshot *p2
|
|
10373
10984
|
);
|
|
@@ -10395,20 +11006,21 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_cmp(
|
|
|
10395
11006
|
** This interface is only available if SQLite is compiled with the
|
|
10396
11007
|
** [SQLITE_ENABLE_SNAPSHOT] option.
|
|
10397
11008
|
*/
|
|
10398
|
-
SQLITE_API
|
|
11009
|
+
SQLITE_API int sqlite3_snapshot_recover(sqlite3 *db, const char *zDb);
|
|
10399
11010
|
|
|
10400
11011
|
/*
|
|
10401
11012
|
** CAPI3REF: Serialize a database
|
|
10402
11013
|
**
|
|
10403
|
-
** The sqlite3_serialize(D,S,P,F) interface returns a pointer to
|
|
10404
|
-
** that is a serialization of the S database on
|
|
11014
|
+
** The sqlite3_serialize(D,S,P,F) interface returns a pointer to
|
|
11015
|
+
** memory that is a serialization of the S database on
|
|
11016
|
+
** [database connection] D. If S is a NULL pointer, the main database is used.
|
|
10405
11017
|
** If P is not a NULL pointer, then the size of the database in bytes
|
|
10406
11018
|
** is written into *P.
|
|
10407
11019
|
**
|
|
10408
11020
|
** For an ordinary on-disk database file, the serialization is just a
|
|
10409
11021
|
** copy of the disk file. For an in-memory database or a "TEMP" database,
|
|
10410
11022
|
** the serialization is the same sequence of bytes which would be written
|
|
10411
|
-
** to disk if that database
|
|
11023
|
+
** to disk if that database were backed up to disk.
|
|
10412
11024
|
**
|
|
10413
11025
|
** The usual case is that sqlite3_serialize() copies the serialization of
|
|
10414
11026
|
** the database into memory obtained from [sqlite3_malloc64()] and returns
|
|
@@ -10417,7 +11029,7 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const c
|
|
|
10417
11029
|
** contains the SQLITE_SERIALIZE_NOCOPY bit, then no memory allocations
|
|
10418
11030
|
** are made, and the sqlite3_serialize() function will return a pointer
|
|
10419
11031
|
** to the contiguous memory representation of the database that SQLite
|
|
10420
|
-
** is currently using for that database, or NULL if
|
|
11032
|
+
** is currently using for that database, or NULL if no such contiguous
|
|
10421
11033
|
** memory representation of the database exists. A contiguous memory
|
|
10422
11034
|
** representation of the database will usually only exist if there has
|
|
10423
11035
|
** been a prior call to [sqlite3_deserialize(D,S,...)] with the same
|
|
@@ -10426,6 +11038,13 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const c
|
|
|
10426
11038
|
** SQLITE_SERIALIZE_NOCOPY bit is set but no contiguous copy
|
|
10427
11039
|
** of the database exists.
|
|
10428
11040
|
**
|
|
11041
|
+
** After the call, if the SQLITE_SERIALIZE_NOCOPY bit had been set,
|
|
11042
|
+
** the returned buffer content will remain accessible and unchanged
|
|
11043
|
+
** until either the next write operation on the connection or when
|
|
11044
|
+
** the connection is closed, and applications must not modify the
|
|
11045
|
+
** buffer. If the bit had been clear, the returned buffer will not
|
|
11046
|
+
** be accessed by SQLite after the call.
|
|
11047
|
+
**
|
|
10429
11048
|
** A call to sqlite3_serialize(D,S,P,F) might return NULL even if the
|
|
10430
11049
|
** SQLITE_SERIALIZE_NOCOPY bit is omitted from argument F if a memory
|
|
10431
11050
|
** allocation error occurs.
|
|
@@ -10461,12 +11080,13 @@ SQLITE_API unsigned char *sqlite3_serialize(
|
|
|
10461
11080
|
**
|
|
10462
11081
|
** The sqlite3_deserialize(D,S,P,N,M,F) interface causes the
|
|
10463
11082
|
** [database connection] D to disconnect from database S and then
|
|
10464
|
-
** reopen S as an in-memory database based on the serialization
|
|
10465
|
-
** in P.
|
|
10466
|
-
**
|
|
10467
|
-
** the
|
|
10468
|
-
**
|
|
10469
|
-
**
|
|
11083
|
+
** reopen S as an in-memory database based on the serialization
|
|
11084
|
+
** contained in P. If S is a NULL pointer, the main database is
|
|
11085
|
+
** used. The serialized database P is N bytes in size. M is the size
|
|
11086
|
+
** of the buffer P, which might be larger than N. If M is larger than
|
|
11087
|
+
** N, and the SQLITE_DESERIALIZE_READONLY bit is not set in F, then
|
|
11088
|
+
** SQLite is permitted to add content to the in-memory database as
|
|
11089
|
+
** long as the total size does not exceed M bytes.
|
|
10470
11090
|
**
|
|
10471
11091
|
** If the SQLITE_DESERIALIZE_FREEONCLOSE bit is set in F, then SQLite will
|
|
10472
11092
|
** invoke sqlite3_free() on the serialization buffer when the database
|
|
@@ -10474,14 +11094,24 @@ SQLITE_API unsigned char *sqlite3_serialize(
|
|
|
10474
11094
|
** SQLite will try to increase the buffer size using sqlite3_realloc64()
|
|
10475
11095
|
** if writes on the database cause it to grow larger than M bytes.
|
|
10476
11096
|
**
|
|
11097
|
+
** Applications must not modify the buffer P or invalidate it before
|
|
11098
|
+
** the database connection D is closed.
|
|
11099
|
+
**
|
|
10477
11100
|
** The sqlite3_deserialize() interface will fail with SQLITE_BUSY if the
|
|
10478
11101
|
** database is currently in a read transaction or is involved in a backup
|
|
10479
11102
|
** operation.
|
|
10480
11103
|
**
|
|
10481
|
-
** It is not possible to
|
|
11104
|
+
** It is not possible to deserialize into the TEMP database. If the
|
|
10482
11105
|
** S argument to sqlite3_deserialize(D,S,P,N,M,F) is "temp" then the
|
|
10483
11106
|
** function returns SQLITE_ERROR.
|
|
10484
11107
|
**
|
|
11108
|
+
** The deserialized database should not be in [WAL mode]. If the database
|
|
11109
|
+
** is in WAL mode, then any attempt to use the database file will result
|
|
11110
|
+
** in an [SQLITE_CANTOPEN] error. The application can set the
|
|
11111
|
+
** [file format version numbers] (bytes 18 and 19) of the input database P
|
|
11112
|
+
** to 0x01 prior to invoking sqlite3_deserialize(D,S,P,N,M,F) to force the
|
|
11113
|
+
** database file into rollback mode and work around this limitation.
|
|
11114
|
+
**
|
|
10485
11115
|
** If sqlite3_deserialize(D,S,P,N,M,F) fails for any reason and if the
|
|
10486
11116
|
** SQLITE_DESERIALIZE_FREEONCLOSE bit is set in argument F, then
|
|
10487
11117
|
** [sqlite3_free()] is invoked on argument P prior to returning.
|
|
@@ -10493,7 +11123,7 @@ SQLITE_API int sqlite3_deserialize(
|
|
|
10493
11123
|
sqlite3 *db, /* The database connection */
|
|
10494
11124
|
const char *zSchema, /* Which DB to reopen with the deserialization */
|
|
10495
11125
|
unsigned char *pData, /* The serialized database content */
|
|
10496
|
-
sqlite3_int64 szDb, /* Number bytes in the deserialization */
|
|
11126
|
+
sqlite3_int64 szDb, /* Number of bytes in the deserialization */
|
|
10497
11127
|
sqlite3_int64 szBuf, /* Total size of buffer pData[] */
|
|
10498
11128
|
unsigned mFlags /* Zero or more SQLITE_DESERIALIZE_* flags */
|
|
10499
11129
|
);
|
|
@@ -10501,7 +11131,7 @@ SQLITE_API int sqlite3_deserialize(
|
|
|
10501
11131
|
/*
|
|
10502
11132
|
** CAPI3REF: Flags for sqlite3_deserialize()
|
|
10503
11133
|
**
|
|
10504
|
-
** The following are allowed values for 6th argument (the F argument) to
|
|
11134
|
+
** The following are allowed values for the 6th argument (the F argument) to
|
|
10505
11135
|
** the [sqlite3_deserialize(D,S,P,N,M,F)] interface.
|
|
10506
11136
|
**
|
|
10507
11137
|
** The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization
|
|
@@ -10523,6 +11153,54 @@ SQLITE_API int sqlite3_deserialize(
|
|
|
10523
11153
|
#define SQLITE_DESERIALIZE_RESIZEABLE 2 /* Resize using sqlite3_realloc64() */
|
|
10524
11154
|
#define SQLITE_DESERIALIZE_READONLY 4 /* Database is read-only */
|
|
10525
11155
|
|
|
11156
|
+
/*
|
|
11157
|
+
** CAPI3REF: Bind array values to the CARRAY table-valued function
|
|
11158
|
+
**
|
|
11159
|
+
** The sqlite3_carray_bind(S,I,P,N,F,X) interface binds an array value to
|
|
11160
|
+
** one of the first argument of the [carray() table-valued function]. The
|
|
11161
|
+
** S parameter is a pointer to the [prepared statement] that uses the carray()
|
|
11162
|
+
** functions. I is the parameter index to be bound. P is a pointer to the
|
|
11163
|
+
** array to be bound, and N is the number of eements in the array. The
|
|
11164
|
+
** F argument is one of constants [SQLITE_CARRAY_INT32], [SQLITE_CARRAY_INT64],
|
|
11165
|
+
** [SQLITE_CARRAY_DOUBLE], [SQLITE_CARRAY_TEXT], or [SQLITE_CARRAY_BLOB] to
|
|
11166
|
+
** indicate the datatype of the array being bound. The X argument is not a
|
|
11167
|
+
** NULL pointer, then SQLite will invoke the function X on the P parameter
|
|
11168
|
+
** after it has finished using P, even if the call to
|
|
11169
|
+
** sqlite3_carray_bind() fails. The special-case finalizer
|
|
11170
|
+
** SQLITE_TRANSIENT has no effect here.
|
|
11171
|
+
*/
|
|
11172
|
+
SQLITE_API int sqlite3_carray_bind(
|
|
11173
|
+
sqlite3_stmt *pStmt, /* Statement to be bound */
|
|
11174
|
+
int i, /* Parameter index */
|
|
11175
|
+
void *aData, /* Pointer to array data */
|
|
11176
|
+
int nData, /* Number of data elements */
|
|
11177
|
+
int mFlags, /* CARRAY flags */
|
|
11178
|
+
void (*xDel)(void*) /* Destructor for aData */
|
|
11179
|
+
);
|
|
11180
|
+
|
|
11181
|
+
/*
|
|
11182
|
+
** CAPI3REF: Datatypes for the CARRAY table-valued function
|
|
11183
|
+
**
|
|
11184
|
+
** The fifth argument to the [sqlite3_carray_bind()] interface musts be
|
|
11185
|
+
** one of the following constants, to specify the datatype of the array
|
|
11186
|
+
** that is being bound into the [carray table-valued function].
|
|
11187
|
+
*/
|
|
11188
|
+
#define SQLITE_CARRAY_INT32 0 /* Data is 32-bit signed integers */
|
|
11189
|
+
#define SQLITE_CARRAY_INT64 1 /* Data is 64-bit signed integers */
|
|
11190
|
+
#define SQLITE_CARRAY_DOUBLE 2 /* Data is doubles */
|
|
11191
|
+
#define SQLITE_CARRAY_TEXT 3 /* Data is char* */
|
|
11192
|
+
#define SQLITE_CARRAY_BLOB 4 /* Data is struct iovec */
|
|
11193
|
+
|
|
11194
|
+
/*
|
|
11195
|
+
** Versions of the above #defines that omit the initial SQLITE_, for
|
|
11196
|
+
** legacy compatibility.
|
|
11197
|
+
*/
|
|
11198
|
+
#define CARRAY_INT32 0 /* Data is 32-bit signed integers */
|
|
11199
|
+
#define CARRAY_INT64 1 /* Data is 64-bit signed integers */
|
|
11200
|
+
#define CARRAY_DOUBLE 2 /* Data is doubles */
|
|
11201
|
+
#define CARRAY_TEXT 3 /* Data is char* */
|
|
11202
|
+
#define CARRAY_BLOB 4 /* Data is struct iovec */
|
|
11203
|
+
|
|
10526
11204
|
/*
|
|
10527
11205
|
** Undo the hack that converts floating point types to integer for
|
|
10528
11206
|
** builds on processors without floating point support.
|
|
@@ -10534,8 +11212,6 @@ SQLITE_API int sqlite3_deserialize(
|
|
|
10534
11212
|
#if defined(__wasi__)
|
|
10535
11213
|
# undef SQLITE_WASI
|
|
10536
11214
|
# define SQLITE_WASI 1
|
|
10537
|
-
# undef SQLITE_OMIT_WAL
|
|
10538
|
-
# define SQLITE_OMIT_WAL 1/* because it requires shared memory APIs */
|
|
10539
11215
|
# ifndef SQLITE_OMIT_LOAD_EXTENSION
|
|
10540
11216
|
# define SQLITE_OMIT_LOAD_EXTENSION
|
|
10541
11217
|
# endif
|
|
@@ -10547,7 +11223,7 @@ SQLITE_API int sqlite3_deserialize(
|
|
|
10547
11223
|
#ifdef __cplusplus
|
|
10548
11224
|
} /* End of the 'extern "C"' block */
|
|
10549
11225
|
#endif
|
|
10550
|
-
#endif
|
|
11226
|
+
/* #endif for SQLITE3_H will be added by mksqlite3.tcl */
|
|
10551
11227
|
|
|
10552
11228
|
/******** Begin file sqlite3rtree.h *********/
|
|
10553
11229
|
/*
|
|
@@ -10750,16 +11426,20 @@ SQLITE_API int sqlite3session_create(
|
|
|
10750
11426
|
SQLITE_API void sqlite3session_delete(sqlite3_session *pSession);
|
|
10751
11427
|
|
|
10752
11428
|
/*
|
|
10753
|
-
**
|
|
11429
|
+
** CAPI3REF: Configure a Session Object
|
|
10754
11430
|
** METHOD: sqlite3_session
|
|
10755
11431
|
**
|
|
10756
11432
|
** This method is used to configure a session object after it has been
|
|
10757
|
-
** created. At present the only valid
|
|
10758
|
-
** [SQLITE_SESSION_OBJCONFIG_SIZE].
|
|
11433
|
+
** created. At present the only valid values for the second parameter are
|
|
11434
|
+
** [SQLITE_SESSION_OBJCONFIG_SIZE] and [SQLITE_SESSION_OBJCONFIG_ROWID].
|
|
10759
11435
|
**
|
|
10760
|
-
|
|
11436
|
+
*/
|
|
11437
|
+
SQLITE_API int sqlite3session_object_config(sqlite3_session*, int op, void *pArg);
|
|
11438
|
+
|
|
11439
|
+
/*
|
|
11440
|
+
** CAPI3REF: Options for sqlite3session_object_config
|
|
10761
11441
|
**
|
|
10762
|
-
** The following values may passed as the the
|
|
11442
|
+
** The following values may passed as the the 2nd parameter to
|
|
10763
11443
|
** sqlite3session_object_config().
|
|
10764
11444
|
**
|
|
10765
11445
|
** <dt>SQLITE_SESSION_OBJCONFIG_SIZE <dd>
|
|
@@ -10775,12 +11455,21 @@ SQLITE_API void sqlite3session_delete(sqlite3_session *pSession);
|
|
|
10775
11455
|
**
|
|
10776
11456
|
** It is an error (SQLITE_MISUSE) to attempt to modify this setting after
|
|
10777
11457
|
** the first table has been attached to the session object.
|
|
11458
|
+
**
|
|
11459
|
+
** <dt>SQLITE_SESSION_OBJCONFIG_ROWID <dd>
|
|
11460
|
+
** This option is used to set, clear or query the flag that enables
|
|
11461
|
+
** collection of data for tables with no explicit PRIMARY KEY.
|
|
11462
|
+
**
|
|
11463
|
+
** Normally, tables with no explicit PRIMARY KEY are simply ignored
|
|
11464
|
+
** by the sessions module. However, if this flag is set, it behaves
|
|
11465
|
+
** as if such tables have a column "_rowid_ INTEGER PRIMARY KEY" inserted
|
|
11466
|
+
** as their leftmost columns.
|
|
11467
|
+
**
|
|
11468
|
+
** It is an error (SQLITE_MISUSE) to attempt to modify this setting after
|
|
11469
|
+
** the first table has been attached to the session object.
|
|
10778
11470
|
*/
|
|
10779
|
-
|
|
10780
|
-
|
|
10781
|
-
/*
|
|
10782
|
-
*/
|
|
10783
|
-
#define SQLITE_SESSION_OBJCONFIG_SIZE 1
|
|
11471
|
+
#define SQLITE_SESSION_OBJCONFIG_SIZE 1
|
|
11472
|
+
#define SQLITE_SESSION_OBJCONFIG_ROWID 2
|
|
10784
11473
|
|
|
10785
11474
|
/*
|
|
10786
11475
|
** CAPI3REF: Enable Or Disable A Session Object
|
|
@@ -11015,9 +11704,10 @@ SQLITE_API void sqlite3session_table_filter(
|
|
|
11015
11704
|
** is inserted while a session object is enabled, then later deleted while
|
|
11016
11705
|
** the same session object is disabled, no INSERT record will appear in the
|
|
11017
11706
|
** changeset, even though the delete took place while the session was disabled.
|
|
11018
|
-
** Or, if one field of a row is updated while a session is
|
|
11019
|
-
** another field of the same row is updated while the session is
|
|
11020
|
-
** resulting changeset will contain an UPDATE change that updates both
|
|
11707
|
+
** Or, if one field of a row is updated while a session is enabled, and
|
|
11708
|
+
** then another field of the same row is updated while the session is disabled,
|
|
11709
|
+
** the resulting changeset will contain an UPDATE change that updates both
|
|
11710
|
+
** fields.
|
|
11021
11711
|
*/
|
|
11022
11712
|
SQLITE_API int sqlite3session_changeset(
|
|
11023
11713
|
sqlite3_session *pSession, /* Session object */
|
|
@@ -11089,8 +11779,9 @@ SQLITE_API sqlite3_int64 sqlite3session_changeset_size(sqlite3_session *pSession
|
|
|
11089
11779
|
** database zFrom the contents of the two compatible tables would be
|
|
11090
11780
|
** identical.
|
|
11091
11781
|
**
|
|
11092
|
-
**
|
|
11093
|
-
**
|
|
11782
|
+
** Unless the call to this function is a no-op as described above, it is an
|
|
11783
|
+
** error if database zFrom does not exist or does not contain the required
|
|
11784
|
+
** compatible table.
|
|
11094
11785
|
**
|
|
11095
11786
|
** If the operation is successful, SQLITE_OK is returned. Otherwise, an SQLite
|
|
11096
11787
|
** error code. In this case, if argument pzErrMsg is not NULL, *pzErrMsg
|
|
@@ -11225,7 +11916,7 @@ SQLITE_API int sqlite3changeset_start_v2(
|
|
|
11225
11916
|
** The following flags may passed via the 4th parameter to
|
|
11226
11917
|
** [sqlite3changeset_start_v2] and [sqlite3changeset_start_v2_strm]:
|
|
11227
11918
|
**
|
|
11228
|
-
** <dt>
|
|
11919
|
+
** <dt>SQLITE_CHANGESETSTART_INVERT <dd>
|
|
11229
11920
|
** Invert the changeset while iterating through it. This is equivalent to
|
|
11230
11921
|
** inverting a changeset using sqlite3changeset_invert() before applying it.
|
|
11231
11922
|
** It is an error to specify this flag with a patchset.
|
|
@@ -11540,7 +12231,6 @@ SQLITE_API int sqlite3changeset_concat(
|
|
|
11540
12231
|
void **ppOut /* OUT: Buffer containing output changeset */
|
|
11541
12232
|
);
|
|
11542
12233
|
|
|
11543
|
-
|
|
11544
12234
|
/*
|
|
11545
12235
|
** CAPI3REF: Changegroup Handle
|
|
11546
12236
|
**
|
|
@@ -11587,6 +12277,38 @@ typedef struct sqlite3_changegroup sqlite3_changegroup;
|
|
|
11587
12277
|
*/
|
|
11588
12278
|
SQLITE_API int sqlite3changegroup_new(sqlite3_changegroup **pp);
|
|
11589
12279
|
|
|
12280
|
+
/*
|
|
12281
|
+
** CAPI3REF: Add a Schema to a Changegroup
|
|
12282
|
+
** METHOD: sqlite3_changegroup_schema
|
|
12283
|
+
**
|
|
12284
|
+
** This method may be used to optionally enforce the rule that the changesets
|
|
12285
|
+
** added to the changegroup handle must match the schema of database zDb
|
|
12286
|
+
** ("main", "temp", or the name of an attached database). If
|
|
12287
|
+
** sqlite3changegroup_add() is called to add a changeset that is not compatible
|
|
12288
|
+
** with the configured schema, SQLITE_SCHEMA is returned and the changegroup
|
|
12289
|
+
** object is left in an undefined state.
|
|
12290
|
+
**
|
|
12291
|
+
** A changeset schema is considered compatible with the database schema in
|
|
12292
|
+
** the same way as for sqlite3changeset_apply(). Specifically, for each
|
|
12293
|
+
** table in the changeset, there exists a database table with:
|
|
12294
|
+
**
|
|
12295
|
+
** <ul>
|
|
12296
|
+
** <li> The name identified by the changeset, and
|
|
12297
|
+
** <li> at least as many columns as recorded in the changeset, and
|
|
12298
|
+
** <li> the primary key columns in the same position as recorded in
|
|
12299
|
+
** the changeset.
|
|
12300
|
+
** </ul>
|
|
12301
|
+
**
|
|
12302
|
+
** The output of the changegroup object always has the same schema as the
|
|
12303
|
+
** database nominated using this function. In cases where changesets passed
|
|
12304
|
+
** to sqlite3changegroup_add() have fewer columns than the corresponding table
|
|
12305
|
+
** in the database schema, these are filled in using the default column
|
|
12306
|
+
** values from the database schema. This makes it possible to combined
|
|
12307
|
+
** changesets that have different numbers of columns for a single table
|
|
12308
|
+
** within a changegroup, provided that they are otherwise compatible.
|
|
12309
|
+
*/
|
|
12310
|
+
SQLITE_API int sqlite3changegroup_schema(sqlite3_changegroup*, sqlite3*, const char *zDb);
|
|
12311
|
+
|
|
11590
12312
|
/*
|
|
11591
12313
|
** CAPI3REF: Add A Changeset To A Changegroup
|
|
11592
12314
|
** METHOD: sqlite3_changegroup
|
|
@@ -11655,16 +12377,45 @@ SQLITE_API int sqlite3changegroup_new(sqlite3_changegroup **pp);
|
|
|
11655
12377
|
** If the new changeset contains changes to a table that is already present
|
|
11656
12378
|
** in the changegroup, then the number of columns and the position of the
|
|
11657
12379
|
** primary key columns for the table must be consistent. If this is not the
|
|
11658
|
-
** case, this function fails with SQLITE_SCHEMA.
|
|
11659
|
-
**
|
|
11660
|
-
**
|
|
11661
|
-
**
|
|
11662
|
-
**
|
|
12380
|
+
** case, this function fails with SQLITE_SCHEMA. Except, if the changegroup
|
|
12381
|
+
** object has been configured with a database schema using the
|
|
12382
|
+
** sqlite3changegroup_schema() API, then it is possible to combine changesets
|
|
12383
|
+
** with different numbers of columns for a single table, provided that
|
|
12384
|
+
** they are otherwise compatible.
|
|
11663
12385
|
**
|
|
11664
|
-
** If
|
|
12386
|
+
** If the input changeset appears to be corrupt and the corruption is
|
|
12387
|
+
** detected, SQLITE_CORRUPT is returned. Or, if an out-of-memory condition
|
|
12388
|
+
** occurs during processing, this function returns SQLITE_NOMEM.
|
|
12389
|
+
**
|
|
12390
|
+
** In all cases, if an error occurs the state of the final contents of the
|
|
12391
|
+
** changegroup is undefined. If no error occurs, SQLITE_OK is returned.
|
|
11665
12392
|
*/
|
|
11666
12393
|
SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData);
|
|
11667
12394
|
|
|
12395
|
+
/*
|
|
12396
|
+
** CAPI3REF: Add A Single Change To A Changegroup
|
|
12397
|
+
** METHOD: sqlite3_changegroup
|
|
12398
|
+
**
|
|
12399
|
+
** This function adds the single change currently indicated by the iterator
|
|
12400
|
+
** passed as the second argument to the changegroup object. The rules for
|
|
12401
|
+
** adding the change are just as described for [sqlite3changegroup_add()].
|
|
12402
|
+
**
|
|
12403
|
+
** If the change is successfully added to the changegroup, SQLITE_OK is
|
|
12404
|
+
** returned. Otherwise, an SQLite error code is returned.
|
|
12405
|
+
**
|
|
12406
|
+
** The iterator must point to a valid entry when this function is called.
|
|
12407
|
+
** If it does not, SQLITE_ERROR is returned and no change is added to the
|
|
12408
|
+
** changegroup. Additionally, the iterator must not have been opened with
|
|
12409
|
+
** the SQLITE_CHANGESETAPPLY_INVERT flag. In this case SQLITE_ERROR is also
|
|
12410
|
+
** returned.
|
|
12411
|
+
*/
|
|
12412
|
+
SQLITE_API int sqlite3changegroup_add_change(
|
|
12413
|
+
sqlite3_changegroup*,
|
|
12414
|
+
sqlite3_changeset_iter*
|
|
12415
|
+
);
|
|
12416
|
+
|
|
12417
|
+
|
|
12418
|
+
|
|
11668
12419
|
/*
|
|
11669
12420
|
** CAPI3REF: Obtain A Composite Changeset From A Changegroup
|
|
11670
12421
|
** METHOD: sqlite3_changegroup
|
|
@@ -11709,14 +12460,32 @@ SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup*);
|
|
|
11709
12460
|
** update the "main" database attached to handle db with the changes found in
|
|
11710
12461
|
** the changeset passed via the second and third arguments.
|
|
11711
12462
|
**
|
|
12463
|
+
** All changes made by these functions are enclosed in a savepoint transaction.
|
|
12464
|
+
** If any other error (aside from a constraint failure when attempting to
|
|
12465
|
+
** write to the target database) occurs, then the savepoint transaction is
|
|
12466
|
+
** rolled back, restoring the target database to its original state, and an
|
|
12467
|
+
** SQLite error code returned. Additionally, starting with version 3.51.0,
|
|
12468
|
+
** an error code and error message that may be accessed using the
|
|
12469
|
+
** [sqlite3_errcode()] and [sqlite3_errmsg()] APIs are left in the database
|
|
12470
|
+
** handle.
|
|
12471
|
+
**
|
|
11712
12472
|
** The fourth argument (xFilter) passed to these functions is the "filter
|
|
11713
|
-
** callback".
|
|
11714
|
-
**
|
|
11715
|
-
**
|
|
11716
|
-
**
|
|
11717
|
-
**
|
|
11718
|
-
**
|
|
11719
|
-
**
|
|
12473
|
+
** callback". This may be passed NULL, in which case all changes in the
|
|
12474
|
+
** changeset are applied to the database. For sqlite3changeset_apply() and
|
|
12475
|
+
** sqlite3_changeset_apply_v2(), if it is not NULL, then it is invoked once
|
|
12476
|
+
** for each table affected by at least one change in the changeset. In this
|
|
12477
|
+
** case the table name is passed as the second argument, and a copy of
|
|
12478
|
+
** the context pointer passed as the sixth argument to apply() or apply_v2()
|
|
12479
|
+
** as the first. If the "filter callback" returns zero, then no attempt is
|
|
12480
|
+
** made to apply any changes to the table. Otherwise, if the return value is
|
|
12481
|
+
** non-zero, all changes related to the table are attempted.
|
|
12482
|
+
**
|
|
12483
|
+
** For sqlite3_changeset_apply_v3(), the xFilter callback is invoked once
|
|
12484
|
+
** per change. The second argument in this case is an sqlite3_changeset_iter
|
|
12485
|
+
** that may be queried using the usual APIs for the details of the current
|
|
12486
|
+
** change. If the "filter callback" returns zero in this case, then no attempt
|
|
12487
|
+
** is made to apply the current change. If it returns non-zero, the change
|
|
12488
|
+
** is applied.
|
|
11720
12489
|
**
|
|
11721
12490
|
** For each table that is not excluded by the filter callback, this function
|
|
11722
12491
|
** tests that the target database contains a compatible table. A table is
|
|
@@ -11737,11 +12506,11 @@ SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup*);
|
|
|
11737
12506
|
** one such warning is issued for each table in the changeset.
|
|
11738
12507
|
**
|
|
11739
12508
|
** For each change for which there is a compatible table, an attempt is made
|
|
11740
|
-
** to modify the table contents according to
|
|
11741
|
-
** change. If a change cannot be
|
|
11742
|
-
** function passed as the fifth argument
|
|
11743
|
-
** invoked. A description of exactly when
|
|
11744
|
-
** each type of change is below.
|
|
12509
|
+
** to modify the table contents according to each UPDATE, INSERT or DELETE
|
|
12510
|
+
** change that is not excluded by a filter callback. If a change cannot be
|
|
12511
|
+
** applied cleanly, the conflict handler function passed as the fifth argument
|
|
12512
|
+
** to sqlite3changeset_apply() may be invoked. A description of exactly when
|
|
12513
|
+
** the conflict handler is invoked for each type of change is below.
|
|
11745
12514
|
**
|
|
11746
12515
|
** Unlike the xFilter argument, xConflict may not be passed NULL. The results
|
|
11747
12516
|
** of passing anything other than a valid function pointer as the xConflict
|
|
@@ -11837,12 +12606,6 @@ SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup*);
|
|
|
11837
12606
|
** This can be used to further customize the application's conflict
|
|
11838
12607
|
** resolution strategy.
|
|
11839
12608
|
**
|
|
11840
|
-
** All changes made by these functions are enclosed in a savepoint transaction.
|
|
11841
|
-
** If any other error (aside from a constraint failure when attempting to
|
|
11842
|
-
** write to the target database) occurs, then the savepoint transaction is
|
|
11843
|
-
** rolled back, restoring the target database to its original state, and an
|
|
11844
|
-
** SQLite error code returned.
|
|
11845
|
-
**
|
|
11846
12609
|
** If the output parameters (ppRebase) and (pnRebase) are non-NULL and
|
|
11847
12610
|
** the input is a changeset (not a patchset), then sqlite3changeset_apply_v2()
|
|
11848
12611
|
** may set (*ppRebase) to point to a "rebase" that may be used with the
|
|
@@ -11892,6 +12655,23 @@ SQLITE_API int sqlite3changeset_apply_v2(
|
|
|
11892
12655
|
void **ppRebase, int *pnRebase, /* OUT: Rebase data */
|
|
11893
12656
|
int flags /* SESSION_CHANGESETAPPLY_* flags */
|
|
11894
12657
|
);
|
|
12658
|
+
SQLITE_API int sqlite3changeset_apply_v3(
|
|
12659
|
+
sqlite3 *db, /* Apply change to "main" db of this handle */
|
|
12660
|
+
int nChangeset, /* Size of changeset in bytes */
|
|
12661
|
+
void *pChangeset, /* Changeset blob */
|
|
12662
|
+
int(*xFilter)(
|
|
12663
|
+
void *pCtx, /* Copy of sixth arg to _apply() */
|
|
12664
|
+
sqlite3_changeset_iter *p /* Handle describing change */
|
|
12665
|
+
),
|
|
12666
|
+
int(*xConflict)(
|
|
12667
|
+
void *pCtx, /* Copy of sixth arg to _apply() */
|
|
12668
|
+
int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */
|
|
12669
|
+
sqlite3_changeset_iter *p /* Handle describing change and conflict */
|
|
12670
|
+
),
|
|
12671
|
+
void *pCtx, /* First argument passed to xConflict */
|
|
12672
|
+
void **ppRebase, int *pnRebase, /* OUT: Rebase data */
|
|
12673
|
+
int flags /* SESSION_CHANGESETAPPLY_* flags */
|
|
12674
|
+
);
|
|
11895
12675
|
|
|
11896
12676
|
/*
|
|
11897
12677
|
** CAPI3REF: Flags for sqlite3changeset_apply_v2
|
|
@@ -11913,9 +12693,30 @@ SQLITE_API int sqlite3changeset_apply_v2(
|
|
|
11913
12693
|
** Invert the changeset before applying it. This is equivalent to inverting
|
|
11914
12694
|
** a changeset using sqlite3changeset_invert() before applying it. It is
|
|
11915
12695
|
** an error to specify this flag with a patchset.
|
|
12696
|
+
**
|
|
12697
|
+
** <dt>SQLITE_CHANGESETAPPLY_IGNORENOOP <dd>
|
|
12698
|
+
** Do not invoke the conflict handler callback for any changes that
|
|
12699
|
+
** would not actually modify the database even if they were applied.
|
|
12700
|
+
** Specifically, this means that the conflict handler is not invoked
|
|
12701
|
+
** for:
|
|
12702
|
+
** <ul>
|
|
12703
|
+
** <li>a delete change if the row being deleted cannot be found,
|
|
12704
|
+
** <li>an update change if the modified fields are already set to
|
|
12705
|
+
** their new values in the conflicting row, or
|
|
12706
|
+
** <li>an insert change if all fields of the conflicting row match
|
|
12707
|
+
** the row being inserted.
|
|
12708
|
+
** </ul>
|
|
12709
|
+
**
|
|
12710
|
+
** <dt>SQLITE_CHANGESETAPPLY_FKNOACTION <dd>
|
|
12711
|
+
** If this flag it set, then all foreign key constraints in the target
|
|
12712
|
+
** database behave as if they were declared with "ON UPDATE NO ACTION ON
|
|
12713
|
+
** DELETE NO ACTION", even if they are actually CASCADE, RESTRICT, SET NULL
|
|
12714
|
+
** or SET DEFAULT.
|
|
11916
12715
|
*/
|
|
11917
12716
|
#define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001
|
|
11918
12717
|
#define SQLITE_CHANGESETAPPLY_INVERT 0x0002
|
|
12718
|
+
#define SQLITE_CHANGESETAPPLY_IGNORENOOP 0x0004
|
|
12719
|
+
#define SQLITE_CHANGESETAPPLY_FKNOACTION 0x0008
|
|
11919
12720
|
|
|
11920
12721
|
/*
|
|
11921
12722
|
** CAPI3REF: Constants Passed To The Conflict Handler
|
|
@@ -12290,6 +13091,23 @@ SQLITE_API int sqlite3changeset_apply_v2_strm(
|
|
|
12290
13091
|
void **ppRebase, int *pnRebase,
|
|
12291
13092
|
int flags
|
|
12292
13093
|
);
|
|
13094
|
+
SQLITE_API int sqlite3changeset_apply_v3_strm(
|
|
13095
|
+
sqlite3 *db, /* Apply change to "main" db of this handle */
|
|
13096
|
+
int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */
|
|
13097
|
+
void *pIn, /* First arg for xInput */
|
|
13098
|
+
int(*xFilter)(
|
|
13099
|
+
void *pCtx, /* Copy of sixth arg to _apply() */
|
|
13100
|
+
sqlite3_changeset_iter *p
|
|
13101
|
+
),
|
|
13102
|
+
int(*xConflict)(
|
|
13103
|
+
void *pCtx, /* Copy of sixth arg to _apply() */
|
|
13104
|
+
int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */
|
|
13105
|
+
sqlite3_changeset_iter *p /* Handle describing change and conflict */
|
|
13106
|
+
),
|
|
13107
|
+
void *pCtx, /* First argument passed to xConflict */
|
|
13108
|
+
void **ppRebase, int *pnRebase,
|
|
13109
|
+
int flags
|
|
13110
|
+
);
|
|
12293
13111
|
SQLITE_API int sqlite3changeset_concat_strm(
|
|
12294
13112
|
int (*xInputA)(void *pIn, void *pData, int *pnData),
|
|
12295
13113
|
void *pInA,
|
|
@@ -12448,8 +13266,8 @@ struct Fts5PhraseIter {
|
|
|
12448
13266
|
** EXTENSION API FUNCTIONS
|
|
12449
13267
|
**
|
|
12450
13268
|
** xUserData(pFts):
|
|
12451
|
-
** Return a copy of the
|
|
12452
|
-
** registered
|
|
13269
|
+
** Return a copy of the pUserData pointer passed to the xCreateFunction()
|
|
13270
|
+
** API when the extension function was registered.
|
|
12453
13271
|
**
|
|
12454
13272
|
** xColumnTotalSize(pFts, iCol, pnToken):
|
|
12455
13273
|
** If parameter iCol is less than zero, set output variable *pnToken
|
|
@@ -12481,8 +13299,11 @@ struct Fts5PhraseIter {
|
|
|
12481
13299
|
** created with the "columnsize=0" option.
|
|
12482
13300
|
**
|
|
12483
13301
|
** xColumnText:
|
|
12484
|
-
**
|
|
12485
|
-
**
|
|
13302
|
+
** If parameter iCol is less than zero, or greater than or equal to the
|
|
13303
|
+
** number of columns in the table, SQLITE_RANGE is returned.
|
|
13304
|
+
**
|
|
13305
|
+
** Otherwise, this function attempts to retrieve the text of column iCol of
|
|
13306
|
+
** the current document. If successful, (*pz) is set to point to a buffer
|
|
12486
13307
|
** containing the text in utf-8 encoding, (*pn) is set to the size in bytes
|
|
12487
13308
|
** (not characters) of the buffer and SQLITE_OK is returned. Otherwise,
|
|
12488
13309
|
** if an error occurs, an SQLite error code is returned and the final values
|
|
@@ -12492,8 +13313,10 @@ struct Fts5PhraseIter {
|
|
|
12492
13313
|
** Returns the number of phrases in the current query expression.
|
|
12493
13314
|
**
|
|
12494
13315
|
** xPhraseSize:
|
|
12495
|
-
**
|
|
12496
|
-
**
|
|
13316
|
+
** If parameter iCol is less than zero, or greater than or equal to the
|
|
13317
|
+
** number of phrases in the current query, as returned by xPhraseCount,
|
|
13318
|
+
** 0 is returned. Otherwise, this function returns the number of tokens in
|
|
13319
|
+
** phrase iPhrase of the query. Phrases are numbered starting from zero.
|
|
12497
13320
|
**
|
|
12498
13321
|
** xInstCount:
|
|
12499
13322
|
** Set *pnInst to the total number of occurrences of all phrases within
|
|
@@ -12509,12 +13332,13 @@ struct Fts5PhraseIter {
|
|
|
12509
13332
|
** Query for the details of phrase match iIdx within the current row.
|
|
12510
13333
|
** Phrase matches are numbered starting from zero, so the iIdx argument
|
|
12511
13334
|
** should be greater than or equal to zero and smaller than the value
|
|
12512
|
-
** output by xInstCount().
|
|
13335
|
+
** output by xInstCount(). If iIdx is less than zero or greater than
|
|
13336
|
+
** or equal to the value returned by xInstCount(), SQLITE_RANGE is returned.
|
|
12513
13337
|
**
|
|
12514
|
-
**
|
|
13338
|
+
** Otherwise, output parameter *piPhrase is set to the phrase number, *piCol
|
|
12515
13339
|
** to the column in which it occurs and *piOff the token offset of the
|
|
12516
|
-
** first token of the phrase.
|
|
12517
|
-
** code (i.e. SQLITE_NOMEM) if an error occurs.
|
|
13340
|
+
** first token of the phrase. SQLITE_OK is returned if successful, or an
|
|
13341
|
+
** error code (i.e. SQLITE_NOMEM) if an error occurs.
|
|
12518
13342
|
**
|
|
12519
13343
|
** This API can be quite slow if used with an FTS5 table created with the
|
|
12520
13344
|
** "detail=none" or "detail=column" option.
|
|
@@ -12540,6 +13364,10 @@ struct Fts5PhraseIter {
|
|
|
12540
13364
|
** Invoking Api.xUserData() returns a copy of the pointer passed as
|
|
12541
13365
|
** the third argument to pUserData.
|
|
12542
13366
|
**
|
|
13367
|
+
** If parameter iPhrase is less than zero, or greater than or equal to
|
|
13368
|
+
** the number of phrases in the query, as returned by xPhraseCount(),
|
|
13369
|
+
** this function returns SQLITE_RANGE.
|
|
13370
|
+
**
|
|
12543
13371
|
** If the callback function returns any value other than SQLITE_OK, the
|
|
12544
13372
|
** query is abandoned and the xQueryPhrase function returns immediately.
|
|
12545
13373
|
** If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK.
|
|
@@ -12621,6 +13449,10 @@ struct Fts5PhraseIter {
|
|
|
12621
13449
|
** (i.e. if it is a contentless table), then this API always iterates
|
|
12622
13450
|
** through an empty set (all calls to xPhraseFirst() set iCol to -1).
|
|
12623
13451
|
**
|
|
13452
|
+
** In all cases, matches are visited in (column ASC, offset ASC) order.
|
|
13453
|
+
** i.e. all those in column 0, sorted by offset, followed by those in
|
|
13454
|
+
** column 1, etc.
|
|
13455
|
+
**
|
|
12624
13456
|
** xPhraseNext()
|
|
12625
13457
|
** See xPhraseFirst above.
|
|
12626
13458
|
**
|
|
@@ -12654,9 +13486,80 @@ struct Fts5PhraseIter {
|
|
|
12654
13486
|
**
|
|
12655
13487
|
** xPhraseNextColumn()
|
|
12656
13488
|
** See xPhraseFirstColumn above.
|
|
13489
|
+
**
|
|
13490
|
+
** xQueryToken(pFts5, iPhrase, iToken, ppToken, pnToken)
|
|
13491
|
+
** This is used to access token iToken of phrase iPhrase of the current
|
|
13492
|
+
** query. Before returning, output parameter *ppToken is set to point
|
|
13493
|
+
** to a buffer containing the requested token, and *pnToken to the
|
|
13494
|
+
** size of this buffer in bytes.
|
|
13495
|
+
**
|
|
13496
|
+
** If iPhrase or iToken are less than zero, or if iPhrase is greater than
|
|
13497
|
+
** or equal to the number of phrases in the query as reported by
|
|
13498
|
+
** xPhraseCount(), or if iToken is equal to or greater than the number of
|
|
13499
|
+
** tokens in the phrase, SQLITE_RANGE is returned and *ppToken and *pnToken
|
|
13500
|
+
are both zeroed.
|
|
13501
|
+
**
|
|
13502
|
+
** The output text is not a copy of the query text that specified the
|
|
13503
|
+
** token. It is the output of the tokenizer module. For tokendata=1
|
|
13504
|
+
** tables, this includes any embedded 0x00 and trailing data.
|
|
13505
|
+
**
|
|
13506
|
+
** xInstToken(pFts5, iIdx, iToken, ppToken, pnToken)
|
|
13507
|
+
** This is used to access token iToken of phrase hit iIdx within the
|
|
13508
|
+
** current row. If iIdx is less than zero or greater than or equal to the
|
|
13509
|
+
** value returned by xInstCount(), SQLITE_RANGE is returned. Otherwise,
|
|
13510
|
+
** output variable (*ppToken) is set to point to a buffer containing the
|
|
13511
|
+
** matching document token, and (*pnToken) to the size of that buffer in
|
|
13512
|
+
** bytes.
|
|
13513
|
+
**
|
|
13514
|
+
** The output text is not a copy of the document text that was tokenized.
|
|
13515
|
+
** It is the output of the tokenizer module. For tokendata=1 tables, this
|
|
13516
|
+
** includes any embedded 0x00 and trailing data.
|
|
13517
|
+
**
|
|
13518
|
+
** This API may be slow in some cases if the token identified by parameters
|
|
13519
|
+
** iIdx and iToken matched a prefix token in the query. In most cases, the
|
|
13520
|
+
** first call to this API for each prefix token in the query is forced
|
|
13521
|
+
** to scan the portion of the full-text index that matches the prefix
|
|
13522
|
+
** token to collect the extra data required by this API. If the prefix
|
|
13523
|
+
** token matches a large number of token instances in the document set,
|
|
13524
|
+
** this may be a performance problem.
|
|
13525
|
+
**
|
|
13526
|
+
** If the user knows in advance that a query may use this API for a
|
|
13527
|
+
** prefix token, FTS5 may be configured to collect all required data as part
|
|
13528
|
+
** of the initial querying of the full-text index, avoiding the second scan
|
|
13529
|
+
** entirely. This also causes prefix queries that do not use this API to
|
|
13530
|
+
** run more slowly and use more memory. FTS5 may be configured in this way
|
|
13531
|
+
** either on a per-table basis using the [FTS5 insttoken | 'insttoken']
|
|
13532
|
+
** option, or on a per-query basis using the
|
|
13533
|
+
** [fts5_insttoken | fts5_insttoken()] user function.
|
|
13534
|
+
**
|
|
13535
|
+
** This API can be quite slow if used with an FTS5 table created with the
|
|
13536
|
+
** "detail=none" or "detail=column" option.
|
|
13537
|
+
**
|
|
13538
|
+
** xColumnLocale(pFts5, iIdx, pzLocale, pnLocale)
|
|
13539
|
+
** If parameter iCol is less than zero, or greater than or equal to the
|
|
13540
|
+
** number of columns in the table, SQLITE_RANGE is returned.
|
|
13541
|
+
**
|
|
13542
|
+
** Otherwise, this function attempts to retrieve the locale associated
|
|
13543
|
+
** with column iCol of the current row. Usually, there is no associated
|
|
13544
|
+
** locale, and output parameters (*pzLocale) and (*pnLocale) are set
|
|
13545
|
+
** to NULL and 0, respectively. However, if the fts5_locale() function
|
|
13546
|
+
** was used to associate a locale with the value when it was inserted
|
|
13547
|
+
** into the fts5 table, then (*pzLocale) is set to point to a nul-terminated
|
|
13548
|
+
** buffer containing the name of the locale in utf-8 encoding. (*pnLocale)
|
|
13549
|
+
** is set to the size in bytes of the buffer, not including the
|
|
13550
|
+
** nul-terminator.
|
|
13551
|
+
**
|
|
13552
|
+
** If successful, SQLITE_OK is returned. Or, if an error occurs, an
|
|
13553
|
+
** SQLite error code is returned. The final value of the output parameters
|
|
13554
|
+
** is undefined in this case.
|
|
13555
|
+
**
|
|
13556
|
+
** xTokenize_v2:
|
|
13557
|
+
** Tokenize text using the tokenizer belonging to the FTS5 table. This
|
|
13558
|
+
** API is the same as the xTokenize() API, except that it allows a tokenizer
|
|
13559
|
+
** locale to be specified.
|
|
12657
13560
|
*/
|
|
12658
13561
|
struct Fts5ExtensionApi {
|
|
12659
|
-
int iVersion; /* Currently always set to
|
|
13562
|
+
int iVersion; /* Currently always set to 4 */
|
|
12660
13563
|
|
|
12661
13564
|
void *(*xUserData)(Fts5Context*);
|
|
12662
13565
|
|
|
@@ -12691,6 +13594,22 @@ struct Fts5ExtensionApi {
|
|
|
12691
13594
|
|
|
12692
13595
|
int (*xPhraseFirstColumn)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*);
|
|
12693
13596
|
void (*xPhraseNextColumn)(Fts5Context*, Fts5PhraseIter*, int *piCol);
|
|
13597
|
+
|
|
13598
|
+
/* Below this point are iVersion>=3 only */
|
|
13599
|
+
int (*xQueryToken)(Fts5Context*,
|
|
13600
|
+
int iPhrase, int iToken,
|
|
13601
|
+
const char **ppToken, int *pnToken
|
|
13602
|
+
);
|
|
13603
|
+
int (*xInstToken)(Fts5Context*, int iIdx, int iToken, const char**, int*);
|
|
13604
|
+
|
|
13605
|
+
/* Below this point are iVersion>=4 only */
|
|
13606
|
+
int (*xColumnLocale)(Fts5Context*, int iCol, const char **pz, int *pn);
|
|
13607
|
+
int (*xTokenize_v2)(Fts5Context*,
|
|
13608
|
+
const char *pText, int nText, /* Text to tokenize */
|
|
13609
|
+
const char *pLocale, int nLocale, /* Locale to pass to tokenizer */
|
|
13610
|
+
void *pCtx, /* Context passed to xToken() */
|
|
13611
|
+
int (*xToken)(void*, int, const char*, int, int, int) /* Callback */
|
|
13612
|
+
);
|
|
12694
13613
|
};
|
|
12695
13614
|
|
|
12696
13615
|
/*
|
|
@@ -12711,7 +13630,7 @@ struct Fts5ExtensionApi {
|
|
|
12711
13630
|
** A tokenizer instance is required to actually tokenize text.
|
|
12712
13631
|
**
|
|
12713
13632
|
** The first argument passed to this function is a copy of the (void*)
|
|
12714
|
-
** pointer provided by the application when the
|
|
13633
|
+
** pointer provided by the application when the fts5_tokenizer_v2 object
|
|
12715
13634
|
** was registered with FTS5 (the third argument to xCreateTokenizer()).
|
|
12716
13635
|
** The second and third arguments are an array of nul-terminated strings
|
|
12717
13636
|
** containing the tokenizer arguments, if any, specified following the
|
|
@@ -12735,7 +13654,7 @@ struct Fts5ExtensionApi {
|
|
|
12735
13654
|
** argument passed to this function is a pointer to an Fts5Tokenizer object
|
|
12736
13655
|
** returned by an earlier call to xCreate().
|
|
12737
13656
|
**
|
|
12738
|
-
** The
|
|
13657
|
+
** The third argument indicates the reason that FTS5 is requesting
|
|
12739
13658
|
** tokenization of the supplied text. This is always one of the following
|
|
12740
13659
|
** four values:
|
|
12741
13660
|
**
|
|
@@ -12759,6 +13678,13 @@ struct Fts5ExtensionApi {
|
|
|
12759
13678
|
** on a columnsize=0 database.
|
|
12760
13679
|
** </ul>
|
|
12761
13680
|
**
|
|
13681
|
+
** The sixth and seventh arguments passed to xTokenize() - pLocale and
|
|
13682
|
+
** nLocale - are a pointer to a buffer containing the locale to use for
|
|
13683
|
+
** tokenization (e.g. "en_US") and its size in bytes, respectively. The
|
|
13684
|
+
** pLocale buffer is not nul-terminated. pLocale may be passed NULL (in
|
|
13685
|
+
** which case nLocale is always 0) to indicate that the tokenizer should
|
|
13686
|
+
** use its default locale.
|
|
13687
|
+
**
|
|
12762
13688
|
** For each token in the input string, the supplied callback xToken() must
|
|
12763
13689
|
** be invoked. The first argument to it should be a copy of the pointer
|
|
12764
13690
|
** passed as the second argument to xTokenize(). The third and fourth
|
|
@@ -12782,6 +13708,30 @@ struct Fts5ExtensionApi {
|
|
|
12782
13708
|
** may abandon the tokenization and return any error code other than
|
|
12783
13709
|
** SQLITE_OK or SQLITE_DONE.
|
|
12784
13710
|
**
|
|
13711
|
+
** If the tokenizer is registered using an fts5_tokenizer_v2 object,
|
|
13712
|
+
** then the xTokenize() method has two additional arguments - pLocale
|
|
13713
|
+
** and nLocale. These specify the locale that the tokenizer should use
|
|
13714
|
+
** for the current request. If pLocale and nLocale are both 0, then the
|
|
13715
|
+
** tokenizer should use its default locale. Otherwise, pLocale points to
|
|
13716
|
+
** an nLocale byte buffer containing the name of the locale to use as utf-8
|
|
13717
|
+
** text. pLocale is not nul-terminated.
|
|
13718
|
+
**
|
|
13719
|
+
** FTS5_TOKENIZER
|
|
13720
|
+
**
|
|
13721
|
+
** There is also an fts5_tokenizer object. This is an older, deprecated,
|
|
13722
|
+
** version of fts5_tokenizer_v2. It is similar except that:
|
|
13723
|
+
**
|
|
13724
|
+
** <ul>
|
|
13725
|
+
** <li> There is no "iVersion" field, and
|
|
13726
|
+
** <li> The xTokenize() method does not take a locale argument.
|
|
13727
|
+
** </ul>
|
|
13728
|
+
**
|
|
13729
|
+
** Legacy fts5_tokenizer tokenizers must be registered using the
|
|
13730
|
+
** legacy xCreateTokenizer() function, instead of xCreateTokenizer_v2().
|
|
13731
|
+
**
|
|
13732
|
+
** Tokenizer implementations registered using either API may be retrieved
|
|
13733
|
+
** using both xFindTokenizer() and xFindTokenizer_v2().
|
|
13734
|
+
**
|
|
12785
13735
|
** SYNONYM SUPPORT
|
|
12786
13736
|
**
|
|
12787
13737
|
** Custom tokenizers may also support synonyms. Consider a case in which a
|
|
@@ -12885,11 +13835,38 @@ struct Fts5ExtensionApi {
|
|
|
12885
13835
|
** as separate queries of the FTS index are required for each synonym.
|
|
12886
13836
|
**
|
|
12887
13837
|
** When using methods (2) or (3), it is important that the tokenizer only
|
|
12888
|
-
** provide synonyms when tokenizing document text (method (
|
|
12889
|
-
** text (method (
|
|
13838
|
+
** provide synonyms when tokenizing document text (method (3)) or query
|
|
13839
|
+
** text (method (2)), not both. Doing so will not cause any errors, but is
|
|
12890
13840
|
** inefficient.
|
|
12891
13841
|
*/
|
|
12892
13842
|
typedef struct Fts5Tokenizer Fts5Tokenizer;
|
|
13843
|
+
typedef struct fts5_tokenizer_v2 fts5_tokenizer_v2;
|
|
13844
|
+
struct fts5_tokenizer_v2 {
|
|
13845
|
+
int iVersion; /* Currently always 2 */
|
|
13846
|
+
|
|
13847
|
+
int (*xCreate)(void*, const char **azArg, int nArg, Fts5Tokenizer **ppOut);
|
|
13848
|
+
void (*xDelete)(Fts5Tokenizer*);
|
|
13849
|
+
int (*xTokenize)(Fts5Tokenizer*,
|
|
13850
|
+
void *pCtx,
|
|
13851
|
+
int flags, /* Mask of FTS5_TOKENIZE_* flags */
|
|
13852
|
+
const char *pText, int nText,
|
|
13853
|
+
const char *pLocale, int nLocale,
|
|
13854
|
+
int (*xToken)(
|
|
13855
|
+
void *pCtx, /* Copy of 2nd argument to xTokenize() */
|
|
13856
|
+
int tflags, /* Mask of FTS5_TOKEN_* flags */
|
|
13857
|
+
const char *pToken, /* Pointer to buffer containing token */
|
|
13858
|
+
int nToken, /* Size of token in bytes */
|
|
13859
|
+
int iStart, /* Byte offset of token within input text */
|
|
13860
|
+
int iEnd /* Byte offset of end of token within input text */
|
|
13861
|
+
)
|
|
13862
|
+
);
|
|
13863
|
+
};
|
|
13864
|
+
|
|
13865
|
+
/*
|
|
13866
|
+
** New code should use the fts5_tokenizer_v2 type to define tokenizer
|
|
13867
|
+
** implementations. The following type is included for legacy applications
|
|
13868
|
+
** that still use it.
|
|
13869
|
+
*/
|
|
12893
13870
|
typedef struct fts5_tokenizer fts5_tokenizer;
|
|
12894
13871
|
struct fts5_tokenizer {
|
|
12895
13872
|
int (*xCreate)(void*, const char **azArg, int nArg, Fts5Tokenizer **ppOut);
|
|
@@ -12909,6 +13886,7 @@ struct fts5_tokenizer {
|
|
|
12909
13886
|
);
|
|
12910
13887
|
};
|
|
12911
13888
|
|
|
13889
|
+
|
|
12912
13890
|
/* Flags that may be passed as the third argument to xTokenize() */
|
|
12913
13891
|
#define FTS5_TOKENIZE_QUERY 0x0001
|
|
12914
13892
|
#define FTS5_TOKENIZE_PREFIX 0x0002
|
|
@@ -12928,13 +13906,13 @@ struct fts5_tokenizer {
|
|
|
12928
13906
|
*/
|
|
12929
13907
|
typedef struct fts5_api fts5_api;
|
|
12930
13908
|
struct fts5_api {
|
|
12931
|
-
int iVersion; /* Currently always set to
|
|
13909
|
+
int iVersion; /* Currently always set to 3 */
|
|
12932
13910
|
|
|
12933
13911
|
/* Create a new tokenizer */
|
|
12934
13912
|
int (*xCreateTokenizer)(
|
|
12935
13913
|
fts5_api *pApi,
|
|
12936
13914
|
const char *zName,
|
|
12937
|
-
void *
|
|
13915
|
+
void *pUserData,
|
|
12938
13916
|
fts5_tokenizer *pTokenizer,
|
|
12939
13917
|
void (*xDestroy)(void*)
|
|
12940
13918
|
);
|
|
@@ -12943,7 +13921,7 @@ struct fts5_api {
|
|
|
12943
13921
|
int (*xFindTokenizer)(
|
|
12944
13922
|
fts5_api *pApi,
|
|
12945
13923
|
const char *zName,
|
|
12946
|
-
void **
|
|
13924
|
+
void **ppUserData,
|
|
12947
13925
|
fts5_tokenizer *pTokenizer
|
|
12948
13926
|
);
|
|
12949
13927
|
|
|
@@ -12951,10 +13929,29 @@ struct fts5_api {
|
|
|
12951
13929
|
int (*xCreateFunction)(
|
|
12952
13930
|
fts5_api *pApi,
|
|
12953
13931
|
const char *zName,
|
|
12954
|
-
void *
|
|
13932
|
+
void *pUserData,
|
|
12955
13933
|
fts5_extension_function xFunction,
|
|
12956
13934
|
void (*xDestroy)(void*)
|
|
12957
13935
|
);
|
|
13936
|
+
|
|
13937
|
+
/* APIs below this point are only available if iVersion>=3 */
|
|
13938
|
+
|
|
13939
|
+
/* Create a new tokenizer */
|
|
13940
|
+
int (*xCreateTokenizer_v2)(
|
|
13941
|
+
fts5_api *pApi,
|
|
13942
|
+
const char *zName,
|
|
13943
|
+
void *pUserData,
|
|
13944
|
+
fts5_tokenizer_v2 *pTokenizer,
|
|
13945
|
+
void (*xDestroy)(void*)
|
|
13946
|
+
);
|
|
13947
|
+
|
|
13948
|
+
/* Find an existing tokenizer */
|
|
13949
|
+
int (*xFindTokenizer_v2)(
|
|
13950
|
+
fts5_api *pApi,
|
|
13951
|
+
const char *zName,
|
|
13952
|
+
void **ppUserData,
|
|
13953
|
+
fts5_tokenizer_v2 **ppTokenizer
|
|
13954
|
+
);
|
|
12958
13955
|
};
|
|
12959
13956
|
|
|
12960
13957
|
/*
|
|
@@ -12968,3 +13965,4 @@ struct fts5_api {
|
|
|
12968
13965
|
#endif /* _FTS5_H */
|
|
12969
13966
|
|
|
12970
13967
|
/******** End of fts5.h *********/
|
|
13968
|
+
#endif /* SQLITE3_H */
|