amalgalite 1.9.4 → 2.1.0
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 +23 -2
- 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 +29711 -14260
- data/ext/amalgalite/c/sqlite3.h +1478 -386
- data/ext/amalgalite/c/sqlite3ext.h +34 -8
- 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 +32 -119
- 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/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.54.1"
|
|
150
|
+
#define SQLITE_VERSION_NUMBER 3054001
|
|
151
|
+
#define SQLITE_SOURCE_ID "2026-10-16 14:45:20 555e07ef33f69a0957d24d8e555b702464a131d6f1607f4c3c1e4551e8e6ca76"
|
|
152
|
+
#define SQLITE_SCM_BRANCH "branch-3.54"
|
|
153
|
+
#define SQLITE_SCM_TAGS "release version-3.54.1"
|
|
154
|
+
#define SQLITE_SCM_DATETIME "2026-10-16T14:45:20.546Z"
|
|
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(
|
|
@@ -458,7 +463,7 @@ SQLITE_API int sqlite3_exec(
|
|
|
458
463
|
#define SQLITE_FULL 13 /* Insertion failed because database is full */
|
|
459
464
|
#define SQLITE_CANTOPEN 14 /* Unable to open the database file */
|
|
460
465
|
#define SQLITE_PROTOCOL 15 /* Database lock protocol error */
|
|
461
|
-
#define SQLITE_EMPTY 16 /*
|
|
466
|
+
#define SQLITE_EMPTY 16 /* No content */
|
|
462
467
|
#define SQLITE_SCHEMA 17 /* The database schema changed */
|
|
463
468
|
#define SQLITE_TOOBIG 18 /* String or BLOB exceeds size limit */
|
|
464
469
|
#define SQLITE_CONSTRAINT 19 /* Abort due to constraint violation */
|
|
@@ -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))
|
|
@@ -529,6 +537,8 @@ SQLITE_API int sqlite3_exec(
|
|
|
529
537
|
#define SQLITE_IOERR_DATA (SQLITE_IOERR | (32<<8))
|
|
530
538
|
#define SQLITE_IOERR_CORRUPTFS (SQLITE_IOERR | (33<<8))
|
|
531
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))
|
|
532
542
|
#define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8))
|
|
533
543
|
#define SQLITE_LOCKED_VTAB (SQLITE_LOCKED | (2<<8))
|
|
534
544
|
#define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8))
|
|
@@ -568,7 +578,7 @@ SQLITE_API int sqlite3_exec(
|
|
|
568
578
|
#define SQLITE_WARNING_AUTOINDEX (SQLITE_WARNING | (1<<8))
|
|
569
579
|
#define SQLITE_AUTH_USER (SQLITE_AUTH | (1<<8))
|
|
570
580
|
#define SQLITE_OK_LOAD_PERMANENTLY (SQLITE_OK | (1<<8))
|
|
571
|
-
#define SQLITE_OK_SYMLINK (SQLITE_OK | (2<<8)) /* internal
|
|
581
|
+
#define SQLITE_OK_SYMLINK (SQLITE_OK | (2<<8)) /* internal only */
|
|
572
582
|
|
|
573
583
|
/*
|
|
574
584
|
** CAPI3REF: Flags For File Open Operations
|
|
@@ -587,7 +597,7 @@ SQLITE_API int sqlite3_exec(
|
|
|
587
597
|
** Note in particular that passing the SQLITE_OPEN_EXCLUSIVE flag into
|
|
588
598
|
** [sqlite3_open_v2()] does *not* cause the underlying database file
|
|
589
599
|
** to be opened using O_EXCL. Passing SQLITE_OPEN_EXCLUSIVE into
|
|
590
|
-
** [sqlite3_open_v2()] has historically
|
|
600
|
+
** [sqlite3_open_v2()] has historically been a no-op and might become an
|
|
591
601
|
** error in future versions of SQLite.
|
|
592
602
|
*/
|
|
593
603
|
#define SQLITE_OPEN_READONLY 0x00000001 /* Ok for sqlite3_open_v2() */
|
|
@@ -650,6 +660,13 @@ SQLITE_API int sqlite3_exec(
|
|
|
650
660
|
** filesystem supports doing multiple write operations atomically when those
|
|
651
661
|
** write operations are bracketed by [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] and
|
|
652
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.
|
|
653
670
|
*/
|
|
654
671
|
#define SQLITE_IOCAP_ATOMIC 0x00000001
|
|
655
672
|
#define SQLITE_IOCAP_ATOMIC512 0x00000002
|
|
@@ -666,6 +683,7 @@ SQLITE_API int sqlite3_exec(
|
|
|
666
683
|
#define SQLITE_IOCAP_POWERSAFE_OVERWRITE 0x00001000
|
|
667
684
|
#define SQLITE_IOCAP_IMMUTABLE 0x00002000
|
|
668
685
|
#define SQLITE_IOCAP_BATCH_ATOMIC 0x00004000
|
|
686
|
+
#define SQLITE_IOCAP_SUBPAGE_READ 0x00008000
|
|
669
687
|
|
|
670
688
|
/*
|
|
671
689
|
** CAPI3REF: File Locking Levels
|
|
@@ -673,7 +691,7 @@ SQLITE_API int sqlite3_exec(
|
|
|
673
691
|
** SQLite uses one of these integer values as the second
|
|
674
692
|
** argument to calls it makes to the xLock() and xUnlock() methods
|
|
675
693
|
** of an [sqlite3_io_methods] object. These values are ordered from
|
|
676
|
-
**
|
|
694
|
+
** least restrictive to most restrictive.
|
|
677
695
|
**
|
|
678
696
|
** The argument to xLock() is always SHARED or higher. The argument to
|
|
679
697
|
** xUnlock is either SHARED or NONE.
|
|
@@ -762,16 +780,16 @@ struct sqlite3_file {
|
|
|
762
780
|
** </ul>
|
|
763
781
|
** xLock() upgrades the database file lock. In other words, xLock() moves the
|
|
764
782
|
** database file lock in the direction NONE toward EXCLUSIVE. The argument to
|
|
765
|
-
** xLock() is always
|
|
783
|
+
** xLock() is always one of SHARED, RESERVED, PENDING, or EXCLUSIVE, never
|
|
766
784
|
** SQLITE_LOCK_NONE. If the database file lock is already at or above the
|
|
767
785
|
** requested lock, then the call to xLock() is a no-op.
|
|
768
786
|
** xUnlock() downgrades the database file lock to either SHARED or NONE.
|
|
769
|
-
|
|
787
|
+
** If the lock is already at or below the requested lock state, then the call
|
|
770
788
|
** to xUnlock() is a no-op.
|
|
771
789
|
** The xCheckReservedLock() method checks whether any database connection,
|
|
772
790
|
** either in this process or in some other process, is holding a RESERVED,
|
|
773
|
-
** PENDING, or EXCLUSIVE lock on the file. It returns
|
|
774
|
-
** 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.
|
|
775
793
|
**
|
|
776
794
|
** The xFileControl() method is a generic interface that allows custom
|
|
777
795
|
** VFS implementations to directly control an open file using the
|
|
@@ -812,6 +830,7 @@ struct sqlite3_file {
|
|
|
812
830
|
** <li> [SQLITE_IOCAP_POWERSAFE_OVERWRITE]
|
|
813
831
|
** <li> [SQLITE_IOCAP_IMMUTABLE]
|
|
814
832
|
** <li> [SQLITE_IOCAP_BATCH_ATOMIC]
|
|
833
|
+
** <li> [SQLITE_IOCAP_SUBPAGE_READ]
|
|
815
834
|
** </ul>
|
|
816
835
|
**
|
|
817
836
|
** The SQLITE_IOCAP_ATOMIC property means that all writes of
|
|
@@ -913,7 +932,7 @@ struct sqlite3_io_methods {
|
|
|
913
932
|
** connection. See also [SQLITE_FCNTL_FILE_POINTER].
|
|
914
933
|
**
|
|
915
934
|
** <li>[[SQLITE_FCNTL_SYNC_OMITTED]]
|
|
916
|
-
**
|
|
935
|
+
** The SQLITE_FCNTL_SYNC_OMITTED file-control is no longer used.
|
|
917
936
|
**
|
|
918
937
|
** <li>[[SQLITE_FCNTL_SYNC]]
|
|
919
938
|
** The [SQLITE_FCNTL_SYNC] opcode is generated internally by SQLite and
|
|
@@ -988,7 +1007,7 @@ struct sqlite3_io_methods {
|
|
|
988
1007
|
**
|
|
989
1008
|
** <li>[[SQLITE_FCNTL_VFSNAME]]
|
|
990
1009
|
** ^The [SQLITE_FCNTL_VFSNAME] opcode can be used to obtain the names of
|
|
991
|
-
** all [VFSes] in the VFS stack. The names
|
|
1010
|
+
** all [VFSes] in the VFS stack. The names of all VFS shims and the
|
|
992
1011
|
** final bottom-level VFS are written into memory obtained from
|
|
993
1012
|
** [sqlite3_malloc()] and the result is stored in the char* variable
|
|
994
1013
|
** that the fourth parameter of [sqlite3_file_control()] points to.
|
|
@@ -1002,7 +1021,7 @@ struct sqlite3_io_methods {
|
|
|
1002
1021
|
** ^The [SQLITE_FCNTL_VFS_POINTER] opcode finds a pointer to the top-level
|
|
1003
1022
|
** [VFSes] currently in use. ^(The argument X in
|
|
1004
1023
|
** sqlite3_file_control(db,SQLITE_FCNTL_VFS_POINTER,X) must be
|
|
1005
|
-
** of type "[sqlite3_vfs] **". This
|
|
1024
|
+
** of type "[sqlite3_vfs] **". This opcode will set *X
|
|
1006
1025
|
** to a pointer to the top-level VFS.)^
|
|
1007
1026
|
** ^When there are multiple VFS shims in the stack, this opcode finds the
|
|
1008
1027
|
** upper-most shim only.
|
|
@@ -1089,6 +1108,11 @@ struct sqlite3_io_methods {
|
|
|
1089
1108
|
** pointed to by the pArg argument. This capability is used during testing
|
|
1090
1109
|
** and only needs to be supported when SQLITE_TEST is defined.
|
|
1091
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
|
+
**
|
|
1092
1116
|
** <li>[[SQLITE_FCNTL_WAL_BLOCK]]
|
|
1093
1117
|
** The [SQLITE_FCNTL_WAL_BLOCK] is a signal to the VFS layer that it might
|
|
1094
1118
|
** be advantageous to block on the next WAL lock if the lock is not immediately
|
|
@@ -1147,6 +1171,12 @@ struct sqlite3_io_methods {
|
|
|
1147
1171
|
** the value that M is to be set to. Before returning, the 32-bit signed
|
|
1148
1172
|
** integer is overwritten with the previous value of M.
|
|
1149
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
|
+
**
|
|
1150
1180
|
** <li>[[SQLITE_FCNTL_DATA_VERSION]]
|
|
1151
1181
|
** The [SQLITE_FCNTL_DATA_VERSION] opcode is used to detect changes to
|
|
1152
1182
|
** a database file. The argument is a pointer to a 32-bit unsigned integer.
|
|
@@ -1181,7 +1211,7 @@ struct sqlite3_io_methods {
|
|
|
1181
1211
|
** <li>[[SQLITE_FCNTL_EXTERNAL_READER]]
|
|
1182
1212
|
** The EXPERIMENTAL [SQLITE_FCNTL_EXTERNAL_READER] opcode is used to detect
|
|
1183
1213
|
** whether or not there is a database client in another process with a wal-mode
|
|
1184
|
-
** 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
|
|
1185
1215
|
** (void*) argument passed with this file-control should be a pointer to a
|
|
1186
1216
|
** value of type (int). The integer value is set to 1 if the database is a wal
|
|
1187
1217
|
** mode database and there exists at least one client in another process that
|
|
@@ -1199,6 +1229,15 @@ struct sqlite3_io_methods {
|
|
|
1199
1229
|
** database is not a temp db, then the [SQLITE_FCNTL_RESET_CACHE] file-control
|
|
1200
1230
|
** purges the contents of the in-memory page cache. If there is an open
|
|
1201
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.
|
|
1202
1241
|
** </ul>
|
|
1203
1242
|
*/
|
|
1204
1243
|
#define SQLITE_FCNTL_LOCKSTATE 1
|
|
@@ -1242,12 +1281,21 @@ struct sqlite3_io_methods {
|
|
|
1242
1281
|
#define SQLITE_FCNTL_EXTERNAL_READER 40
|
|
1243
1282
|
#define SQLITE_FCNTL_CKSM_FILE 41
|
|
1244
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
|
|
1245
1287
|
|
|
1246
1288
|
/* deprecated names */
|
|
1247
1289
|
#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
|
|
1248
1290
|
#define SQLITE_SET_LOCKPROXYFILE SQLITE_FCNTL_SET_LOCKPROXYFILE
|
|
1249
1291
|
#define SQLITE_LAST_ERRNO SQLITE_FCNTL_LAST_ERRNO
|
|
1250
1292
|
|
|
1293
|
+
/* reserved file-control numbers:
|
|
1294
|
+
** 101
|
|
1295
|
+
** 102
|
|
1296
|
+
** 103
|
|
1297
|
+
*/
|
|
1298
|
+
|
|
1251
1299
|
|
|
1252
1300
|
/*
|
|
1253
1301
|
** CAPI3REF: Mutex Handle
|
|
@@ -1448,7 +1496,7 @@ typedef const char *sqlite3_filename;
|
|
|
1448
1496
|
** greater and the function pointer is not NULL) and will fall back
|
|
1449
1497
|
** to xCurrentTime() if xCurrentTimeInt64() is unavailable.
|
|
1450
1498
|
**
|
|
1451
|
-
** ^The xSetSystemCall(), xGetSystemCall(), and
|
|
1499
|
+
** ^The xSetSystemCall(), xGetSystemCall(), and xNextSystemCall() interfaces
|
|
1452
1500
|
** are not used by the SQLite core. These optional interfaces are provided
|
|
1453
1501
|
** by some VFSes to facilitate testing of the VFS code. By overriding
|
|
1454
1502
|
** system calls with functions under its control, a test program can
|
|
@@ -1604,7 +1652,7 @@ struct sqlite3_vfs {
|
|
|
1604
1652
|
** SQLite interfaces so that an application usually does not need to
|
|
1605
1653
|
** invoke sqlite3_initialize() directly. For example, [sqlite3_open()]
|
|
1606
1654
|
** calls sqlite3_initialize() so the SQLite library will be automatically
|
|
1607
|
-
** initialized when [sqlite3_open()] is called if it has not
|
|
1655
|
+
** initialized when [sqlite3_open()] is called if it has not been initialized
|
|
1608
1656
|
** already. ^However, if SQLite is compiled with the [SQLITE_OMIT_AUTOINIT]
|
|
1609
1657
|
** compile-time option, then the automatic calls to sqlite3_initialize()
|
|
1610
1658
|
** are omitted and the application must call sqlite3_initialize() directly
|
|
@@ -1669,7 +1717,8 @@ SQLITE_API int sqlite3_os_end(void);
|
|
|
1669
1717
|
** are called "anytime configuration options".
|
|
1670
1718
|
** ^If sqlite3_config() is called after [sqlite3_initialize()] and before
|
|
1671
1719
|
** [sqlite3_shutdown()] with a first argument that is not an anytime
|
|
1672
|
-
** configuration option, then the sqlite3_config() call will
|
|
1720
|
+
** configuration option, then the sqlite3_config() call will
|
|
1721
|
+
** return SQLITE_MISUSE.
|
|
1673
1722
|
** Note, however, that ^sqlite3_config() can be called as part of the
|
|
1674
1723
|
** implementation of an application-defined [sqlite3_os_init()].
|
|
1675
1724
|
**
|
|
@@ -1861,21 +1910,21 @@ struct sqlite3_mem_methods {
|
|
|
1861
1910
|
** The [sqlite3_mem_methods]
|
|
1862
1911
|
** structure is filled with the currently defined memory allocation routines.)^
|
|
1863
1912
|
** This option can be used to overload the default memory allocation
|
|
1864
|
-
** routines with a wrapper that
|
|
1913
|
+
** routines with a wrapper that simulates memory allocation failure or
|
|
1865
1914
|
** tracks memory usage, for example. </dd>
|
|
1866
1915
|
**
|
|
1867
1916
|
** [[SQLITE_CONFIG_SMALL_MALLOC]] <dt>SQLITE_CONFIG_SMALL_MALLOC</dt>
|
|
1868
|
-
** <dd> ^The SQLITE_CONFIG_SMALL_MALLOC option takes single argument of
|
|
1917
|
+
** <dd> ^The SQLITE_CONFIG_SMALL_MALLOC option takes a single argument of
|
|
1869
1918
|
** type int, interpreted as a boolean, which if true provides a hint to
|
|
1870
1919
|
** SQLite that it should avoid large memory allocations if possible.
|
|
1871
1920
|
** SQLite will run faster if it is free to make large memory allocations,
|
|
1872
|
-
** but some
|
|
1921
|
+
** but some applications might prefer to run slower in exchange for
|
|
1873
1922
|
** guarantees about memory fragmentation that are possible if large
|
|
1874
1923
|
** allocations are avoided. This hint is normally off.
|
|
1875
1924
|
** </dd>
|
|
1876
1925
|
**
|
|
1877
1926
|
** [[SQLITE_CONFIG_MEMSTATUS]] <dt>SQLITE_CONFIG_MEMSTATUS</dt>
|
|
1878
|
-
** <dd> ^The SQLITE_CONFIG_MEMSTATUS option takes single argument of type int,
|
|
1927
|
+
** <dd> ^The SQLITE_CONFIG_MEMSTATUS option takes a single argument of type int,
|
|
1879
1928
|
** interpreted as a boolean, which enables or disables the collection of
|
|
1880
1929
|
** memory allocation statistics. ^(When memory allocation statistics are
|
|
1881
1930
|
** disabled, the following SQLite interfaces become non-operational:
|
|
@@ -1920,7 +1969,7 @@ struct sqlite3_mem_methods {
|
|
|
1920
1969
|
** ^If pMem is NULL and N is non-zero, then each database connection
|
|
1921
1970
|
** does an initial bulk allocation for page cache memory
|
|
1922
1971
|
** from [sqlite3_malloc()] sufficient for N cache lines if N is positive or
|
|
1923
|
-
** of -1024*N bytes if N is negative
|
|
1972
|
+
** of -1024*N bytes if N is negative. ^If additional
|
|
1924
1973
|
** page cache memory is needed beyond what is provided by the initial
|
|
1925
1974
|
** allocation, then SQLite goes to [sqlite3_malloc()] separately for each
|
|
1926
1975
|
** additional cache line. </dd>
|
|
@@ -1949,7 +1998,7 @@ struct sqlite3_mem_methods {
|
|
|
1949
1998
|
** <dd> ^(The SQLITE_CONFIG_MUTEX option takes a single argument which is a
|
|
1950
1999
|
** pointer to an instance of the [sqlite3_mutex_methods] structure.
|
|
1951
2000
|
** The argument specifies alternative low-level mutex routines to be used
|
|
1952
|
-
** in place the mutex routines built into SQLite.)^ ^SQLite makes a copy of
|
|
2001
|
+
** in place of the mutex routines built into SQLite.)^ ^SQLite makes a copy of
|
|
1953
2002
|
** the content of the [sqlite3_mutex_methods] structure before the call to
|
|
1954
2003
|
** [sqlite3_config()] returns. ^If SQLite is compiled with
|
|
1955
2004
|
** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
|
|
@@ -1972,13 +2021,16 @@ struct sqlite3_mem_methods {
|
|
|
1972
2021
|
**
|
|
1973
2022
|
** [[SQLITE_CONFIG_LOOKASIDE]] <dt>SQLITE_CONFIG_LOOKASIDE</dt>
|
|
1974
2023
|
** <dd> ^(The SQLITE_CONFIG_LOOKASIDE option takes two arguments that determine
|
|
1975
|
-
** the default size of lookaside memory on each [database connection].
|
|
2024
|
+
** the default size of [lookaside memory] on each [database connection].
|
|
1976
2025
|
** The first argument is the
|
|
1977
|
-
** size of each lookaside buffer slot and the second is the number of
|
|
1978
|
-
** slots allocated to each database connection.)^
|
|
1979
|
-
** sets the <i>default</i> lookaside size.
|
|
1980
|
-
** option to [sqlite3_db_config()] can
|
|
1981
|
-
** configuration on individual connections.)^
|
|
2026
|
+
** size of each lookaside buffer slot ("sz") and the second is the number of
|
|
2027
|
+
** slots allocated to each database connection ("cnt").)^
|
|
2028
|
+
** ^(SQLITE_CONFIG_LOOKASIDE sets the <i>default</i> lookaside size.
|
|
2029
|
+
** The [SQLITE_DBCONFIG_LOOKASIDE] option to [sqlite3_db_config()] can
|
|
2030
|
+
** be used to change the lookaside configuration on individual connections.)^
|
|
2031
|
+
** The [-DSQLITE_DEFAULT_LOOKASIDE] option can be used to change the
|
|
2032
|
+
** default lookaside configuration at compile-time.
|
|
2033
|
+
** </dd>
|
|
1982
2034
|
**
|
|
1983
2035
|
** [[SQLITE_CONFIG_PCACHE2]] <dt>SQLITE_CONFIG_PCACHE2</dt>
|
|
1984
2036
|
** <dd> ^(The SQLITE_CONFIG_PCACHE2 option takes a single argument which is
|
|
@@ -1988,7 +2040,7 @@ struct sqlite3_mem_methods {
|
|
|
1988
2040
|
**
|
|
1989
2041
|
** [[SQLITE_CONFIG_GETPCACHE2]] <dt>SQLITE_CONFIG_GETPCACHE2</dt>
|
|
1990
2042
|
** <dd> ^(The SQLITE_CONFIG_GETPCACHE2 option takes a single argument which
|
|
1991
|
-
** is a pointer to an [sqlite3_pcache_methods2] object. SQLite copies
|
|
2043
|
+
** is a pointer to an [sqlite3_pcache_methods2] object. SQLite copies off
|
|
1992
2044
|
** the current page cache implementation into that object.)^ </dd>
|
|
1993
2045
|
**
|
|
1994
2046
|
** [[SQLITE_CONFIG_LOG]] <dt>SQLITE_CONFIG_LOG</dt>
|
|
@@ -2005,7 +2057,7 @@ struct sqlite3_mem_methods {
|
|
|
2005
2057
|
** the logger function is a copy of the first parameter to the corresponding
|
|
2006
2058
|
** [sqlite3_log()] call and is intended to be a [result code] or an
|
|
2007
2059
|
** [extended result code]. ^The third parameter passed to the logger is
|
|
2008
|
-
** log message after formatting via [sqlite3_snprintf()].
|
|
2060
|
+
** a log message after formatting via [sqlite3_snprintf()].
|
|
2009
2061
|
** The SQLite logging interface is not reentrant; the logger function
|
|
2010
2062
|
** supplied by the application must not invoke any SQLite interface.
|
|
2011
2063
|
** In a multi-threaded application, the application-defined logger
|
|
@@ -2141,6 +2193,22 @@ struct sqlite3_mem_methods {
|
|
|
2141
2193
|
** configuration setting is never used, then the default maximum is determined
|
|
2142
2194
|
** by the [SQLITE_MEMDB_DEFAULT_MAXSIZE] compile-time option. If that
|
|
2143
2195
|
** compile-time option is not set, then the default maximum is 1073741824.
|
|
2196
|
+
**
|
|
2197
|
+
** [[SQLITE_CONFIG_ROWID_IN_VIEW]]
|
|
2198
|
+
** <dt>SQLITE_CONFIG_ROWID_IN_VIEW
|
|
2199
|
+
** <dd>The SQLITE_CONFIG_ROWID_IN_VIEW option enables or disables the ability
|
|
2200
|
+
** for VIEWs to have a ROWID. The capability can only be enabled if SQLite is
|
|
2201
|
+
** compiled with -DSQLITE_ALLOW_ROWID_IN_VIEW, in which case the capability
|
|
2202
|
+
** defaults to on. This configuration option queries the current setting or
|
|
2203
|
+
** changes the setting to off or on. The argument is a pointer to an integer.
|
|
2204
|
+
** If that integer initially holds a value of 1, then the ability for VIEWs to
|
|
2205
|
+
** have ROWIDs is activated. If the integer initially holds zero, then the
|
|
2206
|
+
** ability is deactivated. Any other initial value for the integer leaves the
|
|
2207
|
+
** setting unchanged. After changes, if any, the integer is written with
|
|
2208
|
+
** a 1 or 0, if the ability for VIEWs to have ROWIDs is on or off. If SQLite
|
|
2209
|
+
** is compiled without -DSQLITE_ALLOW_ROWID_IN_VIEW (which is the usual and
|
|
2210
|
+
** recommended case) then the integer is always filled with zero, regardless
|
|
2211
|
+
** if its initial value.
|
|
2144
2212
|
** </dl>
|
|
2145
2213
|
*/
|
|
2146
2214
|
#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
|
|
@@ -2172,12 +2240,21 @@ struct sqlite3_mem_methods {
|
|
|
2172
2240
|
#define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */
|
|
2173
2241
|
#define SQLITE_CONFIG_SORTERREF_SIZE 28 /* int nByte */
|
|
2174
2242
|
#define SQLITE_CONFIG_MEMDB_MAXSIZE 29 /* sqlite3_int64 */
|
|
2243
|
+
#define SQLITE_CONFIG_ROWID_IN_VIEW 30 /* int* */
|
|
2175
2244
|
|
|
2176
2245
|
/*
|
|
2177
2246
|
** CAPI3REF: Database Connection Configuration Options
|
|
2178
2247
|
**
|
|
2179
2248
|
** These constants are the available integer configuration options that
|
|
2180
|
-
** can be passed as the second
|
|
2249
|
+
** can be passed as the second parameter to the [sqlite3_db_config()] interface.
|
|
2250
|
+
**
|
|
2251
|
+
** The [sqlite3_db_config()] interface is a var-args function. It takes a
|
|
2252
|
+
** variable number of parameters, though always at least two. The number of
|
|
2253
|
+
** parameters passed into sqlite3_db_config() depends on which of these
|
|
2254
|
+
** constants is given as the second parameter. This documentation page
|
|
2255
|
+
** refers to parameters beyond the second as "arguments". Thus, when this
|
|
2256
|
+
** page says "the N-th argument" it means "the N-th parameter past the
|
|
2257
|
+
** configuration option" or "the (N+2)-th parameter to sqlite3_db_config()".
|
|
2181
2258
|
**
|
|
2182
2259
|
** New configuration options may be added in future releases of SQLite.
|
|
2183
2260
|
** Existing configuration options might be discontinued. Applications
|
|
@@ -2189,31 +2266,58 @@ struct sqlite3_mem_methods {
|
|
|
2189
2266
|
** <dl>
|
|
2190
2267
|
** [[SQLITE_DBCONFIG_LOOKASIDE]]
|
|
2191
2268
|
** <dt>SQLITE_DBCONFIG_LOOKASIDE</dt>
|
|
2192
|
-
** <dd>
|
|
2193
|
-
** [lookaside memory allocator]
|
|
2194
|
-
**
|
|
2269
|
+
** <dd> The SQLITE_DBCONFIG_LOOKASIDE option is used to adjust the
|
|
2270
|
+
** configuration of the [lookaside memory allocator] within a database
|
|
2271
|
+
** connection.
|
|
2272
|
+
** The arguments to the SQLITE_DBCONFIG_LOOKASIDE option are <i>not</i>
|
|
2273
|
+
** in the [DBCONFIG arguments|usual format].
|
|
2274
|
+
** The SQLITE_DBCONFIG_LOOKASIDE option takes three arguments, not two,
|
|
2275
|
+
** so that a call to [sqlite3_db_config()] that uses SQLITE_DBCONFIG_LOOKASIDE
|
|
2276
|
+
** should have a total of five parameters.
|
|
2277
|
+
** <ol>
|
|
2278
|
+
** <li><p>The first argument ("buf") is a
|
|
2195
2279
|
** pointer to a memory buffer to use for lookaside memory.
|
|
2196
|
-
**
|
|
2197
|
-
**
|
|
2198
|
-
**
|
|
2199
|
-
** size of each lookaside buffer slot.
|
|
2200
|
-
**
|
|
2201
|
-
**
|
|
2202
|
-
**
|
|
2203
|
-
**
|
|
2204
|
-
**
|
|
2280
|
+
** The first argument may be NULL in which case SQLite will allocate the
|
|
2281
|
+
** lookaside buffer itself using [sqlite3_malloc()].
|
|
2282
|
+
** <li><P>The second argument ("sz") is the
|
|
2283
|
+
** size of each lookaside buffer slot. Lookaside is disabled if "sz"
|
|
2284
|
+
** is less than 8. The "sz" argument should be a multiple of 8 less than
|
|
2285
|
+
** 65536. If "sz" does not meet this constraint, it is reduced in size until
|
|
2286
|
+
** it does.
|
|
2287
|
+
** <li><p>The third argument ("cnt") is the number of slots.
|
|
2288
|
+
** Lookaside is disabled if "cnt"is less than 1.
|
|
2289
|
+
* The "cnt" value will be reduced, if necessary, so
|
|
2290
|
+
** that the product of "sz" and "cnt" does not exceed 2,147,418,112. The "cnt"
|
|
2291
|
+
** parameter is usually chosen so that the product of "sz" and "cnt" is less
|
|
2292
|
+
** than 1,000,000.
|
|
2293
|
+
** </ol>
|
|
2294
|
+
** <p>If the "buf" argument is not NULL, then it must
|
|
2295
|
+
** point to a memory buffer with a size that is greater than
|
|
2296
|
+
** or equal to the product of "sz" and "cnt".
|
|
2297
|
+
** The buffer must be aligned to an 8-byte boundary.
|
|
2298
|
+
** The lookaside memory
|
|
2205
2299
|
** configuration for a database connection can only be changed when that
|
|
2206
2300
|
** connection is not currently using lookaside memory, or in other words
|
|
2207
|
-
** when the
|
|
2208
|
-
** [sqlite3_db_status](D,[SQLITE_DBSTATUS_LOOKASIDE_USED],...) is zero.
|
|
2301
|
+
** when the value returned by [SQLITE_DBSTATUS_LOOKASIDE_USED] is zero.
|
|
2209
2302
|
** Any attempt to change the lookaside memory configuration when lookaside
|
|
2210
2303
|
** memory is in use leaves the configuration unchanged and returns
|
|
2211
|
-
** [SQLITE_BUSY].
|
|
2304
|
+
** [SQLITE_BUSY].
|
|
2305
|
+
** If the "buf" argument is NULL and an attempt
|
|
2306
|
+
** to allocate memory based on "sz" and "cnt" fails, then
|
|
2307
|
+
** lookaside is silently disabled.
|
|
2308
|
+
** <p>
|
|
2309
|
+
** The [SQLITE_CONFIG_LOOKASIDE] configuration option can be used to set the
|
|
2310
|
+
** default lookaside configuration at initialization. The
|
|
2311
|
+
** [-DSQLITE_DEFAULT_LOOKASIDE] option can be used to set the default lookaside
|
|
2312
|
+
** configuration at compile-time. Typical values for lookaside are 1200 for
|
|
2313
|
+
** "sz" and 40 to 100 for "cnt".
|
|
2314
|
+
** </dd>
|
|
2212
2315
|
**
|
|
2213
2316
|
** [[SQLITE_DBCONFIG_ENABLE_FKEY]]
|
|
2214
2317
|
** <dt>SQLITE_DBCONFIG_ENABLE_FKEY</dt>
|
|
2215
2318
|
** <dd> ^This option is used to enable or disable the enforcement of
|
|
2216
|
-
** [foreign key constraints].
|
|
2319
|
+
** [foreign key constraints]. This is the same setting that is
|
|
2320
|
+
** enabled or disabled by the [PRAGMA foreign_keys] statement.
|
|
2217
2321
|
** The first argument is an integer which is 0 to disable FK enforcement,
|
|
2218
2322
|
** positive to enable FK enforcement or negative to leave FK enforcement
|
|
2219
2323
|
** unchanged. The second parameter is a pointer to an integer into which
|
|
@@ -2235,13 +2339,13 @@ struct sqlite3_mem_methods {
|
|
|
2235
2339
|
** <p>Originally this option disabled all triggers. ^(However, since
|
|
2236
2340
|
** SQLite version 3.35.0, TEMP triggers are still allowed even if
|
|
2237
2341
|
** this option is off. So, in other words, this option now only disables
|
|
2238
|
-
** triggers in the main database schema or in the schemas of ATTACH-ed
|
|
2342
|
+
** triggers in the main database schema or in the schemas of [ATTACH]-ed
|
|
2239
2343
|
** databases.)^ </dd>
|
|
2240
2344
|
**
|
|
2241
2345
|
** [[SQLITE_DBCONFIG_ENABLE_VIEW]]
|
|
2242
2346
|
** <dt>SQLITE_DBCONFIG_ENABLE_VIEW</dt>
|
|
2243
2347
|
** <dd> ^This option is used to enable or disable [CREATE VIEW | views].
|
|
2244
|
-
** There
|
|
2348
|
+
** There must be two additional arguments.
|
|
2245
2349
|
** The first argument is an integer which is 0 to disable views,
|
|
2246
2350
|
** positive to enable views or negative to leave the setting unchanged.
|
|
2247
2351
|
** The second parameter is a pointer to an integer into which
|
|
@@ -2257,17 +2361,20 @@ struct sqlite3_mem_methods {
|
|
|
2257
2361
|
**
|
|
2258
2362
|
** [[SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER]]
|
|
2259
2363
|
** <dt>SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER</dt>
|
|
2260
|
-
** <dd> ^This option is used to enable or disable the
|
|
2261
|
-
** [fts3_tokenizer()] function
|
|
2262
|
-
**
|
|
2263
|
-
** There
|
|
2264
|
-
**
|
|
2265
|
-
**
|
|
2266
|
-
**
|
|
2267
|
-
**
|
|
2268
|
-
**
|
|
2269
|
-
**
|
|
2270
|
-
**
|
|
2364
|
+
** <dd> ^This option is used to enable or disable using the
|
|
2365
|
+
** [fts3_tokenizer()] function - part of the [FTS3] full-text search engine
|
|
2366
|
+
** extension - without using bound parameters as the parameters. Doing so
|
|
2367
|
+
** is disabled by default. There must be two additional arguments. The first
|
|
2368
|
+
** argument is an integer. If it is passed 0, then using fts3_tokenizer()
|
|
2369
|
+
** without bound parameters is disabled. If it is passed a positive value,
|
|
2370
|
+
** then calling fts3_tokenizer without bound parameters is enabled. If it
|
|
2371
|
+
** is passed a negative value, this setting is not modified - this can be
|
|
2372
|
+
** used to query for the current setting. The second parameter is a pointer
|
|
2373
|
+
** to an integer into which is written 0 or 1 to indicate the current value
|
|
2374
|
+
** of this setting (after it is modified, if applicable). The second
|
|
2375
|
+
** parameter may be a NULL pointer, in which case the value of the setting
|
|
2376
|
+
** is not reported back. Refer to [FTS3] documentation for further details.
|
|
2377
|
+
** </dd>
|
|
2271
2378
|
**
|
|
2272
2379
|
** [[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION]]
|
|
2273
2380
|
** <dt>SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION</dt>
|
|
@@ -2275,12 +2382,12 @@ struct sqlite3_mem_methods {
|
|
|
2275
2382
|
** interface independently of the [load_extension()] SQL function.
|
|
2276
2383
|
** The [sqlite3_enable_load_extension()] API enables or disables both the
|
|
2277
2384
|
** C-API [sqlite3_load_extension()] and the SQL function [load_extension()].
|
|
2278
|
-
** There
|
|
2385
|
+
** There must be two additional arguments.
|
|
2279
2386
|
** When the first argument to this interface is 1, then only the C-API is
|
|
2280
2387
|
** enabled and the SQL function remains disabled. If the first argument to
|
|
2281
2388
|
** this interface is 0, then both the C-API and the SQL function are disabled.
|
|
2282
|
-
** If the first argument is -1, then no changes are made to state of either
|
|
2283
|
-
** C-API or the SQL function.
|
|
2389
|
+
** If the first argument is -1, then no changes are made to the state of either
|
|
2390
|
+
** the C-API or the SQL function.
|
|
2284
2391
|
** The second parameter is a pointer to an integer into which
|
|
2285
2392
|
** is written 0 or 1 to indicate whether [sqlite3_load_extension()] interface
|
|
2286
2393
|
** is disabled or enabled following this call. The second parameter may
|
|
@@ -2289,23 +2396,30 @@ struct sqlite3_mem_methods {
|
|
|
2289
2396
|
**
|
|
2290
2397
|
** [[SQLITE_DBCONFIG_MAINDBNAME]] <dt>SQLITE_DBCONFIG_MAINDBNAME</dt>
|
|
2291
2398
|
** <dd> ^This option is used to change the name of the "main" database
|
|
2292
|
-
** schema.
|
|
2293
|
-
**
|
|
2294
|
-
**
|
|
2295
|
-
**
|
|
2296
|
-
**
|
|
2399
|
+
** schema. This option does not follow the
|
|
2400
|
+
** [DBCONFIG arguments|usual SQLITE_DBCONFIG argument format].
|
|
2401
|
+
** This option takes exactly one additional argument so that the
|
|
2402
|
+
** [sqlite3_db_config()] call has a total of three parameters. The
|
|
2403
|
+
** extra argument must be a pointer to a constant UTF8 string which
|
|
2404
|
+
** will become the new schema name in place of "main". ^SQLite does
|
|
2405
|
+
** not make a copy of the new main schema name string, so the application
|
|
2406
|
+
** must ensure that the argument passed into SQLITE_DBCONFIG MAINDBNAME
|
|
2407
|
+
** is unchanged until after the database connection closes.
|
|
2297
2408
|
** </dd>
|
|
2298
2409
|
**
|
|
2299
2410
|
** [[SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE]]
|
|
2300
2411
|
** <dt>SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE</dt>
|
|
2301
|
-
** <dd> Usually, when a database in
|
|
2302
|
-
** database handle, SQLite checks if
|
|
2303
|
-
**
|
|
2304
|
-
**
|
|
2305
|
-
**
|
|
2306
|
-
**
|
|
2307
|
-
**
|
|
2308
|
-
**
|
|
2412
|
+
** <dd> Usually, when a database in [WAL mode] is closed or detached from a
|
|
2413
|
+
** database handle, SQLite checks if if there are other connections to the
|
|
2414
|
+
** same database, and if there are no other database connection (if the
|
|
2415
|
+
** connection being closed is the last open connection to the database),
|
|
2416
|
+
** then SQLite performs a [checkpoint] before closing the connection and
|
|
2417
|
+
** deletes the WAL file. The SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE option can
|
|
2418
|
+
** be used to override that behavior. The first argument passed to this
|
|
2419
|
+
** operation (the third parameter to [sqlite3_db_config()]) is an integer
|
|
2420
|
+
** which is positive to disable checkpoints-on-close, or zero (the default)
|
|
2421
|
+
** to enable them, and negative to leave the setting unchanged.
|
|
2422
|
+
** The second argument (the fourth parameter) is a pointer to an integer
|
|
2309
2423
|
** into which is written 0 or 1 to indicate whether checkpoints-on-close
|
|
2310
2424
|
** have been disabled - 0 if they are not disabled, 1 if they are.
|
|
2311
2425
|
** </dd>
|
|
@@ -2391,7 +2505,7 @@ struct sqlite3_mem_methods {
|
|
|
2391
2505
|
** [[SQLITE_DBCONFIG_LEGACY_ALTER_TABLE]]
|
|
2392
2506
|
** <dt>SQLITE_DBCONFIG_LEGACY_ALTER_TABLE</dt>
|
|
2393
2507
|
** <dd>The SQLITE_DBCONFIG_LEGACY_ALTER_TABLE option activates or deactivates
|
|
2394
|
-
** the legacy behavior of the [ALTER TABLE RENAME] command such it
|
|
2508
|
+
** the legacy behavior of the [ALTER TABLE RENAME] command such that it
|
|
2395
2509
|
** behaves as it did prior to [version 3.24.0] (2018-06-04). See the
|
|
2396
2510
|
** "Compatibility Notice" on the [ALTER TABLE RENAME documentation] for
|
|
2397
2511
|
** additional information. This feature can also be turned on and off
|
|
@@ -2440,7 +2554,7 @@ struct sqlite3_mem_methods {
|
|
|
2440
2554
|
** <dt>SQLITE_DBCONFIG_LEGACY_FILE_FORMAT</dt>
|
|
2441
2555
|
** <dd>The SQLITE_DBCONFIG_LEGACY_FILE_FORMAT option activates or deactivates
|
|
2442
2556
|
** the legacy file format flag. When activated, this flag causes all newly
|
|
2443
|
-
** created database
|
|
2557
|
+
** created database files to have a schema format version number (the 4-byte
|
|
2444
2558
|
** integer found at offset 44 into the database header) of 1. This in turn
|
|
2445
2559
|
** means that the resulting database file will be readable and writable by
|
|
2446
2560
|
** any SQLite version back to 3.0.0 ([dateof:3.0.0]). Without this setting,
|
|
@@ -2461,13 +2575,16 @@ struct sqlite3_mem_methods {
|
|
|
2461
2575
|
** [[SQLITE_DBCONFIG_STMT_SCANSTATUS]]
|
|
2462
2576
|
** <dt>SQLITE_DBCONFIG_STMT_SCANSTATUS</dt>
|
|
2463
2577
|
** <dd>The SQLITE_DBCONFIG_STMT_SCANSTATUS option is only useful in
|
|
2464
|
-
** SQLITE_ENABLE_STMT_SCANSTATUS builds. In this case, it sets or clears
|
|
2465
|
-
** a flag that enables collection of
|
|
2466
|
-
**
|
|
2467
|
-
**
|
|
2468
|
-
**
|
|
2469
|
-
**
|
|
2470
|
-
**
|
|
2578
|
+
** [SQLITE_ENABLE_STMT_SCANSTATUS] builds. In this case, it sets or clears
|
|
2579
|
+
** a flag that enables collection of run-time performance statistics
|
|
2580
|
+
** used by [sqlite3_stmt_scanstatus_v2()] and the [nexec and ncycle]
|
|
2581
|
+
** columns of the [bytecode virtual table].
|
|
2582
|
+
** For statistics to be collected, the flag must be set on
|
|
2583
|
+
** the database handle both when the SQL statement is
|
|
2584
|
+
** [sqlite3_prepare|prepared] and when it is [sqlite3_step|stepped].
|
|
2585
|
+
** The flag is set (collection of statistics is enabled) by default.
|
|
2586
|
+
** <p>This option takes two arguments: an integer and a pointer to
|
|
2587
|
+
** an integer. The first argument is 1, 0, or -1 to enable, disable, or
|
|
2471
2588
|
** leave unchanged the statement scanstatus option. If the second argument
|
|
2472
2589
|
** is not NULL, then the value of the statement scanstatus setting after
|
|
2473
2590
|
** processing the first argument is written into the integer that the second
|
|
@@ -2480,7 +2597,7 @@ struct sqlite3_mem_methods {
|
|
|
2480
2597
|
** in which tables and indexes are scanned so that the scans start at the end
|
|
2481
2598
|
** and work toward the beginning rather than starting at the beginning and
|
|
2482
2599
|
** working toward the end. Setting SQLITE_DBCONFIG_REVERSE_SCANORDER is the
|
|
2483
|
-
** same as setting [PRAGMA reverse_unordered_selects].
|
|
2600
|
+
** same as setting [PRAGMA reverse_unordered_selects]. <p>This option takes
|
|
2484
2601
|
** two arguments which are an integer and a pointer to an integer. The first
|
|
2485
2602
|
** argument is 1, 0, or -1 to enable, disable, or leave unchanged the
|
|
2486
2603
|
** reverse scan order flag, respectively. If the second argument is not NULL,
|
|
@@ -2489,7 +2606,95 @@ struct sqlite3_mem_methods {
|
|
|
2489
2606
|
** first argument.
|
|
2490
2607
|
** </dd>
|
|
2491
2608
|
**
|
|
2609
|
+
** [[SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE]]
|
|
2610
|
+
** <dt>SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE</dt>
|
|
2611
|
+
** <dd>The SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE option enables or disables
|
|
2612
|
+
** the ability of the [ATTACH DATABASE] SQL command to create a new database
|
|
2613
|
+
** file if the database filed named in the ATTACH command does not already
|
|
2614
|
+
** exist. This ability of ATTACH to create a new database is enabled by
|
|
2615
|
+
** default. Applications can disable or reenable the ability for ATTACH to
|
|
2616
|
+
** create new database files using this DBCONFIG option.<p>
|
|
2617
|
+
** This option takes two arguments which are an integer and a pointer
|
|
2618
|
+
** to an integer. The first argument is 1, 0, or -1 to enable, disable, or
|
|
2619
|
+
** leave unchanged the attach-create flag, respectively. If the second
|
|
2620
|
+
** argument is not NULL, then 0 or 1 is written into the integer that the
|
|
2621
|
+
** second argument points to depending on if the attach-create flag is set
|
|
2622
|
+
** after processing the first argument.
|
|
2623
|
+
** </dd>
|
|
2624
|
+
**
|
|
2625
|
+
** [[SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE]]
|
|
2626
|
+
** <dt>SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE</dt>
|
|
2627
|
+
** <dd>The SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE option enables or disables the
|
|
2628
|
+
** ability of the [ATTACH DATABASE] SQL command to open a database for writing.
|
|
2629
|
+
** This capability is enabled by default. Applications can disable or
|
|
2630
|
+
** reenable this capability using the current DBCONFIG option. If
|
|
2631
|
+
** this capability is disabled, the [ATTACH] command will still work,
|
|
2632
|
+
** but the database will be opened read-only. If this option is disabled,
|
|
2633
|
+
** then the ability to create a new database using [ATTACH] is also disabled,
|
|
2634
|
+
** regardless of the value of the [SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE]
|
|
2635
|
+
** option.<p>
|
|
2636
|
+
** This option takes two arguments which are an integer and a pointer
|
|
2637
|
+
** to an integer. The first argument is 1, 0, or -1 to enable, disable, or
|
|
2638
|
+
** leave unchanged the ability to ATTACH another database for writing,
|
|
2639
|
+
** respectively. If the second argument is not NULL, then 0 or 1 is written
|
|
2640
|
+
** into the integer to which the second argument points, depending on whether
|
|
2641
|
+
** the ability to ATTACH a read/write database is enabled or disabled
|
|
2642
|
+
** after processing the first argument.
|
|
2643
|
+
** </dd>
|
|
2644
|
+
**
|
|
2645
|
+
** [[SQLITE_DBCONFIG_ENABLE_COMMENTS]]
|
|
2646
|
+
** <dt>SQLITE_DBCONFIG_ENABLE_COMMENTS</dt>
|
|
2647
|
+
** <dd>The SQLITE_DBCONFIG_ENABLE_COMMENTS option enables or disables the
|
|
2648
|
+
** ability to include comments in SQL text. Comments are enabled by default.
|
|
2649
|
+
** An application can disable or reenable comments in SQL text using this
|
|
2650
|
+
** DBCONFIG option.<p>
|
|
2651
|
+
** This option takes two arguments which are an integer and a pointer
|
|
2652
|
+
** to an integer. The first argument is 1, 0, or -1 to enable, disable, or
|
|
2653
|
+
** leave unchanged the ability to use comments in SQL text,
|
|
2654
|
+
** respectively. If the second argument is not NULL, then 0 or 1 is written
|
|
2655
|
+
** into the integer that the second argument points to depending on if
|
|
2656
|
+
** comments are allowed in SQL text after processing the first argument.
|
|
2657
|
+
** </dd>
|
|
2658
|
+
**
|
|
2659
|
+
** [[SQLITE_DBCONFIG_FP_DIGITS]]
|
|
2660
|
+
** <dt>SQLITE_DBCONFIG_FP_DIGITS</dt>
|
|
2661
|
+
** <dd>The SQLITE_DBCONFIG_FP_DIGITS setting is a small integer that determines
|
|
2662
|
+
** the number of significant digits that SQLite will attempt to preserve when
|
|
2663
|
+
** converting floating point numbers (IEEE 754 "doubles") into text. The
|
|
2664
|
+
** default value 17, as of SQLite version 3.52.0. The value was 15 in all
|
|
2665
|
+
** prior versions.<p>
|
|
2666
|
+
** This option takes two arguments which are an integer and a pointer
|
|
2667
|
+
** to an integer. The first argument is a small integer, between 3 and 23, or
|
|
2668
|
+
** zero. The FP_DIGITS setting is changed to that small integer, or left
|
|
2669
|
+
** unaltered if the first argument is zero or out of range. The second argument
|
|
2670
|
+
** is a pointer to an integer. If the pointer is not NULL, then the value of
|
|
2671
|
+
** the FP_DIGITS setting, after possibly being modified by the first
|
|
2672
|
+
** arguments, is written into the integer to which the second argument points.
|
|
2673
|
+
** </dd>
|
|
2674
|
+
**
|
|
2492
2675
|
** </dl>
|
|
2676
|
+
**
|
|
2677
|
+
** [[DBCONFIG arguments]] <h3>Arguments To SQLITE_DBCONFIG Options</h3>
|
|
2678
|
+
**
|
|
2679
|
+
** <p>Most of the SQLITE_DBCONFIG options take two arguments, so that the
|
|
2680
|
+
** overall call to [sqlite3_db_config()] has a total of four parameters.
|
|
2681
|
+
** The first argument (the third parameter to sqlite3_db_config()) is
|
|
2682
|
+
** an integer.
|
|
2683
|
+
** The second argument is a pointer to an integer. If the first argument is 1,
|
|
2684
|
+
** then the option becomes enabled. If the first integer argument is 0,
|
|
2685
|
+
** then the option is disabled.
|
|
2686
|
+
** If the first argument is -1, then the option setting
|
|
2687
|
+
** is unchanged. The second argument, the pointer to an integer, may be NULL.
|
|
2688
|
+
** If the second argument is not NULL, then a value of 0 or 1 is written into
|
|
2689
|
+
** the integer to which the second argument points, depending on whether the
|
|
2690
|
+
** setting is disabled or enabled after applying any changes specified by
|
|
2691
|
+
** the first argument.
|
|
2692
|
+
**
|
|
2693
|
+
** <p>While most SQLITE_DBCONFIG options use the argument format
|
|
2694
|
+
** described in the previous paragraph, the [SQLITE_DBCONFIG_MAINDBNAME],
|
|
2695
|
+
** [SQLITE_DBCONFIG_LOOKASIDE], and [SQLITE_DBCONFIG_FP_DIGITS] options
|
|
2696
|
+
** are different. See the documentation of those exceptional options for
|
|
2697
|
+
** details.
|
|
2493
2698
|
*/
|
|
2494
2699
|
#define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
|
|
2495
2700
|
#define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */
|
|
@@ -2511,7 +2716,11 @@ struct sqlite3_mem_methods {
|
|
|
2511
2716
|
#define SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017 /* int int* */
|
|
2512
2717
|
#define SQLITE_DBCONFIG_STMT_SCANSTATUS 1018 /* int int* */
|
|
2513
2718
|
#define SQLITE_DBCONFIG_REVERSE_SCANORDER 1019 /* int int* */
|
|
2514
|
-
#define
|
|
2719
|
+
#define SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE 1020 /* int int* */
|
|
2720
|
+
#define SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE 1021 /* int int* */
|
|
2721
|
+
#define SQLITE_DBCONFIG_ENABLE_COMMENTS 1022 /* int int* */
|
|
2722
|
+
#define SQLITE_DBCONFIG_FP_DIGITS 1023 /* int int* */
|
|
2723
|
+
#define SQLITE_DBCONFIG_MAX 1023 /* Largest DBCONFIG */
|
|
2515
2724
|
|
|
2516
2725
|
/*
|
|
2517
2726
|
** CAPI3REF: Enable Or Disable Extended Result Codes
|
|
@@ -2603,10 +2812,14 @@ SQLITE_API void sqlite3_set_last_insert_rowid(sqlite3*,sqlite3_int64);
|
|
|
2603
2812
|
** deleted by the most recently completed INSERT, UPDATE or DELETE
|
|
2604
2813
|
** statement on the database connection specified by the only parameter.
|
|
2605
2814
|
** The two functions are identical except for the type of the return value
|
|
2606
|
-
** and that if the number of rows modified by the most recent INSERT, UPDATE
|
|
2815
|
+
** and that if the number of rows modified by the most recent INSERT, UPDATE,
|
|
2607
2816
|
** or DELETE is greater than the maximum value supported by type "int", then
|
|
2608
2817
|
** the return value of sqlite3_changes() is undefined. ^Executing any other
|
|
2609
2818
|
** type of SQL statement does not modify the value returned by these functions.
|
|
2819
|
+
** For the purposes of this interface, a CREATE TABLE AS SELECT statement
|
|
2820
|
+
** does not count as an INSERT, UPDATE or DELETE statement and hence the rows
|
|
2821
|
+
** added to the new table by the CREATE TABLE AS SELECT statement are not
|
|
2822
|
+
** counted.
|
|
2610
2823
|
**
|
|
2611
2824
|
** ^Only changes made directly by the INSERT, UPDATE or DELETE statement are
|
|
2612
2825
|
** considered - auxiliary changes caused by [CREATE TRIGGER | triggers],
|
|
@@ -2747,8 +2960,9 @@ SQLITE_API int sqlite3_is_interrupted(sqlite3*);
|
|
|
2747
2960
|
** These routines are useful during command-line input to determine if the
|
|
2748
2961
|
** currently entered text seems to form a complete SQL statement or
|
|
2749
2962
|
** if additional input is needed before sending the text into
|
|
2750
|
-
** SQLite for parsing. ^
|
|
2751
|
-
**
|
|
2963
|
+
** SQLite for parsing. ^The sqlite3_complete(X) and sqlite3_complete16(X)
|
|
2964
|
+
** routines return 1 if the input string X appears to be a complete SQL
|
|
2965
|
+
** statement. ^A statement is judged to be
|
|
2752
2966
|
** complete if it ends with a semicolon token and is not a prefix of a
|
|
2753
2967
|
** well-formed CREATE TRIGGER statement. ^Semicolons that are embedded within
|
|
2754
2968
|
** string literals or quoted identifier names or comments are not
|
|
@@ -2756,11 +2970,25 @@ SQLITE_API int sqlite3_is_interrupted(sqlite3*);
|
|
|
2756
2970
|
** embedded) and thus do not count as a statement terminator. ^Whitespace
|
|
2757
2971
|
** and comments that follow the final semicolon are ignored.
|
|
2758
2972
|
**
|
|
2759
|
-
** ^
|
|
2760
|
-
** memory allocation fails, then
|
|
2761
|
-
**
|
|
2762
|
-
**
|
|
2763
|
-
**
|
|
2973
|
+
** ^The sqlite3_complete(X) and sqlite3_complete16(X) routines return 0
|
|
2974
|
+
** if the statement is incomplete. ^If a memory allocation fails, then
|
|
2975
|
+
** SQLITE_NOMEM is returned.
|
|
2976
|
+
**
|
|
2977
|
+
** The [sqlite3_incomplete(X)] routine is similar to [sqlite3_complete(X)]
|
|
2978
|
+
** except that sqlite3_incomplete(X) returns SQLITE_OK if the input X is
|
|
2979
|
+
** complete, SQLITE_EMPTY if input X consists entirely of whitespace and/or
|
|
2980
|
+
** comments, SQLITE_MISUSE if X is a NULL pointer, and some other non-zero
|
|
2981
|
+
** value if X is incomplete. The non-zero return from
|
|
2982
|
+
** sqlite3_incomplete(X) contains additional information about what is
|
|
2983
|
+
** needed to complete the input X. See the header comment on the
|
|
2984
|
+
** implemenation of the sqlite3_incomplete() routine for a full description
|
|
2985
|
+
** of its non-zero return values. The sqlite3_incomplete(X) interface
|
|
2986
|
+
** is only available for UTF-8 text.
|
|
2987
|
+
**
|
|
2988
|
+
** ^None of these routines do a full parse the SQL statements and thus
|
|
2989
|
+
** will not detect syntactically incorrect SQL. They only determine if
|
|
2990
|
+
** input text has properly terminated comments, string literals, and
|
|
2991
|
+
** quoted identifiers, and if the statement ends with a semicolon.
|
|
2764
2992
|
**
|
|
2765
2993
|
** ^(If SQLite has not been initialized using [sqlite3_initialize()] prior
|
|
2766
2994
|
** to invoking sqlite3_complete16() then sqlite3_initialize() is invoked
|
|
@@ -2768,14 +2996,15 @@ SQLITE_API int sqlite3_is_interrupted(sqlite3*);
|
|
|
2768
2996
|
** then the return value from sqlite3_complete16() will be non-zero
|
|
2769
2997
|
** regardless of whether or not the input SQL is complete.)^
|
|
2770
2998
|
**
|
|
2771
|
-
** The input to [sqlite3_complete()]
|
|
2772
|
-
** UTF-8 string.
|
|
2999
|
+
** The X input to [sqlite3_complete(X)] and [sqlite3_incomplete(X)]
|
|
3000
|
+
** must be a zero-terminated UTF-8 string.
|
|
2773
3001
|
**
|
|
2774
3002
|
** The input to [sqlite3_complete16()] must be a zero-terminated
|
|
2775
3003
|
** UTF-16 string in native byte order.
|
|
2776
3004
|
*/
|
|
2777
3005
|
SQLITE_API int sqlite3_complete(const char *sql);
|
|
2778
3006
|
SQLITE_API int sqlite3_complete16(const void *sql);
|
|
3007
|
+
SQLITE_API sqlite3_int64 sqlite3_incomplete(const char *sql);
|
|
2779
3008
|
|
|
2780
3009
|
/*
|
|
2781
3010
|
** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors
|
|
@@ -2861,6 +3090,44 @@ SQLITE_API int sqlite3_busy_handler(sqlite3*,int(*)(void*,int),void*);
|
|
|
2861
3090
|
*/
|
|
2862
3091
|
SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms);
|
|
2863
3092
|
|
|
3093
|
+
/*
|
|
3094
|
+
** CAPI3REF: Set the Setlk Timeout
|
|
3095
|
+
** METHOD: sqlite3
|
|
3096
|
+
**
|
|
3097
|
+
** This routine is only useful in SQLITE_ENABLE_SETLK_TIMEOUT builds. If
|
|
3098
|
+
** the VFS supports blocking locks, it sets the timeout in ms used by
|
|
3099
|
+
** eligible locks taken on wal mode databases by the specified database
|
|
3100
|
+
** handle. In non-SQLITE_ENABLE_SETLK_TIMEOUT builds, or if the VFS does
|
|
3101
|
+
** not support blocking locks, this function is a no-op.
|
|
3102
|
+
**
|
|
3103
|
+
** Passing 0 to this function disables blocking locks altogether. Passing
|
|
3104
|
+
** -1 to this function requests that the VFS blocks for a long time -
|
|
3105
|
+
** indefinitely if possible. The results of passing any other negative value
|
|
3106
|
+
** are undefined.
|
|
3107
|
+
**
|
|
3108
|
+
** Internally, each SQLite database handle stores two timeout values - the
|
|
3109
|
+
** busy-timeout (used for rollback mode databases, or if the VFS does not
|
|
3110
|
+
** support blocking locks) and the setlk-timeout (used for blocking locks
|
|
3111
|
+
** on wal-mode databases). The sqlite3_busy_timeout() method sets both
|
|
3112
|
+
** values, this function sets only the setlk-timeout value. Therefore,
|
|
3113
|
+
** to configure separate busy-timeout and setlk-timeout values for a single
|
|
3114
|
+
** database handle, call sqlite3_busy_timeout() followed by this function.
|
|
3115
|
+
**
|
|
3116
|
+
** Whenever the number of connections to a wal mode database falls from
|
|
3117
|
+
** 1 to 0, the last connection takes an exclusive lock on the database,
|
|
3118
|
+
** then checkpoints and deletes the wal file. While it is doing this, any
|
|
3119
|
+
** new connection that tries to read from the database fails with an
|
|
3120
|
+
** SQLITE_BUSY error. Or, if the SQLITE_SETLK_BLOCK_ON_CONNECT flag is
|
|
3121
|
+
** passed to this API, the new connection blocks until the exclusive lock
|
|
3122
|
+
** has been released.
|
|
3123
|
+
*/
|
|
3124
|
+
SQLITE_API int sqlite3_setlk_timeout(sqlite3*, int ms, int flags);
|
|
3125
|
+
|
|
3126
|
+
/*
|
|
3127
|
+
** CAPI3REF: Flags for sqlite3_setlk_timeout()
|
|
3128
|
+
*/
|
|
3129
|
+
#define SQLITE_SETLK_BLOCK_ON_CONNECT 0x01
|
|
3130
|
+
|
|
2864
3131
|
/*
|
|
2865
3132
|
** CAPI3REF: Convenience Routines For Running Queries
|
|
2866
3133
|
** METHOD: sqlite3
|
|
@@ -2868,7 +3135,7 @@ SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms);
|
|
|
2868
3135
|
** This is a legacy interface that is preserved for backwards compatibility.
|
|
2869
3136
|
** Use of this interface is not recommended.
|
|
2870
3137
|
**
|
|
2871
|
-
** Definition: A <b>result table</b> is memory data structure created by the
|
|
3138
|
+
** Definition: A <b>result table</b> is a memory data structure created by the
|
|
2872
3139
|
** [sqlite3_get_table()] interface. A result table records the
|
|
2873
3140
|
** complete query results from one or more queries.
|
|
2874
3141
|
**
|
|
@@ -3011,7 +3278,7 @@ SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list);
|
|
|
3011
3278
|
** ^Calling sqlite3_free() with a pointer previously returned
|
|
3012
3279
|
** by sqlite3_malloc() or sqlite3_realloc() releases that memory so
|
|
3013
3280
|
** that it might be reused. ^The sqlite3_free() routine is
|
|
3014
|
-
** a no-op if is called with a NULL pointer. Passing a NULL pointer
|
|
3281
|
+
** a no-op if it is called with a NULL pointer. Passing a NULL pointer
|
|
3015
3282
|
** to sqlite3_free() is harmless. After being freed, memory
|
|
3016
3283
|
** should neither be read nor written. Even reading previously freed
|
|
3017
3284
|
** memory might result in a segmentation fault or other severe error.
|
|
@@ -3029,13 +3296,13 @@ SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list);
|
|
|
3029
3296
|
** sqlite3_free(X).
|
|
3030
3297
|
** ^sqlite3_realloc(X,N) returns a pointer to a memory allocation
|
|
3031
3298
|
** of at least N bytes in size or NULL if insufficient memory is available.
|
|
3032
|
-
** ^If M is the size of the prior allocation, then min(N,M) bytes
|
|
3033
|
-
**
|
|
3299
|
+
** ^If M is the size of the prior allocation, then min(N,M) bytes of the
|
|
3300
|
+
** prior allocation are copied into the beginning of the buffer returned
|
|
3034
3301
|
** by sqlite3_realloc(X,N) and the prior allocation is freed.
|
|
3035
3302
|
** ^If sqlite3_realloc(X,N) returns NULL and N is positive, then the
|
|
3036
3303
|
** prior allocation is not freed.
|
|
3037
3304
|
**
|
|
3038
|
-
** ^The sqlite3_realloc64(X,N)
|
|
3305
|
+
** ^The sqlite3_realloc64(X,N) interface works the same as
|
|
3039
3306
|
** sqlite3_realloc(X,N) except that N is a 64-bit unsigned integer instead
|
|
3040
3307
|
** of a 32-bit signed integer.
|
|
3041
3308
|
**
|
|
@@ -3085,7 +3352,7 @@ SQLITE_API sqlite3_uint64 sqlite3_msize(void*);
|
|
|
3085
3352
|
** was last reset. ^The values returned by [sqlite3_memory_used()] and
|
|
3086
3353
|
** [sqlite3_memory_highwater()] include any overhead
|
|
3087
3354
|
** added by SQLite in its implementation of [sqlite3_malloc()],
|
|
3088
|
-
** but not overhead added by
|
|
3355
|
+
** but not overhead added by any underlying system library
|
|
3089
3356
|
** routines that [sqlite3_malloc()] may call.
|
|
3090
3357
|
**
|
|
3091
3358
|
** ^The memory high-water mark is reset to the current value of
|
|
@@ -3150,7 +3417,7 @@ SQLITE_API void sqlite3_randomness(int N, void *P);
|
|
|
3150
3417
|
**
|
|
3151
3418
|
** ^The first parameter to the authorizer callback is a copy of the third
|
|
3152
3419
|
** parameter to the sqlite3_set_authorizer() interface. ^The second parameter
|
|
3153
|
-
** to the callback is an integer [
|
|
3420
|
+
** to the callback is an integer [SQLITE_READ | action code] that specifies
|
|
3154
3421
|
** the particular action to be authorized. ^The third through sixth parameters
|
|
3155
3422
|
** to the callback are either NULL pointers or zero-terminated strings
|
|
3156
3423
|
** that contain additional details about the action to be authorized.
|
|
@@ -3193,21 +3460,33 @@ SQLITE_API void sqlite3_randomness(int N, void *P);
|
|
|
3193
3460
|
** previous call.)^ ^Disable the authorizer by installing a NULL callback.
|
|
3194
3461
|
** The authorizer is disabled by default.
|
|
3195
3462
|
**
|
|
3196
|
-
**
|
|
3463
|
+
** <h3>Limitations And Caveats</h3><ul>
|
|
3464
|
+
**
|
|
3465
|
+
** <li>The authorizer callback must not do anything that will modify
|
|
3197
3466
|
** the database connection that invoked the authorizer callback.
|
|
3198
3467
|
** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
|
|
3199
3468
|
** database connections for the meaning of "modify" in this paragraph.
|
|
3200
3469
|
**
|
|
3201
|
-
**
|
|
3470
|
+
** <li>^When [sqlite3_prepare_v2()] is used to prepare a statement, the
|
|
3202
3471
|
** statement might be re-prepared during [sqlite3_step()] due to a
|
|
3203
3472
|
** schema change. Hence, the application should ensure that the
|
|
3204
3473
|
** correct authorizer callback remains in place during the [sqlite3_step()].
|
|
3205
3474
|
**
|
|
3206
|
-
**
|
|
3475
|
+
** <li>^The authorizer callback is invoked only during
|
|
3207
3476
|
** [sqlite3_prepare()] or its variants. Authorization is not
|
|
3208
3477
|
** performed during statement evaluation in [sqlite3_step()], unless
|
|
3209
3478
|
** as stated in the previous paragraph, sqlite3_step() invokes
|
|
3210
3479
|
** sqlite3_prepare_v2() to reprepare a statement after a schema change.
|
|
3480
|
+
**
|
|
3481
|
+
** <li>Authorizer callbacks for the expressions of a
|
|
3482
|
+
** [generated column] are invoked when the schema is parsed (and specifically
|
|
3483
|
+
** when the [CREATE TABLE] statement that contains the generated column is
|
|
3484
|
+
** parsed) not when the generated column is used in a DML statement.
|
|
3485
|
+
** This is deliberate, as one of the purposes of generated columns
|
|
3486
|
+
** is to give schema designers the ability to provide gated access
|
|
3487
|
+
** to privileged columns and/or functions.
|
|
3488
|
+
**
|
|
3489
|
+
** </ul>
|
|
3211
3490
|
*/
|
|
3212
3491
|
SQLITE_API int sqlite3_set_authorizer(
|
|
3213
3492
|
sqlite3*,
|
|
@@ -3248,6 +3527,11 @@ SQLITE_API int sqlite3_set_authorizer(
|
|
|
3248
3527
|
** is the name of the inner-most trigger or view that is responsible for
|
|
3249
3528
|
** the access attempt or NULL if this access attempt is directly from
|
|
3250
3529
|
** top-level SQL code.
|
|
3530
|
+
**
|
|
3531
|
+
** The case of strings in the 3rd through the 6th argument to the
|
|
3532
|
+
** authorization callback is arbitrary. Authorization callbacks
|
|
3533
|
+
** implementations should use [sqlite3_stricmp()] or similar when
|
|
3534
|
+
** doing comparisons against those values.
|
|
3251
3535
|
*/
|
|
3252
3536
|
/******************************************* 3rd ************ 4th ***********/
|
|
3253
3537
|
#define SQLITE_CREATE_INDEX 1 /* Index Name Table Name */
|
|
@@ -3282,12 +3566,17 @@ SQLITE_API int sqlite3_set_authorizer(
|
|
|
3282
3566
|
#define SQLITE_DROP_VTABLE 30 /* Table Name Module Name */
|
|
3283
3567
|
#define SQLITE_FUNCTION 31 /* NULL Function Name */
|
|
3284
3568
|
#define SQLITE_SAVEPOINT 32 /* Operation Savepoint Name */
|
|
3285
|
-
#define SQLITE_COPY 0 /* No longer used */
|
|
3286
3569
|
#define SQLITE_RECURSIVE 33 /* NULL NULL */
|
|
3287
3570
|
|
|
3288
3571
|
/*
|
|
3289
|
-
**
|
|
3290
|
-
**
|
|
3572
|
+
** Note: The SQLITE_COPY macro (with value 0) used to be one of the
|
|
3573
|
+
** action codes above. That macro has now been repurposed as a possible
|
|
3574
|
+
** value to the 3rd argument to sqlite3_result_str().
|
|
3575
|
+
*/
|
|
3576
|
+
|
|
3577
|
+
/*
|
|
3578
|
+
** CAPI3REF: Deprecated Tracing And Profiling Functions
|
|
3579
|
+
** DEPRECATED
|
|
3291
3580
|
**
|
|
3292
3581
|
** These routines are deprecated. Use the [sqlite3_trace_v2()] interface
|
|
3293
3582
|
** instead of the routines described here.
|
|
@@ -3537,7 +3826,7 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
|
|
|
3537
3826
|
** there is no harm in trying.)
|
|
3538
3827
|
**
|
|
3539
3828
|
** ^(<dt>[SQLITE_OPEN_SHAREDCACHE]</dt>
|
|
3540
|
-
** <dd>The database is opened [shared cache] enabled, overriding
|
|
3829
|
+
** <dd>The database is opened with [shared cache] enabled, overriding
|
|
3541
3830
|
** the default shared cache setting provided by
|
|
3542
3831
|
** [sqlite3_enable_shared_cache()].)^
|
|
3543
3832
|
** The [use of shared cache mode is discouraged] and hence shared cache
|
|
@@ -3545,14 +3834,14 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
|
|
|
3545
3834
|
** this option is a no-op.
|
|
3546
3835
|
**
|
|
3547
3836
|
** ^(<dt>[SQLITE_OPEN_PRIVATECACHE]</dt>
|
|
3548
|
-
** <dd>The database is opened [shared cache] disabled, overriding
|
|
3837
|
+
** <dd>The database is opened with [shared cache] disabled, overriding
|
|
3549
3838
|
** the default shared cache setting provided by
|
|
3550
3839
|
** [sqlite3_enable_shared_cache()].)^
|
|
3551
3840
|
**
|
|
3552
3841
|
** [[OPEN_EXRESCODE]] ^(<dt>[SQLITE_OPEN_EXRESCODE]</dt>
|
|
3553
3842
|
** <dd>The database connection comes up in "extended result code mode".
|
|
3554
|
-
** In other words, the database behaves
|
|
3555
|
-
** [sqlite3_extended_result_codes(db,1)]
|
|
3843
|
+
** In other words, the database behaves as if
|
|
3844
|
+
** [sqlite3_extended_result_codes(db,1)] were called on the database
|
|
3556
3845
|
** connection as soon as the connection is created. In addition to setting
|
|
3557
3846
|
** the extended result code mode, this flag also causes [sqlite3_open_v2()]
|
|
3558
3847
|
** to return an extended result code.</dd>
|
|
@@ -3791,8 +4080,7 @@ SQLITE_API int sqlite3_open_v2(
|
|
|
3791
4080
|
**
|
|
3792
4081
|
** The sqlite3_uri_int64(F,P,D) routine converts the value of P into a
|
|
3793
4082
|
** 64-bit signed integer and returns that integer, or D if P does not
|
|
3794
|
-
** exist
|
|
3795
|
-
** zero is returned.
|
|
4083
|
+
** exist or if the value of P is something other than an integer.
|
|
3796
4084
|
**
|
|
3797
4085
|
** The sqlite3_uri_key(F,N) returns a pointer to the name (not
|
|
3798
4086
|
** the value) of the N-th query parameter for filename F, or a NULL
|
|
@@ -3880,7 +4168,7 @@ SQLITE_API sqlite3_file *sqlite3_database_file_object(const char*);
|
|
|
3880
4168
|
**
|
|
3881
4169
|
** The sqlite3_create_filename(D,J,W,N,P) allocates memory to hold a version of
|
|
3882
4170
|
** database filename D with corresponding journal file J and WAL file W and
|
|
3883
|
-
**
|
|
4171
|
+
** an array P of N URI Key/Value pairs. The result from
|
|
3884
4172
|
** sqlite3_create_filename(D,J,W,N,P) is a pointer to a database filename that
|
|
3885
4173
|
** is safe to pass to routines like:
|
|
3886
4174
|
** <ul>
|
|
@@ -3951,6 +4239,7 @@ SQLITE_API void sqlite3_free_filename(sqlite3_filename);
|
|
|
3951
4239
|
** <li> sqlite3_errmsg()
|
|
3952
4240
|
** <li> sqlite3_errmsg16()
|
|
3953
4241
|
** <li> sqlite3_error_offset()
|
|
4242
|
+
** <li> sqlite3_db_handle()
|
|
3954
4243
|
** </ul>
|
|
3955
4244
|
**
|
|
3956
4245
|
** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
|
|
@@ -3963,7 +4252,7 @@ SQLITE_API void sqlite3_free_filename(sqlite3_filename);
|
|
|
3963
4252
|
** subsequent calls to other SQLite interface functions.)^
|
|
3964
4253
|
**
|
|
3965
4254
|
** ^The sqlite3_errstr(E) interface returns the English-language text
|
|
3966
|
-
** that describes the [result code] E, as UTF-8, or NULL if E is not
|
|
4255
|
+
** that describes the [result code] E, as UTF-8, or NULL if E is not a
|
|
3967
4256
|
** result code for which a text error message is available.
|
|
3968
4257
|
** ^(Memory to hold the error message string is managed internally
|
|
3969
4258
|
** and must not be freed by the application)^.
|
|
@@ -3971,7 +4260,7 @@ SQLITE_API void sqlite3_free_filename(sqlite3_filename);
|
|
|
3971
4260
|
** ^If the most recent error references a specific token in the input
|
|
3972
4261
|
** SQL, the sqlite3_error_offset() interface returns the byte offset
|
|
3973
4262
|
** of the start of that token. ^The byte offset returned by
|
|
3974
|
-
** sqlite3_error_offset() assumes that the input SQL is
|
|
4263
|
+
** sqlite3_error_offset() assumes that the input SQL is UTF-8.
|
|
3975
4264
|
** ^If the most recent error does not reference a specific token in the input
|
|
3976
4265
|
** SQL, then the sqlite3_error_offset() function returns -1.
|
|
3977
4266
|
**
|
|
@@ -3996,6 +4285,34 @@ SQLITE_API const void *sqlite3_errmsg16(sqlite3*);
|
|
|
3996
4285
|
SQLITE_API const char *sqlite3_errstr(int);
|
|
3997
4286
|
SQLITE_API int sqlite3_error_offset(sqlite3 *db);
|
|
3998
4287
|
|
|
4288
|
+
/*
|
|
4289
|
+
** CAPI3REF: Set Error Code And Message
|
|
4290
|
+
** METHOD: sqlite3
|
|
4291
|
+
**
|
|
4292
|
+
** Set the error code of the database handle passed as the first argument
|
|
4293
|
+
** to errcode, and the error message to a copy of nul-terminated string
|
|
4294
|
+
** zErrMsg. If zErrMsg is passed NULL, then the error message is set to
|
|
4295
|
+
** the default message associated with the supplied error code. Subsequent
|
|
4296
|
+
** calls to [sqlite3_errcode()] and [sqlite3_errmsg()] and similar will
|
|
4297
|
+
** return the values set by this routine in place of what was previously
|
|
4298
|
+
** set by SQLite itself.
|
|
4299
|
+
**
|
|
4300
|
+
** This function returns SQLITE_OK if the error code and error message are
|
|
4301
|
+
** successfully set, SQLITE_NOMEM if an OOM occurs, and SQLITE_MISUSE if
|
|
4302
|
+
** the database handle is NULL or invalid.
|
|
4303
|
+
**
|
|
4304
|
+
** The error code and message set by this routine remains in effect until
|
|
4305
|
+
** they are changed, either by another call to this routine or until they are
|
|
4306
|
+
** changed to by SQLite itself to reflect the result of some subsquent
|
|
4307
|
+
** API call.
|
|
4308
|
+
**
|
|
4309
|
+
** This function is intended for use by SQLite extensions or wrappers. The
|
|
4310
|
+
** idea is that an extension or wrapper can use this routine to set error
|
|
4311
|
+
** messages and error codes and thus behave more like a core SQLite
|
|
4312
|
+
** feature from the point of view of an application.
|
|
4313
|
+
*/
|
|
4314
|
+
SQLITE_API int sqlite3_set_errmsg(sqlite3 *db, int errcode, const char *zErrMsg);
|
|
4315
|
+
|
|
3999
4316
|
/*
|
|
4000
4317
|
** CAPI3REF: Prepared Statement Object
|
|
4001
4318
|
** KEYWORDS: {prepared statement} {prepared statements}
|
|
@@ -4070,8 +4387,8 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
|
|
|
4070
4387
|
**
|
|
4071
4388
|
** These constants define various performance limits
|
|
4072
4389
|
** that can be lowered at run-time using [sqlite3_limit()].
|
|
4073
|
-
**
|
|
4074
|
-
**
|
|
4390
|
+
** A concise description of these limits follows, and additional information
|
|
4391
|
+
** is available at [limits | Limits in SQLite].
|
|
4075
4392
|
**
|
|
4076
4393
|
** <dl>
|
|
4077
4394
|
** [[SQLITE_LIMIT_LENGTH]] ^(<dt>SQLITE_LIMIT_LENGTH</dt>
|
|
@@ -4086,7 +4403,12 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
|
|
|
4086
4403
|
** or in an ORDER BY or GROUP BY clause.</dd>)^
|
|
4087
4404
|
**
|
|
4088
4405
|
** [[SQLITE_LIMIT_EXPR_DEPTH]] ^(<dt>SQLITE_LIMIT_EXPR_DEPTH</dt>
|
|
4089
|
-
** <dd>The maximum depth of the parse tree on any expression
|
|
4406
|
+
** <dd>The maximum depth of the parse tree on any expression and
|
|
4407
|
+
** the maximum nesting depth for subqueries and VIEWs</dd>)^
|
|
4408
|
+
**
|
|
4409
|
+
** [[SQLITE_LIMIT_PARSER_DEPTH]] ^(<dt>SQLITE_LIMIT_PARSER_DEPTH</dt>
|
|
4410
|
+
** <dd>The maximum depth of the LALR(1) parser stack used to analyze
|
|
4411
|
+
** input SQL statements.</dd>)^
|
|
4090
4412
|
**
|
|
4091
4413
|
** [[SQLITE_LIMIT_COMPOUND_SELECT]] ^(<dt>SQLITE_LIMIT_COMPOUND_SELECT</dt>
|
|
4092
4414
|
** <dd>The maximum number of terms in a compound SELECT statement.</dd>)^
|
|
@@ -4113,11 +4435,20 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
|
|
|
4113
4435
|
** <dd>The maximum index number of any [parameter] in an SQL statement.)^
|
|
4114
4436
|
**
|
|
4115
4437
|
** [[SQLITE_LIMIT_TRIGGER_DEPTH]] ^(<dt>SQLITE_LIMIT_TRIGGER_DEPTH</dt>
|
|
4116
|
-
** <dd>The maximum depth of recursion for triggers
|
|
4438
|
+
** <dd>The maximum depth of recursion for triggers, and the maximum
|
|
4439
|
+
** nesting depth for separate triggers.</dd>)^
|
|
4117
4440
|
**
|
|
4118
4441
|
** [[SQLITE_LIMIT_WORKER_THREADS]] ^(<dt>SQLITE_LIMIT_WORKER_THREADS</dt>
|
|
4119
4442
|
** <dd>The maximum number of auxiliary worker threads that a single
|
|
4120
4443
|
** [prepared statement] may start.</dd>)^
|
|
4444
|
+
**
|
|
4445
|
+
** [[SQLITE_LIMIT_SCHEMA]] ^(<dt>SQLITE_LIMIT_SCHEMA</dt>
|
|
4446
|
+
** <dd>The maximum number of objects (tables, indexes, triggers, and views)
|
|
4447
|
+
** defined by the database schema.</dd>)^
|
|
4448
|
+
**
|
|
4449
|
+
** [[SQLITE_LIMIT_TRIGGER_STEPS]] ^(<dt>SQLITE_LIMIT_TRIGGER_STEPS</dt>
|
|
4450
|
+
** <dd>The maximum number of SQL statements that can be contained within
|
|
4451
|
+
** a single trigger.</dd>)^
|
|
4121
4452
|
** </dl>
|
|
4122
4453
|
*/
|
|
4123
4454
|
#define SQLITE_LIMIT_LENGTH 0
|
|
@@ -4132,11 +4463,14 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
|
|
|
4132
4463
|
#define SQLITE_LIMIT_VARIABLE_NUMBER 9
|
|
4133
4464
|
#define SQLITE_LIMIT_TRIGGER_DEPTH 10
|
|
4134
4465
|
#define SQLITE_LIMIT_WORKER_THREADS 11
|
|
4466
|
+
#define SQLITE_LIMIT_PARSER_DEPTH 12
|
|
4467
|
+
#define SQLITE_LIMIT_SCHEMA 13
|
|
4468
|
+
#define SQLITE_LIMIT_TRIGGER_STEPS 14
|
|
4135
4469
|
|
|
4136
4470
|
/*
|
|
4137
4471
|
** CAPI3REF: Prepare Flags
|
|
4138
4472
|
**
|
|
4139
|
-
** These constants define various flags that can be passed into
|
|
4473
|
+
** These constants define various flags that can be passed into the
|
|
4140
4474
|
** "prepFlags" parameter of the [sqlite3_prepare_v3()] and
|
|
4141
4475
|
** [sqlite3_prepare16_v3()] interfaces.
|
|
4142
4476
|
**
|
|
@@ -4166,11 +4500,39 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
|
|
|
4166
4500
|
** <dd>The SQLITE_PREPARE_NO_VTAB flag causes the SQL compiler
|
|
4167
4501
|
** to return an error (error code SQLITE_ERROR) if the statement uses
|
|
4168
4502
|
** any virtual tables.
|
|
4503
|
+
**
|
|
4504
|
+
** [[SQLITE_PREPARE_DONT_LOG]] <dt>SQLITE_PREPARE_DONT_LOG</dt>
|
|
4505
|
+
** <dd>The SQLITE_PREPARE_DONT_LOG flag prevents SQL compiler
|
|
4506
|
+
** errors from being sent to the error log defined by
|
|
4507
|
+
** [SQLITE_CONFIG_LOG]. This can be used, for example, to do test
|
|
4508
|
+
** compiles to see if some SQL syntax is well-formed, without generating
|
|
4509
|
+
** messages on the global error log when it is not. If the test compile
|
|
4510
|
+
** fails, the sqlite3_prepare_v3() call returns the same error indications
|
|
4511
|
+
** with or without this flag; it just omits the call to [sqlite3_log()] that
|
|
4512
|
+
** logs the error.
|
|
4513
|
+
**
|
|
4514
|
+
** [[SQLITE_PREPARE_FROM_DDL]] <dt>SQLITE_PREPARE_FROM_DDL</dt>
|
|
4515
|
+
** <dd>The SQLITE_PREPARE_FROM_DDL flag causes the SQL compiler to enforce
|
|
4516
|
+
** security constraints that would otherwise only be enforced when parsing
|
|
4517
|
+
** the database schema. In other words, the SQLITE_PREPARE_FROM_DDL flag
|
|
4518
|
+
** causes the SQL compiler to treat the SQL statement being prepared as if
|
|
4519
|
+
** it had come from an attacker. When SQLITE_PREPARE_FROM_DDL is used and
|
|
4520
|
+
** [SQLITE_DBCONFIG_TRUSTED_SCHEMA] is off, SQL functions may only be called
|
|
4521
|
+
** if they are tagged with [SQLITE_INNOCUOUS] and virtual tables may only
|
|
4522
|
+
** be used if they are tagged with [SQLITE_VTAB_INNOCUOUS]. Best practice
|
|
4523
|
+
** is to use the SQLITE_PREPARE_FROM_DDL option when preparing any SQL that
|
|
4524
|
+
** is derived from parts of the database schema. In particular, virtual
|
|
4525
|
+
** table implementations that run SQL statements that are derived from
|
|
4526
|
+
** arguments to their CREATE VIRTUAL TABLE statement should always use
|
|
4527
|
+
** [sqlite3_prepare_v3()] and set the SQLITE_PREPARE_FROM_DDL flag to
|
|
4528
|
+
** prevent bypass of the [SQLITE_DBCONFIG_TRUSTED_SCHEMA] security checks.
|
|
4169
4529
|
** </dl>
|
|
4170
4530
|
*/
|
|
4171
4531
|
#define SQLITE_PREPARE_PERSISTENT 0x01
|
|
4172
4532
|
#define SQLITE_PREPARE_NORMALIZE 0x02
|
|
4173
4533
|
#define SQLITE_PREPARE_NO_VTAB 0x04
|
|
4534
|
+
#define SQLITE_PREPARE_DONT_LOG 0x10
|
|
4535
|
+
#define SQLITE_PREPARE_FROM_DDL 0x20
|
|
4174
4536
|
|
|
4175
4537
|
/*
|
|
4176
4538
|
** CAPI3REF: Compiling An SQL Statement
|
|
@@ -4184,8 +4546,9 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
|
|
|
4184
4546
|
**
|
|
4185
4547
|
** The preferred routine to use is [sqlite3_prepare_v2()]. The
|
|
4186
4548
|
** [sqlite3_prepare()] interface is legacy and should be avoided.
|
|
4187
|
-
** [sqlite3_prepare_v3()] has an extra
|
|
4188
|
-
**
|
|
4549
|
+
** [sqlite3_prepare_v3()] has an extra
|
|
4550
|
+
** [SQLITE_PREPARE_FROM_DDL|"prepFlags" option] that is sometimes
|
|
4551
|
+
** needed for special purpose or to pass along security restrictions.
|
|
4189
4552
|
**
|
|
4190
4553
|
** The use of the UTF-8 interfaces is preferred, as SQLite currently
|
|
4191
4554
|
** does all parsing using UTF-8. The UTF-16 interfaces are provided
|
|
@@ -4203,13 +4566,19 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
|
|
|
4203
4566
|
** and sqlite3_prepare16_v3() use UTF-16.
|
|
4204
4567
|
**
|
|
4205
4568
|
** ^If the nByte argument is negative, then zSql is read up to the
|
|
4206
|
-
** first zero terminator. ^If nByte is positive, then it is the
|
|
4207
|
-
** number of bytes read from zSql.
|
|
4569
|
+
** first zero terminator. ^If nByte is positive, then it is the maximum
|
|
4570
|
+
** number of bytes read from zSql. When nByte is positive, zSql is read
|
|
4571
|
+
** up to the first zero terminator or until the nByte bytes have been read,
|
|
4572
|
+
** whichever comes first. ^If nByte is zero, then no prepared
|
|
4208
4573
|
** statement is generated.
|
|
4209
4574
|
** If the caller knows that the supplied string is nul-terminated, then
|
|
4210
4575
|
** there is a small performance advantage to passing an nByte parameter that
|
|
4211
4576
|
** is the number of bytes in the input string <i>including</i>
|
|
4212
4577
|
** the nul-terminator.
|
|
4578
|
+
** Note that nByte measures the length of the input in bytes, not
|
|
4579
|
+
** characters, even for the UTF-16 interfaces.
|
|
4580
|
+
** For the sqlite3_prepare16() and sqlite3_prepare16_v2() interfaces,
|
|
4581
|
+
** the nByte value must be even or undefined behavior can result.
|
|
4213
4582
|
**
|
|
4214
4583
|
** ^If pzTail is not NULL then *pzTail is made to point to the first byte
|
|
4215
4584
|
** past the end of the first SQL statement in zSql. These routines only
|
|
@@ -4342,7 +4711,7 @@ SQLITE_API int sqlite3_prepare16_v3(
|
|
|
4342
4711
|
**
|
|
4343
4712
|
** ^The sqlite3_expanded_sql() interface returns NULL if insufficient memory
|
|
4344
4713
|
** is available to hold the result, or if the result would exceed the
|
|
4345
|
-
**
|
|
4714
|
+
** maximum string length determined by the [SQLITE_LIMIT_LENGTH].
|
|
4346
4715
|
**
|
|
4347
4716
|
** ^The [SQLITE_TRACE_SIZE_LIMIT] compile-time option limits the size of
|
|
4348
4717
|
** bound parameter expansions. ^The [SQLITE_OMIT_TRACE] compile-time
|
|
@@ -4530,7 +4899,7 @@ typedef struct sqlite3_value sqlite3_value;
|
|
|
4530
4899
|
**
|
|
4531
4900
|
** The context in which an SQL function executes is stored in an
|
|
4532
4901
|
** sqlite3_context object. ^A pointer to an sqlite3_context object
|
|
4533
|
-
** is always first parameter to [application-defined SQL functions].
|
|
4902
|
+
** is always the first parameter to [application-defined SQL functions].
|
|
4534
4903
|
** The application-defined SQL function implementation will pass this
|
|
4535
4904
|
** pointer through into calls to [sqlite3_result_int | sqlite3_result()],
|
|
4536
4905
|
** [sqlite3_aggregate_context()], [sqlite3_user_data()],
|
|
@@ -4546,7 +4915,7 @@ typedef struct sqlite3_context sqlite3_context;
|
|
|
4546
4915
|
** METHOD: sqlite3_stmt
|
|
4547
4916
|
**
|
|
4548
4917
|
** ^(In the SQL statement text input to [sqlite3_prepare_v2()] and its variants,
|
|
4549
|
-
** literals may be replaced by a [parameter] that matches one of following
|
|
4918
|
+
** literals may be replaced by a [parameter] that matches one of the following
|
|
4550
4919
|
** templates:
|
|
4551
4920
|
**
|
|
4552
4921
|
** <ul>
|
|
@@ -4586,12 +4955,12 @@ typedef struct sqlite3_context sqlite3_context;
|
|
|
4586
4955
|
** it should be a pointer to well-formed UTF16 text.
|
|
4587
4956
|
** ^If the third parameter to sqlite3_bind_text64() is not NULL, then
|
|
4588
4957
|
** it should be a pointer to a well-formed unicode string that is
|
|
4589
|
-
** either UTF8 if the sixth parameter is SQLITE_UTF8
|
|
4590
|
-
** otherwise.
|
|
4958
|
+
** either UTF8 if the sixth parameter is SQLITE_UTF8 or SQLITE_UTF8_ZT,
|
|
4959
|
+
** or UTF16 otherwise.
|
|
4591
4960
|
**
|
|
4592
4961
|
** [[byte-order determination rules]] ^The byte-order of
|
|
4593
4962
|
** UTF16 input text is determined by the byte-order mark (BOM, U+FEFF)
|
|
4594
|
-
** found in first character, which is removed, or in the absence of a BOM
|
|
4963
|
+
** found in the first character, which is removed, or in the absence of a BOM
|
|
4595
4964
|
** the byte order is the native byte order of the host
|
|
4596
4965
|
** machine for sqlite3_bind_text16() or the byte order specified in
|
|
4597
4966
|
** the 6th parameter for sqlite3_bind_text64().)^
|
|
@@ -4611,7 +4980,7 @@ typedef struct sqlite3_context sqlite3_context;
|
|
|
4611
4980
|
** or sqlite3_bind_text16() or sqlite3_bind_text64() then
|
|
4612
4981
|
** that parameter must be the byte offset
|
|
4613
4982
|
** where the NUL terminator would occur assuming the string were NUL
|
|
4614
|
-
** terminated. If any NUL characters
|
|
4983
|
+
** terminated. If any NUL characters occur at byte offsets less than
|
|
4615
4984
|
** the value of the fourth parameter then the resulting string value will
|
|
4616
4985
|
** contain embedded NULs. The result of expressions involving strings
|
|
4617
4986
|
** with embedded NULs is undefined.
|
|
@@ -4633,10 +5002,15 @@ typedef struct sqlite3_context sqlite3_context;
|
|
|
4633
5002
|
** object and pointer to it must remain valid until then. ^SQLite will then
|
|
4634
5003
|
** manage the lifetime of its private copy.
|
|
4635
5004
|
**
|
|
4636
|
-
** ^The sixth argument
|
|
4637
|
-
**
|
|
4638
|
-
**
|
|
4639
|
-
**
|
|
5005
|
+
** ^The sixth argument (the E argument)
|
|
5006
|
+
** to sqlite3_bind_text64(S,K,Z,N,D,E) must be one of
|
|
5007
|
+
** [SQLITE_UTF8], [SQLITE_UTF8_ZT], [SQLITE_UTF16], [SQLITE_UTF16BE],
|
|
5008
|
+
** or [SQLITE_UTF16LE] to specify the encoding of the text in the
|
|
5009
|
+
** third parameter, Z. The special value [SQLITE_UTF8_ZT] means that the
|
|
5010
|
+
** string argument is both UTF-8 encoded and is zero-terminated. In other
|
|
5011
|
+
** words, SQLITE_UTF8_ZT means that the Z array is allocated to hold at
|
|
5012
|
+
** least N+1 bytes and that the Z[N] byte is zero. If
|
|
5013
|
+
** the E argument to sqlite3_bind_text64(S,K,Z,N,D,E) is not one of the
|
|
4640
5014
|
** allowed values shown above, or if the text encoding is different
|
|
4641
5015
|
** from the encoding specified by the sixth parameter, then the behavior
|
|
4642
5016
|
** is undefined.
|
|
@@ -4654,9 +5028,11 @@ typedef struct sqlite3_context sqlite3_context;
|
|
|
4654
5028
|
** associated with the pointer P of type T. ^D is either a NULL pointer or
|
|
4655
5029
|
** a pointer to a destructor function for P. ^SQLite will invoke the
|
|
4656
5030
|
** destructor D with a single argument of P when it is finished using
|
|
4657
|
-
** P
|
|
4658
|
-
**
|
|
4659
|
-
**
|
|
5031
|
+
** P, even if the call to sqlite3_bind_pointer() fails. Due to a
|
|
5032
|
+
** historical design quirk, results are undefined if D is
|
|
5033
|
+
** SQLITE_TRANSIENT. The T parameter should be a static string,
|
|
5034
|
+
** preferably a string literal. The sqlite3_bind_pointer() routine is
|
|
5035
|
+
** part of the [pointer passing interface] added for SQLite 3.20.0.
|
|
4660
5036
|
**
|
|
4661
5037
|
** ^If any of the sqlite3_bind_*() routines are called with a NULL pointer
|
|
4662
5038
|
** for the [prepared statement] or with a prepared statement for which
|
|
@@ -4823,7 +5199,7 @@ SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt*, int N);
|
|
|
4823
5199
|
** METHOD: sqlite3_stmt
|
|
4824
5200
|
**
|
|
4825
5201
|
** ^These routines provide a means to determine the database, table, and
|
|
4826
|
-
** table column that is the origin of a particular result column in
|
|
5202
|
+
** table column that is the origin of a particular result column in a
|
|
4827
5203
|
** [SELECT] statement.
|
|
4828
5204
|
** ^The name of the database or table or column can be returned as
|
|
4829
5205
|
** either a UTF-8 or UTF-16 string. ^The _database_ routines return
|
|
@@ -4949,7 +5325,7 @@ SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
|
|
|
4949
5325
|
** [prepared statement]. ^In the "v2" interface,
|
|
4950
5326
|
** the more specific error code is returned directly by sqlite3_step().
|
|
4951
5327
|
**
|
|
4952
|
-
** [SQLITE_MISUSE] means that
|
|
5328
|
+
** [SQLITE_MISUSE] means that this routine was called inappropriately.
|
|
4953
5329
|
** Perhaps it was called on a [prepared statement] that has
|
|
4954
5330
|
** already been [sqlite3_finalize | finalized] or on one that had
|
|
4955
5331
|
** previously returned [SQLITE_ERROR] or [SQLITE_DONE]. Or it could
|
|
@@ -4961,7 +5337,7 @@ SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
|
|
|
4961
5337
|
** other than [SQLITE_ROW] before any subsequent invocation of
|
|
4962
5338
|
** sqlite3_step(). Failure to reset the prepared statement using
|
|
4963
5339
|
** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from
|
|
4964
|
-
** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1],
|
|
5340
|
+
** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1]),
|
|
4965
5341
|
** sqlite3_step() began
|
|
4966
5342
|
** calling [sqlite3_reset()] automatically in this circumstance rather
|
|
4967
5343
|
** than returning [SQLITE_MISUSE]. This is not considered a compatibility
|
|
@@ -5267,7 +5643,7 @@ SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol);
|
|
|
5267
5643
|
**
|
|
5268
5644
|
** ^The sqlite3_finalize() function is called to delete a [prepared statement].
|
|
5269
5645
|
** ^If the most recent evaluation of the statement encountered no errors
|
|
5270
|
-
** or if the statement
|
|
5646
|
+
** or if the statement has never been evaluated, then sqlite3_finalize() returns
|
|
5271
5647
|
** SQLITE_OK. ^If the most recent evaluation of statement S failed, then
|
|
5272
5648
|
** sqlite3_finalize(S) returns the appropriate [error code] or
|
|
5273
5649
|
** [extended error code].
|
|
@@ -5392,8 +5768,8 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
|
|
|
5392
5768
|
**
|
|
5393
5769
|
** For best security, the [SQLITE_DIRECTONLY] flag is recommended for
|
|
5394
5770
|
** all application-defined SQL functions that do not need to be
|
|
5395
|
-
** used inside of triggers,
|
|
5396
|
-
** the database schema. This
|
|
5771
|
+
** used inside of triggers, views, CHECK constraints, or other elements of
|
|
5772
|
+
** the database schema. This flag is especially recommended for SQL
|
|
5397
5773
|
** functions that have side effects or reveal internal application state.
|
|
5398
5774
|
** Without this flag, an attacker might be able to modify the schema of
|
|
5399
5775
|
** a database file to include invocations of the function with parameters
|
|
@@ -5424,7 +5800,7 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
|
|
|
5424
5800
|
** [user-defined window functions|available here].
|
|
5425
5801
|
**
|
|
5426
5802
|
** ^(If the final parameter to sqlite3_create_function_v2() or
|
|
5427
|
-
** sqlite3_create_window_function() is not NULL, then it is destructor for
|
|
5803
|
+
** sqlite3_create_window_function() is not NULL, then it is the destructor for
|
|
5428
5804
|
** the application data pointer. The destructor is invoked when the function
|
|
5429
5805
|
** is deleted, either by being overloaded or when the database connection
|
|
5430
5806
|
** closes.)^ ^The destructor is also invoked if the call to
|
|
@@ -5499,8 +5875,54 @@ SQLITE_API int sqlite3_create_window_function(
|
|
|
5499
5875
|
/*
|
|
5500
5876
|
** CAPI3REF: Text Encodings
|
|
5501
5877
|
**
|
|
5502
|
-
** These
|
|
5878
|
+
** These constants define integer codes that represent the various
|
|
5503
5879
|
** text encodings supported by SQLite.
|
|
5880
|
+
**
|
|
5881
|
+
** <dl>
|
|
5882
|
+
** [[SQLITE_UTF8]] <dt>SQLITE_UTF8</dt><dd>Text is encoding as UTF-8</dd>
|
|
5883
|
+
**
|
|
5884
|
+
** [[SQLITE_UTF16LE]] <dt>SQLITE_UTF16LE</dt><dd>Text is encoding as UTF-16
|
|
5885
|
+
** with each code point being expressed "little endian" - the least significant
|
|
5886
|
+
** byte first. This is the usual encoding, for example on Windows.</dd>
|
|
5887
|
+
**
|
|
5888
|
+
** [[SQLITE_UTF16BE]] <dt>SQLITE_UTF16BE</dt><dd>Text is encoding as UTF-16
|
|
5889
|
+
** with each code point being expressed "big endian" - the most significant
|
|
5890
|
+
** byte first. This encoding is less common, but is still sometimes seen,
|
|
5891
|
+
** specially on older systems.
|
|
5892
|
+
**
|
|
5893
|
+
** [[SQLITE_UTF16]] <dt>SQLITE_UTF16</dt><dd>Text is encoding as UTF-16
|
|
5894
|
+
** with each code point being expressed either little endian or as big
|
|
5895
|
+
** endian, according to the native endianness of the host computer.
|
|
5896
|
+
**
|
|
5897
|
+
** [[SQLITE_ANY]] <dt>SQLITE_ANY</dt><dd>This encoding value may only be used
|
|
5898
|
+
** to declare the preferred text for [application-defined SQL functions]
|
|
5899
|
+
** created using [sqlite3_create_function()] and similar. If the preferred
|
|
5900
|
+
** encoding (the 4th parameter to sqlite3_create_function() - the eTextRep
|
|
5901
|
+
** parameter) is SQLITE_ANY, that indicates that the function does not have
|
|
5902
|
+
** a preference regarding the text encoding of its parameters and can take
|
|
5903
|
+
** any text encoding that the SQLite core find convenient to supply. This
|
|
5904
|
+
** option is deprecated. Please do not use it in new applications.
|
|
5905
|
+
**
|
|
5906
|
+
** [[SQLITE_UTF16_ALIGNED]] <dt>SQLITE_UTF16_ALIGNED</dt><dd>This encoding
|
|
5907
|
+
** value may be used as the 3rd parameter (the eTextRep parameter) to
|
|
5908
|
+
** [sqlite3_create_collation()] and similar. This encoding value means
|
|
5909
|
+
** that the application-defined collating sequence created expects its
|
|
5910
|
+
** input strings to be in UTF16 in native byte order, and that the start
|
|
5911
|
+
** of the strings must be aligned to a 2-byte boundary.
|
|
5912
|
+
**
|
|
5913
|
+
** [[SQLITE_UTF8_ZT]] <dt>SQLITE_UTF8_ZT</dt><dd>This option can only be
|
|
5914
|
+
** used to specify the text encoding to strings input to
|
|
5915
|
+
** [sqlite3_result_text64()] and [sqlite3_bind_text64()].
|
|
5916
|
+
** The SQLITE_UTF8_ZT encoding means that the input string (call it "z")
|
|
5917
|
+
** is UTF-8 encoded and that it is zero-terminated. If the length parameter
|
|
5918
|
+
** (call it "n") is non-negative, this encoding option means that the caller
|
|
5919
|
+
** guarantees that z array contains at least n+1 bytes and that the z[n]
|
|
5920
|
+
** byte has a value of zero.
|
|
5921
|
+
** This option gives the same output as SQLITE_UTF8, but can be more efficient
|
|
5922
|
+
** by avoiding the need to make a copy of the input string, in some cases.
|
|
5923
|
+
** However, if z is allocated to hold fewer than n+1 bytes or if the
|
|
5924
|
+
** z[n] byte is not zero, undefined behavior may result.
|
|
5925
|
+
** </dl>
|
|
5504
5926
|
*/
|
|
5505
5927
|
#define SQLITE_UTF8 1 /* IMP: R-37514-35566 */
|
|
5506
5928
|
#define SQLITE_UTF16LE 2 /* IMP: R-03371-37637 */
|
|
@@ -5508,6 +5930,7 @@ SQLITE_API int sqlite3_create_window_function(
|
|
|
5508
5930
|
#define SQLITE_UTF16 4 /* Use native byte order */
|
|
5509
5931
|
#define SQLITE_ANY 5 /* Deprecated */
|
|
5510
5932
|
#define SQLITE_UTF16_ALIGNED 8 /* sqlite3_create_collation only */
|
|
5933
|
+
#define SQLITE_UTF8_ZT 16 /* Zero-terminated UTF8 */
|
|
5511
5934
|
|
|
5512
5935
|
/*
|
|
5513
5936
|
** CAPI3REF: Function Flags
|
|
@@ -5580,7 +6003,7 @@ SQLITE_API int sqlite3_create_window_function(
|
|
|
5580
6003
|
** This flag instructs SQLite to omit some corner-case optimizations that
|
|
5581
6004
|
** might disrupt the operation of the [sqlite3_value_subtype()] function,
|
|
5582
6005
|
** causing it to return zero rather than the correct subtype().
|
|
5583
|
-
** SQL functions that
|
|
6006
|
+
** All SQL functions that invoke [sqlite3_value_subtype()] should have this
|
|
5584
6007
|
** property. If the SQLITE_SUBTYPE property is omitted, then the return
|
|
5585
6008
|
** value from [sqlite3_value_subtype()] might sometimes be zero even though
|
|
5586
6009
|
** a non-zero subtype was specified by the function argument expression.
|
|
@@ -5591,11 +6014,20 @@ SQLITE_API int sqlite3_create_window_function(
|
|
|
5591
6014
|
** result.
|
|
5592
6015
|
** Every function that invokes [sqlite3_result_subtype()] should have this
|
|
5593
6016
|
** property. If it does not, then the call to [sqlite3_result_subtype()]
|
|
5594
|
-
** might become a no-op if the function is used as term in an
|
|
6017
|
+
** might become a no-op if the function is used as a term in an
|
|
5595
6018
|
** [expression index]. On the other hand, SQL functions that never invoke
|
|
5596
6019
|
** [sqlite3_result_subtype()] should avoid setting this property, as the
|
|
5597
6020
|
** purpose of this property is to disable certain optimizations that are
|
|
5598
6021
|
** incompatible with subtypes.
|
|
6022
|
+
**
|
|
6023
|
+
** [[SQLITE_SELFORDER1]] <dt>SQLITE_SELFORDER1</dt><dd>
|
|
6024
|
+
** The SQLITE_SELFORDER1 flag indicates that the function is an aggregate
|
|
6025
|
+
** that internally orders the values provided to the first argument. The
|
|
6026
|
+
** ordered-set aggregate SQL notation with a single ORDER BY term can be
|
|
6027
|
+
** used to invoke this function. If the ordered-set aggregate notation is
|
|
6028
|
+
** used on a function that lacks this flag, then an error is raised. Note
|
|
6029
|
+
** that the ordered-set aggregate syntax is only available if SQLite is
|
|
6030
|
+
** built using the -DSQLITE_ENABLE_ORDERED_SET_AGGREGATES compile-time option.
|
|
5599
6031
|
** </dd>
|
|
5600
6032
|
** </dl>
|
|
5601
6033
|
*/
|
|
@@ -5604,6 +6036,7 @@ SQLITE_API int sqlite3_create_window_function(
|
|
|
5604
6036
|
#define SQLITE_SUBTYPE 0x000100000
|
|
5605
6037
|
#define SQLITE_INNOCUOUS 0x000200000
|
|
5606
6038
|
#define SQLITE_RESULT_SUBTYPE 0x001000000
|
|
6039
|
+
#define SQLITE_SELFORDER1 0x002000000
|
|
5607
6040
|
|
|
5608
6041
|
/*
|
|
5609
6042
|
** CAPI3REF: Deprecated Functions
|
|
@@ -5708,7 +6141,7 @@ SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int6
|
|
|
5708
6141
|
** sqlite3_value_nochange(X) interface returns true if and only if
|
|
5709
6142
|
** the column corresponding to X is unchanged by the UPDATE operation
|
|
5710
6143
|
** that the xUpdate method call was invoked to implement and if
|
|
5711
|
-
**
|
|
6144
|
+
** the prior [xColumn] method call that was invoked to extract
|
|
5712
6145
|
** the value for that column returned without setting a result (probably
|
|
5713
6146
|
** because it queried [sqlite3_vtab_nochange()] and found that the column
|
|
5714
6147
|
** was unchanging). ^Within an [xUpdate] method, any value for which
|
|
@@ -5732,26 +6165,22 @@ SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int6
|
|
|
5732
6165
|
** the SQL function that supplied the [sqlite3_value*] parameters.
|
|
5733
6166
|
**
|
|
5734
6167
|
** As long as the input parameter is correct, these routines can only
|
|
5735
|
-
** fail if an out-of-memory error occurs
|
|
5736
|
-
**
|
|
5737
|
-
** errors:
|
|
5738
|
-
**
|
|
5739
|
-
** <ul>
|
|
5740
|
-
** <li> sqlite3_value_blob()
|
|
5741
|
-
** <li> sqlite3_value_text()
|
|
5742
|
-
** <li> sqlite3_value_text16()
|
|
5743
|
-
** <li> sqlite3_value_text16le()
|
|
5744
|
-
** <li> sqlite3_value_text16be()
|
|
5745
|
-
** <li> sqlite3_value_bytes()
|
|
5746
|
-
** <li> sqlite3_value_bytes16()
|
|
5747
|
-
** </ul>
|
|
5748
|
-
**
|
|
6168
|
+
** fail if an out-of-memory error occurs while trying to do a
|
|
6169
|
+
** UTF8→UTF16 or UTF16→UTF8 conversion.
|
|
5749
6170
|
** If an out-of-memory error occurs, then the return value from these
|
|
5750
6171
|
** routines is the same as if the column had contained an SQL NULL value.
|
|
5751
|
-
**
|
|
5752
|
-
**
|
|
6172
|
+
** If the input sqlite3_value was not obtained from [sqlite3_value_dup()],
|
|
6173
|
+
** then valid SQL NULL returns can also be distinguished from
|
|
6174
|
+
** out-of-memory errors after extracting the value
|
|
6175
|
+
** by invoking the [sqlite3_errcode()] immediately after the suspicious
|
|
5753
6176
|
** return value is obtained and before any
|
|
5754
6177
|
** other SQLite interface is called on the same [database connection].
|
|
6178
|
+
** If the input sqlite3_value was obtained from sqlite3_value_dup() then
|
|
6179
|
+
** it is disconnected from the database connection and so sqlite3_errcode()
|
|
6180
|
+
** will not work.
|
|
6181
|
+
** In that case, the only way to distinguish an out-of-memory
|
|
6182
|
+
** condition from a true SQL NULL is to invoke sqlite3_value_type() on the
|
|
6183
|
+
** input to see if it is NULL prior to trying to extract the value.
|
|
5755
6184
|
*/
|
|
5756
6185
|
SQLITE_API const void *sqlite3_value_blob(sqlite3_value*);
|
|
5757
6186
|
SQLITE_API double sqlite3_value_double(sqlite3_value*);
|
|
@@ -5778,7 +6207,8 @@ SQLITE_API int sqlite3_value_frombind(sqlite3_value*);
|
|
|
5778
6207
|
** of the value X, assuming that X has type TEXT.)^ If sqlite3_value_type(X)
|
|
5779
6208
|
** returns something other than SQLITE_TEXT, then the return value from
|
|
5780
6209
|
** sqlite3_value_encoding(X) is meaningless. ^Calls to
|
|
5781
|
-
** [sqlite3_value_text(X)], [sqlite3_value_text16(X)],
|
|
6210
|
+
** [sqlite3_value_text(X)], [sqlite3_value_text16(X)],
|
|
6211
|
+
** [sqlite3_value_text16be(X)],
|
|
5782
6212
|
** [sqlite3_value_text16le(X)], [sqlite3_value_bytes(X)], or
|
|
5783
6213
|
** [sqlite3_value_bytes16(X)] might change the encoding of the value X and
|
|
5784
6214
|
** thus change the return from subsequent calls to sqlite3_value_encoding(X).
|
|
@@ -5801,7 +6231,7 @@ SQLITE_API int sqlite3_value_encoding(sqlite3_value*);
|
|
|
5801
6231
|
** one SQL function to another. Use the [sqlite3_result_subtype()]
|
|
5802
6232
|
** routine to set the subtype for the return value of an SQL function.
|
|
5803
6233
|
**
|
|
5804
|
-
** Every [application-defined SQL function] that
|
|
6234
|
+
** Every [application-defined SQL function] that invokes this interface
|
|
5805
6235
|
** should include the [SQLITE_SUBTYPE] property in the text
|
|
5806
6236
|
** encoding argument when the function is [sqlite3_create_function|registered].
|
|
5807
6237
|
** If the [SQLITE_SUBTYPE] property is omitted, then sqlite3_value_subtype()
|
|
@@ -5814,7 +6244,7 @@ SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value*);
|
|
|
5814
6244
|
** METHOD: sqlite3_value
|
|
5815
6245
|
**
|
|
5816
6246
|
** ^The sqlite3_value_dup(V) interface makes a copy of the [sqlite3_value]
|
|
5817
|
-
** object
|
|
6247
|
+
** object V and returns a pointer to that copy. ^The [sqlite3_value] returned
|
|
5818
6248
|
** is a [protected sqlite3_value] object even if the input is not.
|
|
5819
6249
|
** ^The sqlite3_value_dup(V) interface returns NULL if V is NULL or if a
|
|
5820
6250
|
** memory allocation fails. ^If V is a [pointer value], then the result
|
|
@@ -5852,7 +6282,7 @@ SQLITE_API void sqlite3_value_free(sqlite3_value*);
|
|
|
5852
6282
|
** allocation error occurs.
|
|
5853
6283
|
**
|
|
5854
6284
|
** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is
|
|
5855
|
-
** determined by the N parameter on first successful call. Changing the
|
|
6285
|
+
** determined by the N parameter on the first successful call. Changing the
|
|
5856
6286
|
** value of N in any subsequent call to sqlite3_aggregate_context() within
|
|
5857
6287
|
** the same aggregate function instance will not resize the memory
|
|
5858
6288
|
** allocation.)^ Within the xFinal callback, it is customary to set
|
|
@@ -5909,17 +6339,17 @@ SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*);
|
|
|
5909
6339
|
** query execution, under some circumstances the associated auxiliary data
|
|
5910
6340
|
** might be preserved. An example of where this might be useful is in a
|
|
5911
6341
|
** regular-expression matching function. The compiled version of the regular
|
|
5912
|
-
** expression can be stored as auxiliary data associated with the pattern
|
|
5913
|
-
** Then as long as the pattern string remains the same,
|
|
6342
|
+
** expression can be stored as auxiliary data associated with the pattern
|
|
6343
|
+
** string. Then as long as the pattern string remains the same,
|
|
5914
6344
|
** the compiled regular expression can be reused on multiple
|
|
5915
6345
|
** invocations of the same function.
|
|
5916
6346
|
**
|
|
5917
|
-
** ^The sqlite3_get_auxdata(C,N) interface returns a pointer to the auxiliary
|
|
5918
|
-
** associated by the sqlite3_set_auxdata(C,N,P,X) function with the
|
|
5919
|
-
** value to the application-defined function. ^N is zero
|
|
5920
|
-
** function argument. ^If there is no auxiliary data
|
|
5921
|
-
** associated with the function argument, the sqlite3_get_auxdata(C,N)
|
|
5922
|
-
** returns a NULL pointer.
|
|
6347
|
+
** ^The sqlite3_get_auxdata(C,N) interface returns a pointer to the auxiliary
|
|
6348
|
+
** data associated by the sqlite3_set_auxdata(C,N,P,X) function with the
|
|
6349
|
+
** Nth argument value to the application-defined function. ^N is zero
|
|
6350
|
+
** for the left-most function argument. ^If there is no auxiliary data
|
|
6351
|
+
** associated with the function argument, the sqlite3_get_auxdata(C,N)
|
|
6352
|
+
** interface returns a NULL pointer.
|
|
5923
6353
|
**
|
|
5924
6354
|
** ^The sqlite3_set_auxdata(C,N,P,X) interface saves P as auxiliary data for the
|
|
5925
6355
|
** N-th argument of the application-defined function. ^Subsequent
|
|
@@ -5981,6 +6411,7 @@ SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(voi
|
|
|
5981
6411
|
** or a NULL pointer if there were no prior calls to
|
|
5982
6412
|
** sqlite3_set_clientdata() with the same values of D and N.
|
|
5983
6413
|
** Names are compared using strcmp() and are thus case sensitive.
|
|
6414
|
+
** It returns 0 on success and SQLITE_NOMEM on allocation failure.
|
|
5984
6415
|
**
|
|
5985
6416
|
** If P and X are both non-NULL, then the destructor X is invoked with
|
|
5986
6417
|
** argument P on the first of the following occurrences:
|
|
@@ -6002,10 +6433,14 @@ SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(voi
|
|
|
6002
6433
|
**
|
|
6003
6434
|
** There is no limit (other than available memory) on the number of different
|
|
6004
6435
|
** client data pointers (with different names) that can be attached to a
|
|
6005
|
-
** single database connection. However, the implementation
|
|
6006
|
-
**
|
|
6007
|
-
**
|
|
6008
|
-
**
|
|
6436
|
+
** single database connection. However, the current implementation stores
|
|
6437
|
+
** the content on a linked list. Insert and retrieval performance will
|
|
6438
|
+
** be proportional to the number of entries. The design use case, and
|
|
6439
|
+
** the use case for which the implementation is optimized, is
|
|
6440
|
+
** that an application will store only small number of client data names,
|
|
6441
|
+
** typically just one or two. This interface is not intended to be a
|
|
6442
|
+
** generalized key/value store for thousands or millions of keys. It
|
|
6443
|
+
** will work for that, but performance might be disappointing.
|
|
6009
6444
|
**
|
|
6010
6445
|
** There is no way to enumerate the client data pointers
|
|
6011
6446
|
** associated with a database connection. The N parameter can be thought
|
|
@@ -6014,7 +6449,7 @@ SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(voi
|
|
|
6014
6449
|
**
|
|
6015
6450
|
** Security Warning: These interfaces should not be exposed in scripting
|
|
6016
6451
|
** languages or in other circumstances where it might be possible for an
|
|
6017
|
-
**
|
|
6452
|
+
** attacker to invoke them. Any agent that can invoke these interfaces
|
|
6018
6453
|
** can probably also take control of the process.
|
|
6019
6454
|
**
|
|
6020
6455
|
** Database connection client data is only available for SQLite
|
|
@@ -6063,7 +6498,11 @@ typedef void (*sqlite3_destructor_type)(void*);
|
|
|
6063
6498
|
**
|
|
6064
6499
|
** ^The sqlite3_result_zeroblob(C,N) and sqlite3_result_zeroblob64(C,N)
|
|
6065
6500
|
** interfaces set the result of the application-defined function to be
|
|
6066
|
-
** a BLOB containing all zero bytes and N bytes in size.
|
|
6501
|
+
** a BLOB containing all zero bytes and N bytes in size. The
|
|
6502
|
+
** zeroblob64(C,N) interface returns a [result code], which is normally
|
|
6503
|
+
** [SQLITE_OK] but might be some other value if the requested operation
|
|
6504
|
+
** could not be complete, for example if insufficient memory is available
|
|
6505
|
+
** or if the value of N is out of range.
|
|
6067
6506
|
**
|
|
6068
6507
|
** ^The sqlite3_result_double() interface sets the result from
|
|
6069
6508
|
** an application-defined function to be a floating point value specified
|
|
@@ -6113,10 +6552,14 @@ typedef void (*sqlite3_destructor_type)(void*);
|
|
|
6113
6552
|
** set the return value of the application-defined function to be
|
|
6114
6553
|
** a text string which is represented as UTF-8, UTF-16 native byte order,
|
|
6115
6554
|
** UTF-16 little endian, or UTF-16 big endian, respectively.
|
|
6116
|
-
** ^The sqlite3_result_text64() interface sets the return value of an
|
|
6555
|
+
** ^The sqlite3_result_text64(C,Z,N,D,E) interface sets the return value of an
|
|
6117
6556
|
** application-defined function to be a text string in an encoding
|
|
6118
|
-
** specified
|
|
6119
|
-
** of [SQLITE_UTF8], [
|
|
6557
|
+
** specified the E parameter, which must be one
|
|
6558
|
+
** of [SQLITE_UTF8], [SQLITE_UTF8_ZT], [SQLITE_UTF16], [SQLITE_UTF16BE],
|
|
6559
|
+
** or [SQLITE_UTF16LE]. ^The special value [SQLITE_UTF8_ZT] means that
|
|
6560
|
+
** the result text is both UTF-8 and zero-terminated. In other words,
|
|
6561
|
+
** SQLITE_UTF8_ZT means that the Z array holds at least N+1 bytes and that
|
|
6562
|
+
** the Z[N] is zero.
|
|
6120
6563
|
** ^SQLite takes the text result from the application from
|
|
6121
6564
|
** the 2nd parameter of the sqlite3_result_text* interfaces.
|
|
6122
6565
|
** ^If the 3rd parameter to any of the sqlite3_result_text* interfaces
|
|
@@ -6128,7 +6571,7 @@ typedef void (*sqlite3_destructor_type)(void*);
|
|
|
6128
6571
|
** pointed to by the 2nd parameter are taken as the application-defined
|
|
6129
6572
|
** function result. If the 3rd parameter is non-negative, then it
|
|
6130
6573
|
** must be the byte offset into the string where the NUL terminator would
|
|
6131
|
-
** appear if the string
|
|
6574
|
+
** appear if the string were NUL terminated. If any NUL characters occur
|
|
6132
6575
|
** in the string at a byte offset that is less than the value of the 3rd
|
|
6133
6576
|
** parameter, then the resulting string will contain embedded NULs and the
|
|
6134
6577
|
** result of expressions operating on strings with embedded NULs is undefined.
|
|
@@ -6186,7 +6629,7 @@ typedef void (*sqlite3_destructor_type)(void*);
|
|
|
6186
6629
|
** string and preferably a string literal. The sqlite3_result_pointer()
|
|
6187
6630
|
** routine is part of the [pointer passing interface] added for SQLite 3.20.0.
|
|
6188
6631
|
**
|
|
6189
|
-
** If these routines are called from within
|
|
6632
|
+
** If these routines are called from within a different thread
|
|
6190
6633
|
** than the one containing the application-defined function that received
|
|
6191
6634
|
** the [sqlite3_context] pointer, the results are undefined.
|
|
6192
6635
|
*/
|
|
@@ -6203,7 +6646,7 @@ SQLITE_API void sqlite3_result_int(sqlite3_context*, int);
|
|
|
6203
6646
|
SQLITE_API void sqlite3_result_int64(sqlite3_context*, sqlite3_int64);
|
|
6204
6647
|
SQLITE_API void sqlite3_result_null(sqlite3_context*);
|
|
6205
6648
|
SQLITE_API void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*));
|
|
6206
|
-
SQLITE_API void sqlite3_result_text64(sqlite3_context*, const char
|
|
6649
|
+
SQLITE_API void sqlite3_result_text64(sqlite3_context*, const char *z, sqlite3_uint64 n,
|
|
6207
6650
|
void(*)(void*), unsigned char encoding);
|
|
6208
6651
|
SQLITE_API void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*));
|
|
6209
6652
|
SQLITE_API void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));
|
|
@@ -6592,7 +7035,7 @@ SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*);
|
|
|
6592
7035
|
** METHOD: sqlite3
|
|
6593
7036
|
**
|
|
6594
7037
|
** ^The sqlite3_db_name(D,N) interface returns a pointer to the schema name
|
|
6595
|
-
** for the N-th database on database connection D, or a NULL pointer
|
|
7038
|
+
** for the N-th database on database connection D, or a NULL pointer if N is
|
|
6596
7039
|
** out of range. An N value of 0 means the main database file. An N of 1 is
|
|
6597
7040
|
** the "temp" schema. Larger values of N correspond to various ATTACH-ed
|
|
6598
7041
|
** databases.
|
|
@@ -6687,7 +7130,7 @@ SQLITE_API int sqlite3_txn_state(sqlite3*,const char *zSchema);
|
|
|
6687
7130
|
** <dd>The SQLITE_TXN_READ state means that the database is currently
|
|
6688
7131
|
** in a read transaction. Content has been read from the database file
|
|
6689
7132
|
** but nothing in the database file has changed. The transaction state
|
|
6690
|
-
** will advanced to SQLITE_TXN_WRITE if any changes occur and there are
|
|
7133
|
+
** will be advanced to SQLITE_TXN_WRITE if any changes occur and there are
|
|
6691
7134
|
** no other conflicting concurrent write transactions. The transaction
|
|
6692
7135
|
** state will revert to SQLITE_TXN_NONE following a [ROLLBACK] or
|
|
6693
7136
|
** [COMMIT].</dd>
|
|
@@ -6696,7 +7139,7 @@ SQLITE_API int sqlite3_txn_state(sqlite3*,const char *zSchema);
|
|
|
6696
7139
|
** <dd>The SQLITE_TXN_WRITE state means that the database is currently
|
|
6697
7140
|
** in a write transaction. Content has been written to the database file
|
|
6698
7141
|
** but has not yet committed. The transaction state will change to
|
|
6699
|
-
**
|
|
7142
|
+
** SQLITE_TXN_NONE at the next [ROLLBACK] or [COMMIT].</dd>
|
|
6700
7143
|
*/
|
|
6701
7144
|
#define SQLITE_TXN_NONE 0
|
|
6702
7145
|
#define SQLITE_TXN_READ 1
|
|
@@ -6847,6 +7290,8 @@ SQLITE_API int sqlite3_autovacuum_pages(
|
|
|
6847
7290
|
**
|
|
6848
7291
|
** ^The second argument is a pointer to the function to invoke when a
|
|
6849
7292
|
** row is updated, inserted or deleted in a rowid table.
|
|
7293
|
+
** ^The update hook is disabled by invoking sqlite3_update_hook()
|
|
7294
|
+
** with a NULL pointer as the second parameter.
|
|
6850
7295
|
** ^The first argument to the callback is a copy of the third argument
|
|
6851
7296
|
** to sqlite3_update_hook().
|
|
6852
7297
|
** ^The second callback argument is one of [SQLITE_INSERT], [SQLITE_DELETE],
|
|
@@ -6868,6 +7313,12 @@ SQLITE_API int sqlite3_autovacuum_pages(
|
|
|
6868
7313
|
** The exceptions defined in this paragraph might change in a future
|
|
6869
7314
|
** release of SQLite.
|
|
6870
7315
|
**
|
|
7316
|
+
** Whether the update hook is invoked before or after the
|
|
7317
|
+
** corresponding change is currently unspecified and may differ
|
|
7318
|
+
** depending on the type of change. Do not rely on the order of the
|
|
7319
|
+
** hook call with regards to the final result of the operation which
|
|
7320
|
+
** triggers the hook.
|
|
7321
|
+
**
|
|
6871
7322
|
** The update hook implementation must not do anything that will modify
|
|
6872
7323
|
** the database connection that invoked the update hook. Any actions
|
|
6873
7324
|
** to modify the database connection must be deferred until after the
|
|
@@ -6969,7 +7420,7 @@ SQLITE_API int sqlite3_db_release_memory(sqlite3*);
|
|
|
6969
7420
|
** CAPI3REF: Impose A Limit On Heap Size
|
|
6970
7421
|
**
|
|
6971
7422
|
** These interfaces impose limits on the amount of heap memory that will be
|
|
6972
|
-
** by all database connections within a single process.
|
|
7423
|
+
** used by all database connections within a single process.
|
|
6973
7424
|
**
|
|
6974
7425
|
** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the
|
|
6975
7426
|
** soft limit on the amount of heap memory that may be allocated by SQLite.
|
|
@@ -7027,7 +7478,7 @@ SQLITE_API int sqlite3_db_release_memory(sqlite3*);
|
|
|
7027
7478
|
** </ul>)^
|
|
7028
7479
|
**
|
|
7029
7480
|
** The circumstances under which SQLite will enforce the heap limits may
|
|
7030
|
-
**
|
|
7481
|
+
** change in future releases of SQLite.
|
|
7031
7482
|
*/
|
|
7032
7483
|
SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N);
|
|
7033
7484
|
SQLITE_API sqlite3_int64 sqlite3_hard_heap_limit64(sqlite3_int64 N);
|
|
@@ -7134,7 +7585,7 @@ SQLITE_API int sqlite3_table_column_metadata(
|
|
|
7134
7585
|
** ^The sqlite3_load_extension() interface attempts to load an
|
|
7135
7586
|
** [SQLite extension] library contained in the file zFile. If
|
|
7136
7587
|
** the file cannot be loaded directly, attempts are made to load
|
|
7137
|
-
** with various operating-system specific extensions added.
|
|
7588
|
+
** with various operating-system specific filename extensions added.
|
|
7138
7589
|
** So for example, if "samplelib" cannot be loaded, then names like
|
|
7139
7590
|
** "samplelib.so" or "samplelib.dylib" or "samplelib.dll" might
|
|
7140
7591
|
** be tried also.
|
|
@@ -7142,10 +7593,10 @@ SQLITE_API int sqlite3_table_column_metadata(
|
|
|
7142
7593
|
** ^The entry point is zProc.
|
|
7143
7594
|
** ^(zProc may be 0, in which case SQLite will try to come up with an
|
|
7144
7595
|
** entry point name on its own. It first tries "sqlite3_extension_init".
|
|
7145
|
-
** If that does not work, it
|
|
7146
|
-
** X
|
|
7147
|
-
** characters
|
|
7148
|
-
** "." and omitting any initial "lib".)^
|
|
7596
|
+
** If that does not work, it tries names of the form "sqlite3_X_init"
|
|
7597
|
+
** where X consists of the lower-case equivalent of all ASCII alphabetic
|
|
7598
|
+
** characters or all ASCII alphanumeric characters in the filename from
|
|
7599
|
+
** the last "/" to the first following "." and omitting any initial "lib".)^
|
|
7149
7600
|
** ^The sqlite3_load_extension() interface returns
|
|
7150
7601
|
** [SQLITE_OK] on success and [SQLITE_ERROR] if something goes wrong.
|
|
7151
7602
|
** ^If an error occurs and pzErrMsg is not 0, then the
|
|
@@ -7214,12 +7665,12 @@ SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff);
|
|
|
7214
7665
|
** ^(Even though the function prototype shows that xEntryPoint() takes
|
|
7215
7666
|
** no arguments and returns void, SQLite invokes xEntryPoint() with three
|
|
7216
7667
|
** arguments and expects an integer result as if the signature of the
|
|
7217
|
-
** entry point
|
|
7668
|
+
** entry point were as follows:
|
|
7218
7669
|
**
|
|
7219
7670
|
** <blockquote><pre>
|
|
7220
7671
|
** int xEntryPoint(
|
|
7221
7672
|
** sqlite3 *db,
|
|
7222
|
-
**
|
|
7673
|
+
** char **pzErrMsg,
|
|
7223
7674
|
** const struct sqlite3_api_routines *pThunk
|
|
7224
7675
|
** );
|
|
7225
7676
|
** </pre></blockquote>)^
|
|
@@ -7378,7 +7829,7 @@ struct sqlite3_module {
|
|
|
7378
7829
|
** virtual table and might not be checked again by the byte code.)^ ^(The
|
|
7379
7830
|
** aConstraintUsage[].omit flag is an optimization hint. When the omit flag
|
|
7380
7831
|
** is left in its default setting of false, the constraint will always be
|
|
7381
|
-
** checked separately in byte code. If the omit flag is
|
|
7832
|
+
** checked separately in byte code. If the omit flag is changed to true, then
|
|
7382
7833
|
** the constraint may or may not be checked in byte code. In other words,
|
|
7383
7834
|
** when the omit flag is true there is no guarantee that the constraint will
|
|
7384
7835
|
** not be checked again using byte code.)^
|
|
@@ -7402,9 +7853,11 @@ struct sqlite3_module {
|
|
|
7402
7853
|
** will be returned by the strategy.
|
|
7403
7854
|
**
|
|
7404
7855
|
** The xBestIndex method may optionally populate the idxFlags field with a
|
|
7405
|
-
** mask of SQLITE_INDEX_SCAN_* flags.
|
|
7406
|
-
**
|
|
7407
|
-
**
|
|
7856
|
+
** mask of SQLITE_INDEX_SCAN_* flags. One such flag is
|
|
7857
|
+
** [SQLITE_INDEX_SCAN_HEX], which if set causes the [EXPLAIN QUERY PLAN]
|
|
7858
|
+
** output to show the idxNum as hex instead of as decimal. Another flag is
|
|
7859
|
+
** SQLITE_INDEX_SCAN_UNIQUE, which if set indicates that the query plan will
|
|
7860
|
+
** return at most one row.
|
|
7408
7861
|
**
|
|
7409
7862
|
** Additionally, if xBestIndex sets the SQLITE_INDEX_SCAN_UNIQUE flag, then
|
|
7410
7863
|
** SQLite also assumes that if a call to the xUpdate() method is made as
|
|
@@ -7468,7 +7921,9 @@ struct sqlite3_index_info {
|
|
|
7468
7921
|
** [sqlite3_index_info].idxFlags field to some combination of
|
|
7469
7922
|
** these bits.
|
|
7470
7923
|
*/
|
|
7471
|
-
#define SQLITE_INDEX_SCAN_UNIQUE
|
|
7924
|
+
#define SQLITE_INDEX_SCAN_UNIQUE 0x00000001 /* Scan visits at most 1 row */
|
|
7925
|
+
#define SQLITE_INDEX_SCAN_HEX 0x00000002 /* Display idxNum as hex */
|
|
7926
|
+
/* in EXPLAIN QUERY PLAN */
|
|
7472
7927
|
|
|
7473
7928
|
/*
|
|
7474
7929
|
** CAPI3REF: Virtual Table Constraint Operator Codes
|
|
@@ -7541,7 +7996,7 @@ struct sqlite3_index_info {
|
|
|
7541
7996
|
** the implementation of the [virtual table module]. ^The fourth
|
|
7542
7997
|
** parameter is an arbitrary client data pointer that is passed through
|
|
7543
7998
|
** into the [xCreate] and [xConnect] methods of the virtual table module
|
|
7544
|
-
** when a new virtual table is
|
|
7999
|
+
** when a new virtual table is being created or reinitialized.
|
|
7545
8000
|
**
|
|
7546
8001
|
** ^The sqlite3_create_module_v2() interface has a fifth parameter which
|
|
7547
8002
|
** is a pointer to a destructor for the pClientData. ^SQLite will
|
|
@@ -7706,7 +8161,7 @@ typedef struct sqlite3_blob sqlite3_blob;
|
|
|
7706
8161
|
** in *ppBlob. Otherwise an [error code] is returned and, unless the error
|
|
7707
8162
|
** code is SQLITE_MISUSE, *ppBlob is set to NULL.)^ ^This means that, provided
|
|
7708
8163
|
** the API is not misused, it is always safe to call [sqlite3_blob_close()]
|
|
7709
|
-
** on *ppBlob after this function
|
|
8164
|
+
** on *ppBlob after this function returns.
|
|
7710
8165
|
**
|
|
7711
8166
|
** This function fails with SQLITE_ERROR if any of the following are true:
|
|
7712
8167
|
** <ul>
|
|
@@ -7826,7 +8281,7 @@ SQLITE_API int sqlite3_blob_close(sqlite3_blob *);
|
|
|
7826
8281
|
**
|
|
7827
8282
|
** ^Returns the size in bytes of the BLOB accessible via the
|
|
7828
8283
|
** successfully opened [BLOB handle] in its only argument. ^The
|
|
7829
|
-
** incremental blob I/O routines can only read or
|
|
8284
|
+
** incremental blob I/O routines can only read or overwrite existing
|
|
7830
8285
|
** blob content; they cannot change the size of a blob.
|
|
7831
8286
|
**
|
|
7832
8287
|
** This routine only works on a [BLOB handle] which has been created
|
|
@@ -7965,18 +8420,11 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
|
|
|
7965
8420
|
** SQLITE_MUTEX_W32 implementations are appropriate for use on Unix
|
|
7966
8421
|
** and Windows.
|
|
7967
8422
|
**
|
|
7968
|
-
** If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor
|
|
7969
|
-
** macro defined (with "-DSQLITE_MUTEX_APPDEF=1"), then no mutex
|
|
7970
|
-
** implementation is included with the library. In this case the
|
|
7971
|
-
** application must supply a custom mutex implementation using the
|
|
7972
|
-
** [SQLITE_CONFIG_MUTEX] option of the sqlite3_config() function
|
|
7973
|
-
** before calling sqlite3_initialize() or any other public sqlite3_
|
|
7974
|
-
** function that calls sqlite3_initialize().
|
|
7975
8423
|
**
|
|
7976
8424
|
** ^The sqlite3_mutex_alloc() routine allocates a new
|
|
7977
8425
|
** mutex and returns a pointer to it. ^The sqlite3_mutex_alloc()
|
|
7978
8426
|
** routine returns NULL if it is unable to allocate the requested
|
|
7979
|
-
** mutex. The argument to sqlite3_mutex_alloc() must one of these
|
|
8427
|
+
** mutex. The argument to sqlite3_mutex_alloc() must be one of these
|
|
7980
8428
|
** integer constants:
|
|
7981
8429
|
**
|
|
7982
8430
|
** <ul>
|
|
@@ -8209,7 +8657,7 @@ SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*);
|
|
|
8209
8657
|
** CAPI3REF: Retrieve the mutex for a database connection
|
|
8210
8658
|
** METHOD: sqlite3
|
|
8211
8659
|
**
|
|
8212
|
-
** ^This interface returns a pointer the [sqlite3_mutex] object that
|
|
8660
|
+
** ^This interface returns a pointer to the [sqlite3_mutex] object that
|
|
8213
8661
|
** serializes access to the [database connection] given in the argument
|
|
8214
8662
|
** when the [threading mode] is Serialized.
|
|
8215
8663
|
** ^If the [threading mode] is Single-thread or Multi-thread then this
|
|
@@ -8305,6 +8753,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
|
|
|
8305
8753
|
#define SQLITE_TESTCTRL_JSON_SELFCHECK 14
|
|
8306
8754
|
#define SQLITE_TESTCTRL_OPTIMIZATIONS 15
|
|
8307
8755
|
#define SQLITE_TESTCTRL_ISKEYWORD 16 /* NOT USED */
|
|
8756
|
+
#define SQLITE_TESTCTRL_GETOPT 16
|
|
8308
8757
|
#define SQLITE_TESTCTRL_SCRATCHMALLOC 17 /* NOT USED */
|
|
8309
8758
|
#define SQLITE_TESTCTRL_INTERNAL_FUNCTIONS 17
|
|
8310
8759
|
#define SQLITE_TESTCTRL_LOCALTIME_FAULT 18
|
|
@@ -8324,21 +8773,22 @@ SQLITE_API int sqlite3_test_control(int op, ...);
|
|
|
8324
8773
|
#define SQLITE_TESTCTRL_TRACEFLAGS 31
|
|
8325
8774
|
#define SQLITE_TESTCTRL_TUNE 32
|
|
8326
8775
|
#define SQLITE_TESTCTRL_LOGEST 33
|
|
8327
|
-
#define SQLITE_TESTCTRL_USELONGDOUBLE 34
|
|
8776
|
+
#define SQLITE_TESTCTRL_USELONGDOUBLE 34 /* NOT USED */
|
|
8777
|
+
#define SQLITE_TESTCTRL_ATOF 34
|
|
8328
8778
|
#define SQLITE_TESTCTRL_LAST 34 /* Largest TESTCTRL */
|
|
8329
8779
|
|
|
8330
8780
|
/*
|
|
8331
8781
|
** CAPI3REF: SQL Keyword Checking
|
|
8332
8782
|
**
|
|
8333
8783
|
** These routines provide access to the set of SQL language keywords
|
|
8334
|
-
** recognized by SQLite. Applications can
|
|
8784
|
+
** recognized by SQLite. Applications can use these routines to determine
|
|
8335
8785
|
** whether or not a specific identifier needs to be escaped (for example,
|
|
8336
8786
|
** by enclosing in double-quotes) so as not to confuse the parser.
|
|
8337
8787
|
**
|
|
8338
8788
|
** The sqlite3_keyword_count() interface returns the number of distinct
|
|
8339
8789
|
** keywords understood by SQLite.
|
|
8340
8790
|
**
|
|
8341
|
-
** The sqlite3_keyword_name(N,Z,L) interface finds the N-th keyword and
|
|
8791
|
+
** The sqlite3_keyword_name(N,Z,L) interface finds the 0-based N-th keyword and
|
|
8342
8792
|
** makes *Z point to that keyword expressed as UTF8 and writes the number
|
|
8343
8793
|
** of bytes in the keyword into *L. The string that *Z points to is not
|
|
8344
8794
|
** zero-terminated. The sqlite3_keyword_name(N,Z,L) routine returns
|
|
@@ -8390,8 +8840,8 @@ SQLITE_API int sqlite3_keyword_check(const char*,int);
|
|
|
8390
8840
|
** <li> ^The sqlite3_str object is created using [sqlite3_str_new()].
|
|
8391
8841
|
** <li> ^Text is appended to the sqlite3_str object using various
|
|
8392
8842
|
** methods, such as [sqlite3_str_appendf()].
|
|
8393
|
-
** <li>
|
|
8394
|
-
** is returned using
|
|
8843
|
+
** <li> The sqlite3_str object is destroyed and the string it created
|
|
8844
|
+
** is returned using [sqlite3_str_finish()] or [sqlite3_result_str()].
|
|
8395
8845
|
** </ol>
|
|
8396
8846
|
*/
|
|
8397
8847
|
typedef struct sqlite3_str sqlite3_str;
|
|
@@ -8433,17 +8883,56 @@ SQLITE_API sqlite3_str *sqlite3_str_new(sqlite3*);
|
|
|
8433
8883
|
** pass the returned value to [sqlite3_free()] to avoid a memory leak.
|
|
8434
8884
|
** ^The [sqlite3_str_finish(X)] interface may return a NULL pointer if any
|
|
8435
8885
|
** errors were encountered during construction of the string. ^The
|
|
8436
|
-
** [sqlite3_str_finish(X)] interface
|
|
8886
|
+
** [sqlite3_str_finish(X)] interface might also return a NULL pointer if the
|
|
8437
8887
|
** string in [sqlite3_str] object X is zero bytes long.
|
|
8888
|
+
**
|
|
8889
|
+
** ^The [sqlite3_str_free(X)] interface destroys both the sqlite3_str object
|
|
8890
|
+
** X and the string content it contains. Calling sqlite3_str_free(X) is
|
|
8891
|
+
** the equivalent of calling [sqlite3_free](sqlite3_str_finish(X)).
|
|
8438
8892
|
*/
|
|
8439
8893
|
SQLITE_API char *sqlite3_str_finish(sqlite3_str*);
|
|
8894
|
+
SQLITE_API void sqlite3_str_free(sqlite3_str*);
|
|
8895
|
+
|
|
8896
|
+
/*
|
|
8897
|
+
** CAPI3REF: Return A Dynamic String From an SQL Function
|
|
8898
|
+
**
|
|
8899
|
+
** The [sqlite3_result_str(C,S,F)] interface causes the
|
|
8900
|
+
** [sqlite3_str|dynamic string] S to become the return value for the
|
|
8901
|
+
** application-defined function or virtual table that uses
|
|
8902
|
+
** [sqlite3_context] C. The F flag can be one of [SQLITE_COPY]
|
|
8903
|
+
** or [SQLITE_XFER] or [SQLITE_FINISH].
|
|
8904
|
+
**
|
|
8905
|
+
** If the dynamic string is invalid or incomplete due to an out-of-memory
|
|
8906
|
+
** or string-too-large error, then this routine transfers that error
|
|
8907
|
+
** over to the SQL function.
|
|
8908
|
+
**
|
|
8909
|
+
** If the F argument is SQLITE_COPY, then a copy of the dynamic string
|
|
8910
|
+
** content is made and the dynamic string object is unchanged.
|
|
8911
|
+
** If the F argument is SQLITE_XFER, then ownership of the content
|
|
8912
|
+
** in the dynamic is transferred to the SQL function (via a pointer copy
|
|
8913
|
+
** rather than a string copy) and the dynamic string is reset to an
|
|
8914
|
+
** empty string. The SQLITE_FINISH value for F works like SQLITE_RESET
|
|
8915
|
+
** except that it also invokes the [sqlite3_str_free(S)] destructor
|
|
8916
|
+
** on the dynamic string object.
|
|
8917
|
+
*/
|
|
8918
|
+
SQLITE_API void sqlite3_result_str(sqlite3_context*, sqlite3_str*, int);
|
|
8919
|
+
|
|
8920
|
+
/*
|
|
8921
|
+
** CAPI3REF: Control Flags For sqlite3_result_str()
|
|
8922
|
+
**
|
|
8923
|
+
** The following integers can be used as the third "F" argument
|
|
8924
|
+
** to [sqlite3_result_str(C,S,F)].
|
|
8925
|
+
*/
|
|
8926
|
+
#define SQLITE_COPY 0 /* Results copied. Dynamic string unchanged */
|
|
8927
|
+
#define SQLITE_XFER 1 /* Results transfered. Dynamic string reset */
|
|
8928
|
+
#define SQLITE_FINISH 2 /* Like SQLITE_XFER, plus dynamic string freed */
|
|
8440
8929
|
|
|
8441
8930
|
/*
|
|
8442
8931
|
** CAPI3REF: Add Content To A Dynamic String
|
|
8443
8932
|
** METHOD: sqlite3_str
|
|
8444
8933
|
**
|
|
8445
|
-
** These interfaces add content to an sqlite3_str object
|
|
8446
|
-
** from [sqlite3_str_new()].
|
|
8934
|
+
** These interfaces add or remove content to an sqlite3_str object
|
|
8935
|
+
** previously obtained from [sqlite3_str_new()].
|
|
8447
8936
|
**
|
|
8448
8937
|
** ^The [sqlite3_str_appendf(X,F,...)] and
|
|
8449
8938
|
** [sqlite3_str_vappendf(X,F,V)] interfaces uses the [built-in printf]
|
|
@@ -8466,6 +8955,10 @@ SQLITE_API char *sqlite3_str_finish(sqlite3_str*);
|
|
|
8466
8955
|
** ^The [sqlite3_str_reset(X)] method resets the string under construction
|
|
8467
8956
|
** inside [sqlite3_str] object X back to zero bytes in length.
|
|
8468
8957
|
**
|
|
8958
|
+
** ^The [sqlite3_str_truncate(X,N)] method changes the length of the string
|
|
8959
|
+
** under construction to be N bytes or less. This routine is a no-op if
|
|
8960
|
+
** N is negative or if the string is already N bytes or smaller in size.
|
|
8961
|
+
**
|
|
8469
8962
|
** These methods do not return a result code. ^If an error occurs, that fact
|
|
8470
8963
|
** is recorded in the [sqlite3_str] object and can be recovered by a
|
|
8471
8964
|
** subsequent call to [sqlite3_str_errcode(X)].
|
|
@@ -8476,6 +8969,7 @@ SQLITE_API void sqlite3_str_append(sqlite3_str*, const char *zIn, int N);
|
|
|
8476
8969
|
SQLITE_API void sqlite3_str_appendall(sqlite3_str*, const char *zIn);
|
|
8477
8970
|
SQLITE_API void sqlite3_str_appendchar(sqlite3_str*, int N, char C);
|
|
8478
8971
|
SQLITE_API void sqlite3_str_reset(sqlite3_str*);
|
|
8972
|
+
SQLITE_API void sqlite3_str_truncate(sqlite3_str*,int N);
|
|
8479
8973
|
|
|
8480
8974
|
/*
|
|
8481
8975
|
** CAPI3REF: Status Of A Dynamic String
|
|
@@ -8499,7 +8993,7 @@ SQLITE_API void sqlite3_str_reset(sqlite3_str*);
|
|
|
8499
8993
|
** content of the dynamic string under construction in X. The value
|
|
8500
8994
|
** returned by [sqlite3_str_value(X)] is managed by the sqlite3_str object X
|
|
8501
8995
|
** and might be freed or altered by any subsequent method on the same
|
|
8502
|
-
** [sqlite3_str] object. Applications must not
|
|
8996
|
+
** [sqlite3_str] object. Applications must not use the pointer returned by
|
|
8503
8997
|
** [sqlite3_str_value(X)] after any subsequent method call on the same
|
|
8504
8998
|
** object. ^Applications may change the content of the string returned
|
|
8505
8999
|
** by [sqlite3_str_value(X)] as long as they do not write into any bytes
|
|
@@ -8585,7 +9079,7 @@ SQLITE_API int sqlite3_status64(
|
|
|
8585
9079
|
** allocation which could not be satisfied by the [SQLITE_CONFIG_PAGECACHE]
|
|
8586
9080
|
** buffer and where forced to overflow to [sqlite3_malloc()]. The
|
|
8587
9081
|
** returned value includes allocations that overflowed because they
|
|
8588
|
-
**
|
|
9082
|
+
** were too large (they were larger than the "sz" parameter to
|
|
8589
9083
|
** [SQLITE_CONFIG_PAGECACHE]) and allocations that overflowed because
|
|
8590
9084
|
** no space was left in the page cache.</dd>)^
|
|
8591
9085
|
**
|
|
@@ -8644,9 +9138,18 @@ SQLITE_API int sqlite3_status64(
|
|
|
8644
9138
|
** ^The sqlite3_db_status() routine returns SQLITE_OK on success and a
|
|
8645
9139
|
** non-zero [error code] on failure.
|
|
8646
9140
|
**
|
|
9141
|
+
** ^The sqlite3_db_status64(D,O,C,H,R) routine works exactly the same
|
|
9142
|
+
** way as sqlite3_db_status(D,O,C,H,R) routine except that the C and H
|
|
9143
|
+
** parameters are pointer to 64-bit integers (type: sqlite3_int64) instead
|
|
9144
|
+
** of pointers to 32-bit integers, which allows larger status values
|
|
9145
|
+
** to be returned. If a status value exceeds 2,147,483,647 then
|
|
9146
|
+
** sqlite3_db_status() will truncate the value whereas sqlite3_db_status64()
|
|
9147
|
+
** will return the full value.
|
|
9148
|
+
**
|
|
8647
9149
|
** See also: [sqlite3_status()] and [sqlite3_stmt_status()].
|
|
8648
9150
|
*/
|
|
8649
9151
|
SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
|
|
9152
|
+
SQLITE_API int sqlite3_db_status64(sqlite3*,int,sqlite3_int64*,sqlite3_int64*,int);
|
|
8650
9153
|
|
|
8651
9154
|
/*
|
|
8652
9155
|
** CAPI3REF: Status Parameters for database connections
|
|
@@ -8669,28 +9172,29 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
|
|
|
8669
9172
|
** [[SQLITE_DBSTATUS_LOOKASIDE_HIT]] ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_HIT</dt>
|
|
8670
9173
|
** <dd>This parameter returns the number of malloc attempts that were
|
|
8671
9174
|
** satisfied using lookaside memory. Only the high-water value is meaningful;
|
|
8672
|
-
** the current value is always zero
|
|
9175
|
+
** the current value is always zero.</dd>)^
|
|
8673
9176
|
**
|
|
8674
9177
|
** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE]]
|
|
8675
9178
|
** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE</dt>
|
|
8676
|
-
** <dd>This parameter returns the number malloc attempts that might have
|
|
9179
|
+
** <dd>This parameter returns the number of malloc attempts that might have
|
|
8677
9180
|
** been satisfied using lookaside memory but failed due to the amount of
|
|
8678
9181
|
** memory requested being larger than the lookaside slot size.
|
|
8679
9182
|
** Only the high-water value is meaningful;
|
|
8680
|
-
** the current value is always zero
|
|
9183
|
+
** the current value is always zero.</dd>)^
|
|
8681
9184
|
**
|
|
8682
9185
|
** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL]]
|
|
8683
9186
|
** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL</dt>
|
|
8684
|
-
** <dd>This parameter returns the number malloc attempts that might have
|
|
9187
|
+
** <dd>This parameter returns the number of malloc attempts that might have
|
|
8685
9188
|
** been satisfied using lookaside memory but failed due to all lookaside
|
|
8686
9189
|
** memory already being in use.
|
|
8687
9190
|
** Only the high-water value is meaningful;
|
|
8688
|
-
** the current value is always zero
|
|
9191
|
+
** the current value is always zero.</dd>)^
|
|
8689
9192
|
**
|
|
8690
9193
|
** [[SQLITE_DBSTATUS_CACHE_USED]] ^(<dt>SQLITE_DBSTATUS_CACHE_USED</dt>
|
|
8691
9194
|
** <dd>This parameter returns the approximate number of bytes of heap
|
|
8692
9195
|
** memory used by all pager caches associated with the database connection.)^
|
|
8693
9196
|
** ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always 0.
|
|
9197
|
+
** </dd>
|
|
8694
9198
|
**
|
|
8695
9199
|
** [[SQLITE_DBSTATUS_CACHE_USED_SHARED]]
|
|
8696
9200
|
** ^(<dt>SQLITE_DBSTATUS_CACHE_USED_SHARED</dt>
|
|
@@ -8699,10 +9203,10 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
|
|
|
8699
9203
|
** memory used by that pager cache is divided evenly between the attached
|
|
8700
9204
|
** connections.)^ In other words, if none of the pager caches associated
|
|
8701
9205
|
** with the database connection are shared, this request returns the same
|
|
8702
|
-
** value as DBSTATUS_CACHE_USED. Or, if one or more
|
|
9206
|
+
** value as DBSTATUS_CACHE_USED. Or, if one or more of the pager caches are
|
|
8703
9207
|
** shared, the value returned by this call will be smaller than that returned
|
|
8704
9208
|
** by DBSTATUS_CACHE_USED. ^The highwater mark associated with
|
|
8705
|
-
** SQLITE_DBSTATUS_CACHE_USED_SHARED is always 0
|
|
9209
|
+
** SQLITE_DBSTATUS_CACHE_USED_SHARED is always 0.</dd>
|
|
8706
9210
|
**
|
|
8707
9211
|
** [[SQLITE_DBSTATUS_SCHEMA_USED]] ^(<dt>SQLITE_DBSTATUS_SCHEMA_USED</dt>
|
|
8708
9212
|
** <dd>This parameter returns the approximate number of bytes of heap
|
|
@@ -8712,6 +9216,7 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
|
|
|
8712
9216
|
** schema memory is shared with other database connections due to
|
|
8713
9217
|
** [shared cache mode] being enabled.
|
|
8714
9218
|
** ^The highwater mark associated with SQLITE_DBSTATUS_SCHEMA_USED is always 0.
|
|
9219
|
+
** </dd>
|
|
8715
9220
|
**
|
|
8716
9221
|
** [[SQLITE_DBSTATUS_STMT_USED]] ^(<dt>SQLITE_DBSTATUS_STMT_USED</dt>
|
|
8717
9222
|
** <dd>This parameter returns the approximate number of bytes of heap
|
|
@@ -8741,6 +9246,10 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
|
|
|
8741
9246
|
** If an IO or other error occurs while writing a page to disk, the effect
|
|
8742
9247
|
** on subsequent SQLITE_DBSTATUS_CACHE_WRITE requests is undefined.)^ ^The
|
|
8743
9248
|
** highwater mark associated with SQLITE_DBSTATUS_CACHE_WRITE is always 0.
|
|
9249
|
+
** <p>
|
|
9250
|
+
** ^(There is overlap between the quantities measured by this parameter
|
|
9251
|
+
** (SQLITE_DBSTATUS_CACHE_WRITE) and SQLITE_DBSTATUS_TEMPBUF_SPILL.
|
|
9252
|
+
** Resetting one will reduce the other.)^
|
|
8744
9253
|
** </dd>
|
|
8745
9254
|
**
|
|
8746
9255
|
** [[SQLITE_DBSTATUS_CACHE_SPILL]] ^(<dt>SQLITE_DBSTATUS_CACHE_SPILL</dt>
|
|
@@ -8748,7 +9257,7 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
|
|
|
8748
9257
|
** been written to disk in the middle of a transaction due to the page
|
|
8749
9258
|
** cache overflowing. Transactions are more efficient if they are written
|
|
8750
9259
|
** to disk all at once. When pages spill mid-transaction, that introduces
|
|
8751
|
-
** additional overhead. This parameter can be used help identify
|
|
9260
|
+
** additional overhead. This parameter can be used to help identify
|
|
8752
9261
|
** inefficiencies that can be resolved by increasing the cache size.
|
|
8753
9262
|
** </dd>
|
|
8754
9263
|
**
|
|
@@ -8756,6 +9265,18 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
|
|
|
8756
9265
|
** <dd>This parameter returns zero for the current value if and only if
|
|
8757
9266
|
** all foreign key constraints (deferred or immediate) have been
|
|
8758
9267
|
** resolved.)^ ^The highwater mark is always 0.
|
|
9268
|
+
**
|
|
9269
|
+
** [[SQLITE_DBSTATUS_TEMPBUF_SPILL] ^(<dt>SQLITE_DBSTATUS_TEMPBUF_SPILL</dt>
|
|
9270
|
+
** <dd>^(This parameter returns the number of bytes written to temporary
|
|
9271
|
+
** files on disk that could have been kept in memory had sufficient memory
|
|
9272
|
+
** been available. This value includes writes to intermediate tables that
|
|
9273
|
+
** are part of complex queries, external sorts that spill to disk, and
|
|
9274
|
+
** writes to TEMP tables.)^
|
|
9275
|
+
** ^The highwater mark is always 0.
|
|
9276
|
+
** <p>
|
|
9277
|
+
** ^(There is overlap between the quantities measured by this parameter
|
|
9278
|
+
** (SQLITE_DBSTATUS_TEMPBUF_SPILL) and SQLITE_DBSTATUS_CACHE_WRITE.
|
|
9279
|
+
** Resetting one will reduce the other.)^
|
|
8759
9280
|
** </dd>
|
|
8760
9281
|
** </dl>
|
|
8761
9282
|
*/
|
|
@@ -8772,7 +9293,8 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
|
|
|
8772
9293
|
#define SQLITE_DBSTATUS_DEFERRED_FKS 10
|
|
8773
9294
|
#define SQLITE_DBSTATUS_CACHE_USED_SHARED 11
|
|
8774
9295
|
#define SQLITE_DBSTATUS_CACHE_SPILL 12
|
|
8775
|
-
#define
|
|
9296
|
+
#define SQLITE_DBSTATUS_TEMPBUF_SPILL 13
|
|
9297
|
+
#define SQLITE_DBSTATUS_MAX 13 /* Largest defined DBSTATUS */
|
|
8776
9298
|
|
|
8777
9299
|
|
|
8778
9300
|
/*
|
|
@@ -8819,13 +9341,13 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
|
|
|
8819
9341
|
** [[SQLITE_STMTSTATUS_SORT]] <dt>SQLITE_STMTSTATUS_SORT</dt>
|
|
8820
9342
|
** <dd>^This is the number of sort operations that have occurred.
|
|
8821
9343
|
** A non-zero value in this counter may indicate an opportunity to
|
|
8822
|
-
**
|
|
9344
|
+
** improve performance through careful use of indices.</dd>
|
|
8823
9345
|
**
|
|
8824
9346
|
** [[SQLITE_STMTSTATUS_AUTOINDEX]] <dt>SQLITE_STMTSTATUS_AUTOINDEX</dt>
|
|
8825
9347
|
** <dd>^This is the number of rows inserted into transient indices that
|
|
8826
9348
|
** were created automatically in order to help joins run faster.
|
|
8827
9349
|
** A non-zero value in this counter may indicate an opportunity to
|
|
8828
|
-
**
|
|
9350
|
+
** improve performance by adding permanent indices that do not
|
|
8829
9351
|
** need to be reinitialized each time the statement is run.</dd>
|
|
8830
9352
|
**
|
|
8831
9353
|
** [[SQLITE_STMTSTATUS_VM_STEP]] <dt>SQLITE_STMTSTATUS_VM_STEP</dt>
|
|
@@ -8834,19 +9356,19 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
|
|
|
8834
9356
|
** to 2147483647. The number of virtual machine operations can be
|
|
8835
9357
|
** used as a proxy for the total work done by the prepared statement.
|
|
8836
9358
|
** If the number of virtual machine operations exceeds 2147483647
|
|
8837
|
-
** then the value returned by this statement status code is undefined
|
|
9359
|
+
** then the value returned by this statement status code is undefined.</dd>
|
|
8838
9360
|
**
|
|
8839
9361
|
** [[SQLITE_STMTSTATUS_REPREPARE]] <dt>SQLITE_STMTSTATUS_REPREPARE</dt>
|
|
8840
9362
|
** <dd>^This is the number of times that the prepare statement has been
|
|
8841
9363
|
** automatically regenerated due to schema changes or changes to
|
|
8842
|
-
** [bound parameters] that might affect the query plan
|
|
9364
|
+
** [bound parameters] that might affect the query plan.</dd>
|
|
8843
9365
|
**
|
|
8844
9366
|
** [[SQLITE_STMTSTATUS_RUN]] <dt>SQLITE_STMTSTATUS_RUN</dt>
|
|
8845
9367
|
** <dd>^This is the number of times that the prepared statement has
|
|
8846
9368
|
** been run. A single "run" for the purposes of this counter is one
|
|
8847
9369
|
** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()].
|
|
8848
9370
|
** The counter is incremented on the first [sqlite3_step()] call of each
|
|
8849
|
-
** cycle
|
|
9371
|
+
** cycle.</dd>
|
|
8850
9372
|
**
|
|
8851
9373
|
** [[SQLITE_STMTSTATUS_FILTER_MISS]]
|
|
8852
9374
|
** [[SQLITE_STMTSTATUS_FILTER HIT]]
|
|
@@ -8856,7 +9378,7 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
|
|
|
8856
9378
|
** step was bypassed because a Bloom filter returned not-found. The
|
|
8857
9379
|
** corresponding SQLITE_STMTSTATUS_FILTER_MISS value is the number of
|
|
8858
9380
|
** times that the Bloom filter returned a find, and thus the join step
|
|
8859
|
-
** had to be processed as normal
|
|
9381
|
+
** had to be processed as normal.</dd>
|
|
8860
9382
|
**
|
|
8861
9383
|
** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt>
|
|
8862
9384
|
** <dd>^This is the approximate number of bytes of heap memory
|
|
@@ -8961,9 +9483,9 @@ struct sqlite3_pcache_page {
|
|
|
8961
9483
|
** SQLite will typically create one cache instance for each open database file,
|
|
8962
9484
|
** though this is not guaranteed. ^The
|
|
8963
9485
|
** first parameter, szPage, is the size in bytes of the pages that must
|
|
8964
|
-
** be allocated by the cache. ^szPage will always a power of two. ^The
|
|
9486
|
+
** be allocated by the cache. ^szPage will always be a power of two. ^The
|
|
8965
9487
|
** second parameter szExtra is a number of bytes of extra storage
|
|
8966
|
-
** associated with each page cache entry. ^The szExtra parameter will
|
|
9488
|
+
** associated with each page cache entry. ^The szExtra parameter will be
|
|
8967
9489
|
** a number less than 250. SQLite will use the
|
|
8968
9490
|
** extra szExtra bytes on each page to store metadata about the underlying
|
|
8969
9491
|
** database page on disk. The value passed into szExtra depends
|
|
@@ -8971,17 +9493,17 @@ struct sqlite3_pcache_page {
|
|
|
8971
9493
|
** ^The third argument to xCreate(), bPurgeable, is true if the cache being
|
|
8972
9494
|
** created will be used to cache database pages of a file stored on disk, or
|
|
8973
9495
|
** false if it is used for an in-memory database. The cache implementation
|
|
8974
|
-
** does not have to do anything special based
|
|
9496
|
+
** does not have to do anything special based upon the value of bPurgeable;
|
|
8975
9497
|
** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will
|
|
8976
9498
|
** never invoke xUnpin() except to deliberately delete a page.
|
|
8977
9499
|
** ^In other words, calls to xUnpin() on a cache with bPurgeable set to
|
|
8978
9500
|
** false will always have the "discard" flag set to true.
|
|
8979
|
-
** ^Hence, a cache created with bPurgeable false will
|
|
9501
|
+
** ^Hence, a cache created with bPurgeable set to false will
|
|
8980
9502
|
** never contain any unpinned pages.
|
|
8981
9503
|
**
|
|
8982
9504
|
** [[the xCachesize() page cache method]]
|
|
8983
9505
|
** ^(The xCachesize() method may be called at any time by SQLite to set the
|
|
8984
|
-
** suggested maximum cache-size (number of pages stored
|
|
9506
|
+
** suggested maximum cache-size (number of pages stored) for the cache
|
|
8985
9507
|
** instance passed as the first argument. This is the value configured using
|
|
8986
9508
|
** the SQLite "[PRAGMA cache_size]" command.)^ As with the bPurgeable
|
|
8987
9509
|
** parameter, the implementation is not required to do anything with this
|
|
@@ -9008,12 +9530,12 @@ struct sqlite3_pcache_page {
|
|
|
9008
9530
|
** implementation must return a pointer to the page buffer with its content
|
|
9009
9531
|
** intact. If the requested page is not already in the cache, then the
|
|
9010
9532
|
** cache implementation should use the value of the createFlag
|
|
9011
|
-
** parameter to help it
|
|
9533
|
+
** parameter to help it determine what action to take:
|
|
9012
9534
|
**
|
|
9013
9535
|
** <table border=1 width=85% align=center>
|
|
9014
9536
|
** <tr><th> createFlag <th> Behavior when page is not already in cache
|
|
9015
9537
|
** <tr><td> 0 <td> Do not allocate a new page. Return NULL.
|
|
9016
|
-
** <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so.
|
|
9538
|
+
** <tr><td> 1 <td> Allocate a new page if it is easy and convenient to do so.
|
|
9017
9539
|
** Otherwise return NULL.
|
|
9018
9540
|
** <tr><td> 2 <td> Make every effort to allocate a new page. Only return
|
|
9019
9541
|
** NULL if allocating a new page is effectively impossible.
|
|
@@ -9030,7 +9552,7 @@ struct sqlite3_pcache_page {
|
|
|
9030
9552
|
** as its second argument. If the third parameter, discard, is non-zero,
|
|
9031
9553
|
** then the page must be evicted from the cache.
|
|
9032
9554
|
** ^If the discard parameter is
|
|
9033
|
-
** zero, then the page may be discarded or retained at the discretion of
|
|
9555
|
+
** zero, then the page may be discarded or retained at the discretion of the
|
|
9034
9556
|
** page cache implementation. ^The page cache implementation
|
|
9035
9557
|
** may choose to evict unpinned pages at any time.
|
|
9036
9558
|
**
|
|
@@ -9048,7 +9570,7 @@ struct sqlite3_pcache_page {
|
|
|
9048
9570
|
** When SQLite calls the xTruncate() method, the cache must discard all
|
|
9049
9571
|
** existing cache entries with page numbers (keys) greater than or equal
|
|
9050
9572
|
** to the value of the iLimit parameter passed to xTruncate(). If any
|
|
9051
|
-
** of these pages are pinned, they
|
|
9573
|
+
** of these pages are pinned, they become implicitly unpinned, meaning that
|
|
9052
9574
|
** they can be safely discarded.
|
|
9053
9575
|
**
|
|
9054
9576
|
** [[the xDestroy() page cache method]]
|
|
@@ -9228,7 +9750,7 @@ typedef struct sqlite3_backup sqlite3_backup;
|
|
|
9228
9750
|
** external process or via a database connection other than the one being
|
|
9229
9751
|
** used by the backup operation, then the backup will be automatically
|
|
9230
9752
|
** restarted by the next call to sqlite3_backup_step(). ^If the source
|
|
9231
|
-
** database is modified by
|
|
9753
|
+
** database is modified by using the same database connection as is used
|
|
9232
9754
|
** by the backup operation, then the backup database is automatically
|
|
9233
9755
|
** updated at the same time.
|
|
9234
9756
|
**
|
|
@@ -9245,7 +9767,7 @@ typedef struct sqlite3_backup sqlite3_backup;
|
|
|
9245
9767
|
** and may not be used following a call to sqlite3_backup_finish().
|
|
9246
9768
|
**
|
|
9247
9769
|
** ^The value returned by sqlite3_backup_finish is [SQLITE_OK] if no
|
|
9248
|
-
** sqlite3_backup_step() errors occurred, regardless
|
|
9770
|
+
** sqlite3_backup_step() errors occurred, regardless of whether or not
|
|
9249
9771
|
** sqlite3_backup_step() completed.
|
|
9250
9772
|
** ^If an out-of-memory condition or IO error occurred during any prior
|
|
9251
9773
|
** sqlite3_backup_step() call on the same [sqlite3_backup] object, then
|
|
@@ -9300,6 +9822,16 @@ typedef struct sqlite3_backup sqlite3_backup;
|
|
|
9300
9822
|
** APIs are not strictly speaking threadsafe. If they are invoked at the
|
|
9301
9823
|
** same time as another thread is invoking sqlite3_backup_step() it is
|
|
9302
9824
|
** possible that they return invalid values.
|
|
9825
|
+
**
|
|
9826
|
+
** <b>Alternatives To Using The Backup API</b>
|
|
9827
|
+
**
|
|
9828
|
+
** Other techniques for safely creating a consistent backup of an SQLite
|
|
9829
|
+
** database include:
|
|
9830
|
+
**
|
|
9831
|
+
** <ul>
|
|
9832
|
+
** <li> The [VACUUM INTO] command.
|
|
9833
|
+
** <li> The [sqlite3_rsync] utility program.
|
|
9834
|
+
** </ul>
|
|
9303
9835
|
*/
|
|
9304
9836
|
SQLITE_API sqlite3_backup *sqlite3_backup_init(
|
|
9305
9837
|
sqlite3 *pDest, /* Destination database handle */
|
|
@@ -9337,7 +9869,7 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p);
|
|
|
9337
9869
|
** application receives an SQLITE_LOCKED error, it may call the
|
|
9338
9870
|
** sqlite3_unlock_notify() method with the blocked connection handle as
|
|
9339
9871
|
** the first argument to register for a callback that will be invoked
|
|
9340
|
-
** when the blocking
|
|
9872
|
+
** when the blocking connection's current transaction is concluded. ^The
|
|
9341
9873
|
** callback is invoked from within the [sqlite3_step] or [sqlite3_close]
|
|
9342
9874
|
** call that concludes the blocking connection's transaction.
|
|
9343
9875
|
**
|
|
@@ -9357,7 +9889,7 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p);
|
|
|
9357
9889
|
** blocked connection already has a registered unlock-notify callback,
|
|
9358
9890
|
** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is
|
|
9359
9891
|
** called with a NULL pointer as its second argument, then any existing
|
|
9360
|
-
** unlock-notify callback is canceled. ^The blocked
|
|
9892
|
+
** unlock-notify callback is canceled. ^The blocked connection's
|
|
9361
9893
|
** unlock-notify callback may also be canceled by closing the blocked
|
|
9362
9894
|
** connection using [sqlite3_close()].
|
|
9363
9895
|
**
|
|
@@ -9527,7 +10059,7 @@ SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);
|
|
|
9527
10059
|
** is the number of pages currently in the write-ahead log file,
|
|
9528
10060
|
** including those that were just committed.
|
|
9529
10061
|
**
|
|
9530
|
-
** The callback function should normally return [SQLITE_OK]. ^If an error
|
|
10062
|
+
** ^The callback function should normally return [SQLITE_OK]. ^If an error
|
|
9531
10063
|
** code is returned, that error will propagate back up through the
|
|
9532
10064
|
** SQLite code base to cause the statement that provoked the callback
|
|
9533
10065
|
** to report an error, though the commit will have still occurred. If the
|
|
@@ -9535,13 +10067,26 @@ SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);
|
|
|
9535
10067
|
** that does not correspond to any valid SQLite error code, the results
|
|
9536
10068
|
** are undefined.
|
|
9537
10069
|
**
|
|
9538
|
-
** A single database handle may have at most a single write-ahead log
|
|
9539
|
-
** registered at one time. ^Calling [sqlite3_wal_hook()]
|
|
9540
|
-
** previously registered write-ahead
|
|
9541
|
-
**
|
|
9542
|
-
**
|
|
9543
|
-
**
|
|
9544
|
-
**
|
|
10070
|
+
** ^A single database handle may have at most a single write-ahead log
|
|
10071
|
+
** callback registered at one time. ^Calling [sqlite3_wal_hook()]
|
|
10072
|
+
** replaces the default behavior or previously registered write-ahead
|
|
10073
|
+
** log callback.
|
|
10074
|
+
**
|
|
10075
|
+
** ^The return value is a copy of the third parameter from the
|
|
10076
|
+
** previous call, if any, or 0.
|
|
10077
|
+
**
|
|
10078
|
+
** ^The [sqlite3_wal_autocheckpoint()] interface and the
|
|
10079
|
+
** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and
|
|
10080
|
+
** will overwrite any prior [sqlite3_wal_hook()] settings.
|
|
10081
|
+
**
|
|
10082
|
+
** ^If a write-ahead log callback is set using this function then
|
|
10083
|
+
** [sqlite3_wal_checkpoint_v2()] or [PRAGMA wal_checkpoint]
|
|
10084
|
+
** should be invoked periodically to keep the write-ahead log file
|
|
10085
|
+
** from growing without bound.
|
|
10086
|
+
**
|
|
10087
|
+
** ^Passing a NULL pointer for the callback disables automatic
|
|
10088
|
+
** checkpointing entirely. To re-enable the default behavior, call
|
|
10089
|
+
** sqlite3_wal_autocheckpoint(db,1000) or use [PRAGMA wal_checkpoint].
|
|
9545
10090
|
*/
|
|
9546
10091
|
SQLITE_API void *sqlite3_wal_hook(
|
|
9547
10092
|
sqlite3*,
|
|
@@ -9558,7 +10103,7 @@ SQLITE_API void *sqlite3_wal_hook(
|
|
|
9558
10103
|
** to automatically [checkpoint]
|
|
9559
10104
|
** after committing a transaction if there are N or
|
|
9560
10105
|
** more frames in the [write-ahead log] file. ^Passing zero or
|
|
9561
|
-
** a negative value as the
|
|
10106
|
+
** a negative value as the N parameter disables automatic
|
|
9562
10107
|
** checkpoints entirely.
|
|
9563
10108
|
**
|
|
9564
10109
|
** ^The callback registered by this function replaces any existing callback
|
|
@@ -9574,9 +10119,10 @@ SQLITE_API void *sqlite3_wal_hook(
|
|
|
9574
10119
|
**
|
|
9575
10120
|
** ^Every new [database connection] defaults to having the auto-checkpoint
|
|
9576
10121
|
** enabled with a threshold of 1000 or [SQLITE_DEFAULT_WAL_AUTOCHECKPOINT]
|
|
9577
|
-
** pages.
|
|
9578
|
-
**
|
|
9579
|
-
**
|
|
10122
|
+
** pages.
|
|
10123
|
+
**
|
|
10124
|
+
** ^The use of this interface is only necessary if the default setting
|
|
10125
|
+
** is found to be suboptimal for a particular application.
|
|
9580
10126
|
*/
|
|
9581
10127
|
SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
|
|
9582
10128
|
|
|
@@ -9641,6 +10187,11 @@ SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
|
|
|
9641
10187
|
** ^This mode works the same way as SQLITE_CHECKPOINT_RESTART with the
|
|
9642
10188
|
** addition that it also truncates the log file to zero bytes just prior
|
|
9643
10189
|
** to a successful return.
|
|
10190
|
+
**
|
|
10191
|
+
** <dt>SQLITE_CHECKPOINT_NOOP<dd>
|
|
10192
|
+
** ^This mode always checkpoints zero frames. The only reason to invoke
|
|
10193
|
+
** a NOOP checkpoint is to access the values returned by
|
|
10194
|
+
** sqlite3_wal_checkpoint_v2() via output parameters *pnLog and *pnCkpt.
|
|
9644
10195
|
** </dl>
|
|
9645
10196
|
**
|
|
9646
10197
|
** ^If pnLog is not NULL, then *pnLog is set to the total number of frames in
|
|
@@ -9711,6 +10262,7 @@ SQLITE_API int sqlite3_wal_checkpoint_v2(
|
|
|
9711
10262
|
** See the [sqlite3_wal_checkpoint_v2()] documentation for details on the
|
|
9712
10263
|
** meaning of each of these checkpoint modes.
|
|
9713
10264
|
*/
|
|
10265
|
+
#define SQLITE_CHECKPOINT_NOOP -1 /* Do no work at all */
|
|
9714
10266
|
#define SQLITE_CHECKPOINT_PASSIVE 0 /* Do as much as possible w/o blocking */
|
|
9715
10267
|
#define SQLITE_CHECKPOINT_FULL 1 /* Wait for writers, then checkpoint */
|
|
9716
10268
|
#define SQLITE_CHECKPOINT_RESTART 2 /* Like FULL but wait for readers */
|
|
@@ -9755,7 +10307,7 @@ SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);
|
|
|
9755
10307
|
** support constraints. In this configuration (which is the default) if
|
|
9756
10308
|
** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire
|
|
9757
10309
|
** statement is rolled back as if [ON CONFLICT | OR ABORT] had been
|
|
9758
|
-
** specified as part of the
|
|
10310
|
+
** specified as part of the user's SQL statement, regardless of the actual
|
|
9759
10311
|
** ON CONFLICT mode specified.
|
|
9760
10312
|
**
|
|
9761
10313
|
** If X is non-zero, then the virtual table implementation guarantees
|
|
@@ -9789,7 +10341,7 @@ SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);
|
|
|
9789
10341
|
** [[SQLITE_VTAB_INNOCUOUS]]<dt>SQLITE_VTAB_INNOCUOUS</dt>
|
|
9790
10342
|
** <dd>Calls of the form
|
|
9791
10343
|
** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the
|
|
9792
|
-
**
|
|
10344
|
+
** [xConnect] or [xCreate] methods of a [virtual table] implementation
|
|
9793
10345
|
** identify that virtual table as being safe to use from within triggers
|
|
9794
10346
|
** and views. Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the
|
|
9795
10347
|
** virtual table can do no serious harm even if it is controlled by a
|
|
@@ -9917,27 +10469,49 @@ SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
|
|
|
9917
10469
|
** <li value="2"><p>
|
|
9918
10470
|
** ^(If the sqlite3_vtab_distinct() interface returns 2, that means
|
|
9919
10471
|
** that the query planner does not need the rows returned in any particular
|
|
9920
|
-
** order, as long as rows with the same values in all
|
|
9921
|
-
** are adjacent.)^ ^(Furthermore,
|
|
9922
|
-
**
|
|
9923
|
-
**
|
|
9924
|
-
**
|
|
9925
|
-
**
|
|
9926
|
-
**
|
|
9927
|
-
** ^However omitting the extra rows is optional.
|
|
10472
|
+
** order, as long as rows with the same values in all columns identified
|
|
10473
|
+
** by "aOrderBy" are adjacent.)^ ^(Furthermore, when two or more rows
|
|
10474
|
+
** contain the same values for all columns identified by "colUsed", all but
|
|
10475
|
+
** one such row may optionally be omitted from the result.)^
|
|
10476
|
+
** The virtual table is not required to omit rows that are duplicates
|
|
10477
|
+
** over the "colUsed" columns, but if the virtual table can do that without
|
|
10478
|
+
** too much extra effort, it could potentially help the query to run faster.
|
|
9928
10479
|
** This mode is used for a DISTINCT query.
|
|
9929
10480
|
** <li value="3"><p>
|
|
9930
|
-
** ^(If the sqlite3_vtab_distinct() interface returns 3, that means
|
|
9931
|
-
**
|
|
9932
|
-
**
|
|
9933
|
-
**
|
|
9934
|
-
**
|
|
10481
|
+
** ^(If the sqlite3_vtab_distinct() interface returns 3, that means the
|
|
10482
|
+
** virtual table must return rows in the order defined by "aOrderBy" as
|
|
10483
|
+
** if the sqlite3_vtab_distinct() interface had returned 0. However if
|
|
10484
|
+
** two or more rows in the result have the same values for all columns
|
|
10485
|
+
** identified by "colUsed", then all but one such row may optionally be
|
|
10486
|
+
** omitted.)^ Like when the return value is 2, the virtual table
|
|
10487
|
+
** is not required to omit rows that are duplicates over the "colUsed"
|
|
10488
|
+
** columns, but if the virtual table can do that without
|
|
10489
|
+
** too much extra effort, it could potentially help the query to run faster.
|
|
10490
|
+
** This mode is used for queries
|
|
9935
10491
|
** that have both DISTINCT and ORDER BY clauses.
|
|
9936
10492
|
** </ol>
|
|
9937
10493
|
**
|
|
10494
|
+
** <p>The following table summarizes the conditions under which the
|
|
10495
|
+
** virtual table is allowed to set the "orderByConsumed" flag based on
|
|
10496
|
+
** the value returned by sqlite3_vtab_distinct(). This table is a
|
|
10497
|
+
** restatement of the previous four paragraphs:
|
|
10498
|
+
**
|
|
10499
|
+
** <table border=1 cellspacing=0 cellpadding=10 width="90%">
|
|
10500
|
+
** <tr>
|
|
10501
|
+
** <td valign="top">sqlite3_vtab_distinct() return value
|
|
10502
|
+
** <td valign="top">Rows are returned in aOrderBy order
|
|
10503
|
+
** <td valign="top">Rows with the same value in all aOrderBy columns are
|
|
10504
|
+
** adjacent
|
|
10505
|
+
** <td valign="top">Duplicates over all colUsed columns may be omitted
|
|
10506
|
+
** <tr><td>0<td>yes<td>yes<td>no
|
|
10507
|
+
** <tr><td>1<td>no<td>yes<td>no
|
|
10508
|
+
** <tr><td>2<td>no<td>yes<td>yes
|
|
10509
|
+
** <tr><td>3<td>yes<td>yes<td>yes
|
|
10510
|
+
** </table>
|
|
10511
|
+
**
|
|
9938
10512
|
** ^For the purposes of comparing virtual table output values to see if the
|
|
9939
|
-
** values are same value for sorting purposes, two NULL values are
|
|
9940
|
-
** to be the same. In other words, the comparison operator is "IS"
|
|
10513
|
+
** values are the same value for sorting purposes, two NULL values are
|
|
10514
|
+
** considered to be the same. In other words, the comparison operator is "IS"
|
|
9941
10515
|
** (or "IS NOT DISTINCT FROM") and not "==".
|
|
9942
10516
|
**
|
|
9943
10517
|
** If a virtual table implementation is unable to meet the requirements
|
|
@@ -9946,7 +10520,7 @@ SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
|
|
|
9946
10520
|
**
|
|
9947
10521
|
** ^A virtual table implementation is always free to return rows in any order
|
|
9948
10522
|
** it wants, as long as the "orderByConsumed" flag is not set. ^When the
|
|
9949
|
-
**
|
|
10523
|
+
** "orderByConsumed" flag is unset, the query planner will add extra
|
|
9950
10524
|
** [bytecode] to ensure that the final results returned by the SQL query are
|
|
9951
10525
|
** ordered correctly. The use of the "orderByConsumed" flag and the
|
|
9952
10526
|
** sqlite3_vtab_distinct() interface is merely an optimization. ^Careful
|
|
@@ -10043,7 +10617,7 @@ SQLITE_API int sqlite3_vtab_in(sqlite3_index_info*, int iCons, int bHandle);
|
|
|
10043
10617
|
** sqlite3_vtab_in_next(X,P) should be one of the parameters to the
|
|
10044
10618
|
** xFilter method which invokes these routines, and specifically
|
|
10045
10619
|
** a parameter that was previously selected for all-at-once IN constraint
|
|
10046
|
-
** processing
|
|
10620
|
+
** processing using the [sqlite3_vtab_in()] interface in the
|
|
10047
10621
|
** [xBestIndex|xBestIndex method]. ^(If the X parameter is not
|
|
10048
10622
|
** an xFilter argument that was selected for all-at-once IN constraint
|
|
10049
10623
|
** processing, then these routines return [SQLITE_ERROR].)^
|
|
@@ -10058,7 +10632,7 @@ SQLITE_API int sqlite3_vtab_in(sqlite3_index_info*, int iCons, int bHandle);
|
|
|
10058
10632
|
** ){
|
|
10059
10633
|
** // do something with pVal
|
|
10060
10634
|
** }
|
|
10061
|
-
** if( rc!=
|
|
10635
|
+
** if( rc!=SQLITE_DONE ){
|
|
10062
10636
|
** // an error has occurred
|
|
10063
10637
|
** }
|
|
10064
10638
|
** </pre></blockquote>)^
|
|
@@ -10098,7 +10672,7 @@ SQLITE_API int sqlite3_vtab_in_next(sqlite3_value *pVal, sqlite3_value **ppOut);
|
|
|
10098
10672
|
** and only if *V is set to a value. ^The sqlite3_vtab_rhs_value(P,J,V)
|
|
10099
10673
|
** inteface returns SQLITE_NOTFOUND if the right-hand side of the J-th
|
|
10100
10674
|
** constraint is not available. ^The sqlite3_vtab_rhs_value() interface
|
|
10101
|
-
** can return
|
|
10675
|
+
** can return a result code other than SQLITE_OK or SQLITE_NOTFOUND if
|
|
10102
10676
|
** something goes wrong.
|
|
10103
10677
|
**
|
|
10104
10678
|
** The sqlite3_vtab_rhs_value() interface is usually only successful if
|
|
@@ -10126,8 +10700,8 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
|
|
|
10126
10700
|
** KEYWORDS: {conflict resolution mode}
|
|
10127
10701
|
**
|
|
10128
10702
|
** These constants are returned by [sqlite3_vtab_on_conflict()] to
|
|
10129
|
-
** inform a [virtual table] implementation
|
|
10130
|
-
**
|
|
10703
|
+
** inform a [virtual table] implementation of the [ON CONFLICT] mode
|
|
10704
|
+
** for the SQL statement being evaluated.
|
|
10131
10705
|
**
|
|
10132
10706
|
** Note that the [SQLITE_IGNORE] constant is also used as a potential
|
|
10133
10707
|
** return value from the [sqlite3_set_authorizer()] callback and that
|
|
@@ -10167,39 +10741,39 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
|
|
|
10167
10741
|
** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt>
|
|
10168
10742
|
** <dd>^The "double" variable pointed to by the V parameter will be set to the
|
|
10169
10743
|
** query planner's estimate for the average number of rows output from each
|
|
10170
|
-
** iteration of the X-th loop. If the query planner's
|
|
10744
|
+
** iteration of the X-th loop. If the query planner's estimate was accurate,
|
|
10171
10745
|
** then this value will approximate the quotient NVISIT/NLOOP and the
|
|
10172
10746
|
** product of this value for all prior loops with the same SELECTID will
|
|
10173
|
-
** be the NLOOP value for the current loop
|
|
10747
|
+
** be the NLOOP value for the current loop.</dd>
|
|
10174
10748
|
**
|
|
10175
10749
|
** [[SQLITE_SCANSTAT_NAME]] <dt>SQLITE_SCANSTAT_NAME</dt>
|
|
10176
10750
|
** <dd>^The "const char *" variable pointed to by the V parameter will be set
|
|
10177
10751
|
** to a zero-terminated UTF-8 string containing the name of the index or table
|
|
10178
|
-
** used for the X-th loop
|
|
10752
|
+
** used for the X-th loop.</dd>
|
|
10179
10753
|
**
|
|
10180
10754
|
** [[SQLITE_SCANSTAT_EXPLAIN]] <dt>SQLITE_SCANSTAT_EXPLAIN</dt>
|
|
10181
10755
|
** <dd>^The "const char *" variable pointed to by the V parameter will be set
|
|
10182
10756
|
** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN]
|
|
10183
|
-
** description for the X-th loop
|
|
10757
|
+
** description for the X-th loop.</dd>
|
|
10184
10758
|
**
|
|
10185
10759
|
** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECTID</dt>
|
|
10186
10760
|
** <dd>^The "int" variable pointed to by the V parameter will be set to the
|
|
10187
10761
|
** id for the X-th query plan element. The id value is unique within the
|
|
10188
10762
|
** statement. The select-id is the same value as is output in the first
|
|
10189
|
-
** column of an [EXPLAIN QUERY PLAN] query
|
|
10763
|
+
** column of an [EXPLAIN QUERY PLAN] query.</dd>
|
|
10190
10764
|
**
|
|
10191
10765
|
** [[SQLITE_SCANSTAT_PARENTID]] <dt>SQLITE_SCANSTAT_PARENTID</dt>
|
|
10192
10766
|
** <dd>The "int" variable pointed to by the V parameter will be set to the
|
|
10193
|
-
**
|
|
10767
|
+
** id of the parent of the current query element, if applicable, or
|
|
10194
10768
|
** to zero if the query element has no parent. This is the same value as
|
|
10195
|
-
** returned in the second column of an [EXPLAIN QUERY PLAN] query
|
|
10769
|
+
** returned in the second column of an [EXPLAIN QUERY PLAN] query.</dd>
|
|
10196
10770
|
**
|
|
10197
10771
|
** [[SQLITE_SCANSTAT_NCYCLE]] <dt>SQLITE_SCANSTAT_NCYCLE</dt>
|
|
10198
10772
|
** <dd>The sqlite3_int64 output value is set to the number of cycles,
|
|
10199
10773
|
** according to the processor time-stamp counter, that elapsed while the
|
|
10200
10774
|
** query element was being processed. This value is not available for
|
|
10201
10775
|
** all query elements - if it is unavailable the output variable is
|
|
10202
|
-
** set to -1
|
|
10776
|
+
** set to -1.</dd>
|
|
10203
10777
|
** </dl>
|
|
10204
10778
|
*/
|
|
10205
10779
|
#define SQLITE_SCANSTAT_NLOOP 0
|
|
@@ -10230,9 +10804,9 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
|
|
|
10230
10804
|
** a variable pointed to by the "pOut" parameter.
|
|
10231
10805
|
**
|
|
10232
10806
|
** The "flags" parameter must be passed a mask of flags. At present only
|
|
10233
|
-
** one flag is defined - SQLITE_SCANSTAT_COMPLEX. If SQLITE_SCANSTAT_COMPLEX
|
|
10807
|
+
** one flag is defined - [SQLITE_SCANSTAT_COMPLEX]. If SQLITE_SCANSTAT_COMPLEX
|
|
10234
10808
|
** is specified, then status information is available for all elements
|
|
10235
|
-
** of a query plan that are reported by "EXPLAIN QUERY PLAN" output. If
|
|
10809
|
+
** of a query plan that are reported by "[EXPLAIN QUERY PLAN]" output. If
|
|
10236
10810
|
** SQLITE_SCANSTAT_COMPLEX is not specified, then only query plan elements
|
|
10237
10811
|
** that correspond to query loops (the "SCAN..." and "SEARCH..." elements of
|
|
10238
10812
|
** the EXPLAIN QUERY PLAN output) are available. Invoking API
|
|
@@ -10240,13 +10814,14 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
|
|
|
10240
10814
|
** sqlite3_stmt_scanstatus_v2() with a zeroed flags parameter.
|
|
10241
10815
|
**
|
|
10242
10816
|
** Parameter "idx" identifies the specific query element to retrieve statistics
|
|
10243
|
-
** for. Query elements are numbered starting from zero. A value of -1 may
|
|
10244
|
-
**
|
|
10817
|
+
** for. Query elements are numbered starting from zero. A value of -1 may
|
|
10818
|
+
** retrieve statistics for the entire query. ^If idx is out of range
|
|
10245
10819
|
** - less than -1 or greater than or equal to the total number of query
|
|
10246
10820
|
** elements used to implement the statement - a non-zero value is returned and
|
|
10247
10821
|
** the variable that pOut points to is unchanged.
|
|
10248
10822
|
**
|
|
10249
|
-
** See also: [sqlite3_stmt_scanstatus_reset()]
|
|
10823
|
+
** See also: [sqlite3_stmt_scanstatus_reset()] and the
|
|
10824
|
+
** [nexec and ncycle] columns of the [bytecode virtual table].
|
|
10250
10825
|
*/
|
|
10251
10826
|
SQLITE_API int sqlite3_stmt_scanstatus(
|
|
10252
10827
|
sqlite3_stmt *pStmt, /* Prepared statement for which info desired */
|
|
@@ -10284,7 +10859,7 @@ SQLITE_API void sqlite3_stmt_scanstatus_reset(sqlite3_stmt*);
|
|
|
10284
10859
|
** METHOD: sqlite3
|
|
10285
10860
|
**
|
|
10286
10861
|
** ^If a write-transaction is open on [database connection] D when the
|
|
10287
|
-
** [sqlite3_db_cacheflush(D)] interface invoked, any dirty
|
|
10862
|
+
** [sqlite3_db_cacheflush(D)] interface is invoked, any dirty
|
|
10288
10863
|
** pages in the pager-cache that are not currently in use are written out
|
|
10289
10864
|
** to disk. A dirty page may be in use if a database cursor created by an
|
|
10290
10865
|
** active SQL statement is reading from it, or if it is page 1 of a database
|
|
@@ -10398,8 +10973,8 @@ SQLITE_API int sqlite3_db_cacheflush(sqlite3*);
|
|
|
10398
10973
|
** triggers; and so forth.
|
|
10399
10974
|
**
|
|
10400
10975
|
** When the [sqlite3_blob_write()] API is used to update a blob column,
|
|
10401
|
-
** the pre-update hook is invoked with SQLITE_DELETE
|
|
10402
|
-
**
|
|
10976
|
+
** the pre-update hook is invoked with SQLITE_DELETE, because
|
|
10977
|
+
** the new values are not yet available. In this case, when a
|
|
10403
10978
|
** callback made with op==SQLITE_DELETE is actually a write using the
|
|
10404
10979
|
** sqlite3_blob_write() API, the [sqlite3_preupdate_blobwrite()] returns
|
|
10405
10980
|
** the index of the column being written. In other cases, where the
|
|
@@ -10478,6 +11053,14 @@ typedef struct sqlite3_snapshot {
|
|
|
10478
11053
|
** If there is not already a read-transaction open on schema S when
|
|
10479
11054
|
** this function is called, one is opened automatically.
|
|
10480
11055
|
**
|
|
11056
|
+
** If a read-transaction is opened by this function, then it is guaranteed
|
|
11057
|
+
** that the returned snapshot object may not be invalidated by a database
|
|
11058
|
+
** writer or checkpointer until after the read-transaction is closed. This
|
|
11059
|
+
** is not guaranteed if a read-transaction is already open when this
|
|
11060
|
+
** function is called. In that case, any subsequent write or checkpoint
|
|
11061
|
+
** operation on the database may invalidate the returned snapshot handle,
|
|
11062
|
+
** even while the read-transaction remains open.
|
|
11063
|
+
**
|
|
10481
11064
|
** The following must be true for this function to succeed. If any of
|
|
10482
11065
|
** the following statements are false when sqlite3_snapshot_get() is
|
|
10483
11066
|
** called, SQLITE_ERROR is returned. The final value of *P is undefined
|
|
@@ -10509,7 +11092,7 @@ typedef struct sqlite3_snapshot {
|
|
|
10509
11092
|
** The [sqlite3_snapshot_get()] interface is only available when the
|
|
10510
11093
|
** [SQLITE_ENABLE_SNAPSHOT] compile-time option is used.
|
|
10511
11094
|
*/
|
|
10512
|
-
SQLITE_API
|
|
11095
|
+
SQLITE_API int sqlite3_snapshot_get(
|
|
10513
11096
|
sqlite3 *db,
|
|
10514
11097
|
const char *zSchema,
|
|
10515
11098
|
sqlite3_snapshot **ppSnapshot
|
|
@@ -10558,7 +11141,7 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_get(
|
|
|
10558
11141
|
** The [sqlite3_snapshot_open()] interface is only available when the
|
|
10559
11142
|
** [SQLITE_ENABLE_SNAPSHOT] compile-time option is used.
|
|
10560
11143
|
*/
|
|
10561
|
-
SQLITE_API
|
|
11144
|
+
SQLITE_API int sqlite3_snapshot_open(
|
|
10562
11145
|
sqlite3 *db,
|
|
10563
11146
|
const char *zSchema,
|
|
10564
11147
|
sqlite3_snapshot *pSnapshot
|
|
@@ -10575,7 +11158,7 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_open(
|
|
|
10575
11158
|
** The [sqlite3_snapshot_free()] interface is only available when the
|
|
10576
11159
|
** [SQLITE_ENABLE_SNAPSHOT] compile-time option is used.
|
|
10577
11160
|
*/
|
|
10578
|
-
SQLITE_API
|
|
11161
|
+
SQLITE_API void sqlite3_snapshot_free(sqlite3_snapshot*);
|
|
10579
11162
|
|
|
10580
11163
|
/*
|
|
10581
11164
|
** CAPI3REF: Compare the ages of two snapshot handles.
|
|
@@ -10602,7 +11185,7 @@ SQLITE_API SQLITE_EXPERIMENTAL void sqlite3_snapshot_free(sqlite3_snapshot*);
|
|
|
10602
11185
|
** This interface is only available if SQLite is compiled with the
|
|
10603
11186
|
** [SQLITE_ENABLE_SNAPSHOT] option.
|
|
10604
11187
|
*/
|
|
10605
|
-
SQLITE_API
|
|
11188
|
+
SQLITE_API int sqlite3_snapshot_cmp(
|
|
10606
11189
|
sqlite3_snapshot *p1,
|
|
10607
11190
|
sqlite3_snapshot *p2
|
|
10608
11191
|
);
|
|
@@ -10630,20 +11213,21 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_cmp(
|
|
|
10630
11213
|
** This interface is only available if SQLite is compiled with the
|
|
10631
11214
|
** [SQLITE_ENABLE_SNAPSHOT] option.
|
|
10632
11215
|
*/
|
|
10633
|
-
SQLITE_API
|
|
11216
|
+
SQLITE_API int sqlite3_snapshot_recover(sqlite3 *db, const char *zDb);
|
|
10634
11217
|
|
|
10635
11218
|
/*
|
|
10636
11219
|
** CAPI3REF: Serialize a database
|
|
10637
11220
|
**
|
|
10638
|
-
** The sqlite3_serialize(D,S,P,F) interface returns a pointer to
|
|
10639
|
-
** that is a serialization of the S database on
|
|
11221
|
+
** The sqlite3_serialize(D,S,P,F) interface returns a pointer to
|
|
11222
|
+
** memory that is a serialization of the S database on
|
|
11223
|
+
** [database connection] D. If S is a NULL pointer, the main database is used.
|
|
10640
11224
|
** If P is not a NULL pointer, then the size of the database in bytes
|
|
10641
11225
|
** is written into *P.
|
|
10642
11226
|
**
|
|
10643
11227
|
** For an ordinary on-disk database file, the serialization is just a
|
|
10644
11228
|
** copy of the disk file. For an in-memory database or a "TEMP" database,
|
|
10645
11229
|
** the serialization is the same sequence of bytes which would be written
|
|
10646
|
-
** to disk if that database
|
|
11230
|
+
** to disk if that database were backed up to disk.
|
|
10647
11231
|
**
|
|
10648
11232
|
** The usual case is that sqlite3_serialize() copies the serialization of
|
|
10649
11233
|
** the database into memory obtained from [sqlite3_malloc64()] and returns
|
|
@@ -10652,7 +11236,7 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const c
|
|
|
10652
11236
|
** contains the SQLITE_SERIALIZE_NOCOPY bit, then no memory allocations
|
|
10653
11237
|
** are made, and the sqlite3_serialize() function will return a pointer
|
|
10654
11238
|
** to the contiguous memory representation of the database that SQLite
|
|
10655
|
-
** is currently using for that database, or NULL if
|
|
11239
|
+
** is currently using for that database, or NULL if no such contiguous
|
|
10656
11240
|
** memory representation of the database exists. A contiguous memory
|
|
10657
11241
|
** representation of the database will usually only exist if there has
|
|
10658
11242
|
** been a prior call to [sqlite3_deserialize(D,S,...)] with the same
|
|
@@ -10703,12 +11287,24 @@ SQLITE_API unsigned char *sqlite3_serialize(
|
|
|
10703
11287
|
**
|
|
10704
11288
|
** The sqlite3_deserialize(D,S,P,N,M,F) interface causes the
|
|
10705
11289
|
** [database connection] D to disconnect from database S and then
|
|
10706
|
-
** reopen S as an in-memory database based on the serialization
|
|
10707
|
-
** in P.
|
|
10708
|
-
**
|
|
10709
|
-
** the
|
|
10710
|
-
**
|
|
10711
|
-
**
|
|
11290
|
+
** reopen S as an in-memory database based on the serialization
|
|
11291
|
+
** contained in P. If S is a NULL pointer, the main database is
|
|
11292
|
+
** used. The serialized database P is N bytes in size. M is the size
|
|
11293
|
+
** of the buffer P, which might be larger than N. If M is larger than
|
|
11294
|
+
** N, and the SQLITE_DESERIALIZE_READONLY bit is not set in F, then
|
|
11295
|
+
** SQLite is permitted to add content to the in-memory database, in
|
|
11296
|
+
** page-sized chunks, as long as the total size does not exceed M bytes.
|
|
11297
|
+
**
|
|
11298
|
+
** The parameter M must be greater than or equal to N. Ideally, M
|
|
11299
|
+
** should have a value which is N+(512×K)+20 where K determines how
|
|
11300
|
+
** must extra space is available to hold new content as the database
|
|
11301
|
+
** grows. K can be 0 if the database is read-only.
|
|
11302
|
+
**
|
|
11303
|
+
** If the database content in P is malformed in a malicious way then
|
|
11304
|
+
** it is possible that SQLite might try to read a few more than N bytes
|
|
11305
|
+
** from P. If the veracity of the database content P is uncertain,
|
|
11306
|
+
** then applications are advised to allocate about 20 extra bytes on
|
|
11307
|
+
** the end of the P buffer to avoid a memory error.
|
|
10712
11308
|
**
|
|
10713
11309
|
** If the SQLITE_DESERIALIZE_FREEONCLOSE bit is set in F, then SQLite will
|
|
10714
11310
|
** invoke sqlite3_free() on the serialization buffer when the database
|
|
@@ -10723,7 +11319,7 @@ SQLITE_API unsigned char *sqlite3_serialize(
|
|
|
10723
11319
|
** database is currently in a read transaction or is involved in a backup
|
|
10724
11320
|
** operation.
|
|
10725
11321
|
**
|
|
10726
|
-
** It is not possible to
|
|
11322
|
+
** It is not possible to deserialize into the TEMP database. If the
|
|
10727
11323
|
** S argument to sqlite3_deserialize(D,S,P,N,M,F) is "temp" then the
|
|
10728
11324
|
** function returns SQLITE_ERROR.
|
|
10729
11325
|
**
|
|
@@ -10745,7 +11341,7 @@ SQLITE_API int sqlite3_deserialize(
|
|
|
10745
11341
|
sqlite3 *db, /* The database connection */
|
|
10746
11342
|
const char *zSchema, /* Which DB to reopen with the deserialization */
|
|
10747
11343
|
unsigned char *pData, /* The serialized database content */
|
|
10748
|
-
sqlite3_int64 szDb, /* Number bytes in the deserialization */
|
|
11344
|
+
sqlite3_int64 szDb, /* Number of bytes in the deserialization */
|
|
10749
11345
|
sqlite3_int64 szBuf, /* Total size of buffer pData[] */
|
|
10750
11346
|
unsigned mFlags /* Zero or more SQLITE_DESERIALIZE_* flags */
|
|
10751
11347
|
);
|
|
@@ -10753,7 +11349,7 @@ SQLITE_API int sqlite3_deserialize(
|
|
|
10753
11349
|
/*
|
|
10754
11350
|
** CAPI3REF: Flags for sqlite3_deserialize()
|
|
10755
11351
|
**
|
|
10756
|
-
** The following are allowed values for 6th argument (the F argument) to
|
|
11352
|
+
** The following are allowed values for the 6th argument (the F argument) to
|
|
10757
11353
|
** the [sqlite3_deserialize(D,S,P,N,M,F)] interface.
|
|
10758
11354
|
**
|
|
10759
11355
|
** The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization
|
|
@@ -10775,6 +11371,77 @@ SQLITE_API int sqlite3_deserialize(
|
|
|
10775
11371
|
#define SQLITE_DESERIALIZE_RESIZEABLE 2 /* Resize using sqlite3_realloc64() */
|
|
10776
11372
|
#define SQLITE_DESERIALIZE_READONLY 4 /* Database is read-only */
|
|
10777
11373
|
|
|
11374
|
+
/*
|
|
11375
|
+
** CAPI3REF: Bind array values to the CARRAY table-valued function
|
|
11376
|
+
**
|
|
11377
|
+
** The sqlite3_carray_bind_v2(S,I,P,N,F,X,D) interface binds an array value to
|
|
11378
|
+
** parameter that is the first argument of the [carray() table-valued function].
|
|
11379
|
+
** The S parameter is a pointer to the [prepared statement] that uses the
|
|
11380
|
+
** carray() functions. I is the parameter index to be bound. I must be the
|
|
11381
|
+
** index of the parameter that is the first argument to the carray()
|
|
11382
|
+
** table-valued function. P is a pointer to the array to be bound, and N
|
|
11383
|
+
** is the number of elements in the array. The F argument is one of
|
|
11384
|
+
** constants [SQLITE_CARRAY_INT32], [SQLITE_CARRAY_INT64],
|
|
11385
|
+
** [SQLITE_CARRAY_DOUBLE], [SQLITE_CARRAY_TEXT],
|
|
11386
|
+
** or [SQLITE_CARRAY_BLOB] to indicate the datatype of the array P.
|
|
11387
|
+
**
|
|
11388
|
+
** If the X argument is not a NULL pointer or one of the special
|
|
11389
|
+
** values [SQLITE_STATIC] or [SQLITE_TRANSIENT], then SQLite will invoke
|
|
11390
|
+
** the function X with argument D when it is finished using the data in P.
|
|
11391
|
+
** The call to X(D) is a destructor for the array P. The destructor X(D)
|
|
11392
|
+
** is invoked even if the call to sqlite3_carray_bind_v2() fails. If the X
|
|
11393
|
+
** parameter is the special-case value [SQLITE_STATIC], then SQLite assumes
|
|
11394
|
+
** that the data static and the destructor is never invoked. If the X
|
|
11395
|
+
** parameter is the special-case value [SQLITE_TRANSIENT], then
|
|
11396
|
+
** sqlite3_carray_bind_v2() makes its own private copy of the data prior
|
|
11397
|
+
** to returning and never invokes the destructor X.
|
|
11398
|
+
**
|
|
11399
|
+
** The sqlite3_carray_bind() function works the same as sqlite3_carray_bind_v2()
|
|
11400
|
+
** with a D parameter set to P. In other words,
|
|
11401
|
+
** sqlite3_carray_bind(S,I,P,N,F,X) is same as
|
|
11402
|
+
** sqlite3_carray_bind_v2(S,I,P,N,F,X,P).
|
|
11403
|
+
*/
|
|
11404
|
+
SQLITE_API int sqlite3_carray_bind_v2(
|
|
11405
|
+
sqlite3_stmt *pStmt, /* Statement to be bound */
|
|
11406
|
+
int i, /* Parameter index */
|
|
11407
|
+
void *aData, /* Pointer to array data */
|
|
11408
|
+
int nData, /* Number of data elements */
|
|
11409
|
+
int mFlags, /* CARRAY flags */
|
|
11410
|
+
void (*xDel)(void*), /* Destructor for aData */
|
|
11411
|
+
void *pDel /* Optional argument to xDel() */
|
|
11412
|
+
);
|
|
11413
|
+
SQLITE_API int sqlite3_carray_bind(
|
|
11414
|
+
sqlite3_stmt *pStmt, /* Statement to be bound */
|
|
11415
|
+
int i, /* Parameter index */
|
|
11416
|
+
void *aData, /* Pointer to array data */
|
|
11417
|
+
int nData, /* Number of data elements */
|
|
11418
|
+
int mFlags, /* CARRAY flags */
|
|
11419
|
+
void (*xDel)(void*) /* Destructor for aData */
|
|
11420
|
+
);
|
|
11421
|
+
|
|
11422
|
+
/*
|
|
11423
|
+
** CAPI3REF: Datatypes for the CARRAY table-valued function
|
|
11424
|
+
**
|
|
11425
|
+
** The fifth argument to the [sqlite3_carray_bind()] interface musts be
|
|
11426
|
+
** one of the following constants, to specify the datatype of the array
|
|
11427
|
+
** that is being bound into the [carray table-valued function].
|
|
11428
|
+
*/
|
|
11429
|
+
#define SQLITE_CARRAY_INT32 0 /* Data is 32-bit signed integers */
|
|
11430
|
+
#define SQLITE_CARRAY_INT64 1 /* Data is 64-bit signed integers */
|
|
11431
|
+
#define SQLITE_CARRAY_DOUBLE 2 /* Data is doubles */
|
|
11432
|
+
#define SQLITE_CARRAY_TEXT 3 /* Data is char* */
|
|
11433
|
+
#define SQLITE_CARRAY_BLOB 4 /* Data is struct iovec */
|
|
11434
|
+
|
|
11435
|
+
/*
|
|
11436
|
+
** Versions of the above #defines that omit the initial SQLITE_, for
|
|
11437
|
+
** legacy compatibility.
|
|
11438
|
+
*/
|
|
11439
|
+
#define CARRAY_INT32 0 /* Data is 32-bit signed integers */
|
|
11440
|
+
#define CARRAY_INT64 1 /* Data is 64-bit signed integers */
|
|
11441
|
+
#define CARRAY_DOUBLE 2 /* Data is doubles */
|
|
11442
|
+
#define CARRAY_TEXT 3 /* Data is char* */
|
|
11443
|
+
#define CARRAY_BLOB 4 /* Data is struct iovec */
|
|
11444
|
+
|
|
10778
11445
|
/*
|
|
10779
11446
|
** Undo the hack that converts floating point types to integer for
|
|
10780
11447
|
** builds on processors without floating point support.
|
|
@@ -10786,8 +11453,6 @@ SQLITE_API int sqlite3_deserialize(
|
|
|
10786
11453
|
#if defined(__wasi__)
|
|
10787
11454
|
# undef SQLITE_WASI
|
|
10788
11455
|
# define SQLITE_WASI 1
|
|
10789
|
-
# undef SQLITE_OMIT_WAL
|
|
10790
|
-
# define SQLITE_OMIT_WAL 1/* because it requires shared memory APIs */
|
|
10791
11456
|
# ifndef SQLITE_OMIT_LOAD_EXTENSION
|
|
10792
11457
|
# define SQLITE_OMIT_LOAD_EXTENSION
|
|
10793
11458
|
# endif
|
|
@@ -10799,7 +11464,7 @@ SQLITE_API int sqlite3_deserialize(
|
|
|
10799
11464
|
#ifdef __cplusplus
|
|
10800
11465
|
} /* End of the 'extern "C"' block */
|
|
10801
11466
|
#endif
|
|
10802
|
-
#endif
|
|
11467
|
+
/* #endif for SQLITE3_H will be added by mksqlite3.tcl */
|
|
10803
11468
|
|
|
10804
11469
|
/******** Begin file sqlite3rtree.h *********/
|
|
10805
11470
|
/*
|
|
@@ -11280,9 +11945,10 @@ SQLITE_API void sqlite3session_table_filter(
|
|
|
11280
11945
|
** is inserted while a session object is enabled, then later deleted while
|
|
11281
11946
|
** the same session object is disabled, no INSERT record will appear in the
|
|
11282
11947
|
** changeset, even though the delete took place while the session was disabled.
|
|
11283
|
-
** Or, if one field of a row is updated while a session is
|
|
11284
|
-
** another field of the same row is updated while the session is
|
|
11285
|
-
** resulting changeset will contain an UPDATE change that updates both
|
|
11948
|
+
** Or, if one field of a row is updated while a session is enabled, and
|
|
11949
|
+
** then another field of the same row is updated while the session is disabled,
|
|
11950
|
+
** the resulting changeset will contain an UPDATE change that updates both
|
|
11951
|
+
** fields.
|
|
11286
11952
|
*/
|
|
11287
11953
|
SQLITE_API int sqlite3session_changeset(
|
|
11288
11954
|
sqlite3_session *pSession, /* Session object */
|
|
@@ -11354,8 +12020,9 @@ SQLITE_API sqlite3_int64 sqlite3session_changeset_size(sqlite3_session *pSession
|
|
|
11354
12020
|
** database zFrom the contents of the two compatible tables would be
|
|
11355
12021
|
** identical.
|
|
11356
12022
|
**
|
|
11357
|
-
**
|
|
11358
|
-
**
|
|
12023
|
+
** Unless the call to this function is a no-op as described above, it is an
|
|
12024
|
+
** error if database zFrom does not exist or does not contain the required
|
|
12025
|
+
** compatible table.
|
|
11359
12026
|
**
|
|
11360
12027
|
** If the operation is successful, SQLITE_OK is returned. Otherwise, an SQLite
|
|
11361
12028
|
** error code. In this case, if argument pzErrMsg is not NULL, *pzErrMsg
|
|
@@ -11490,7 +12157,7 @@ SQLITE_API int sqlite3changeset_start_v2(
|
|
|
11490
12157
|
** The following flags may passed via the 4th parameter to
|
|
11491
12158
|
** [sqlite3changeset_start_v2] and [sqlite3changeset_start_v2_strm]:
|
|
11492
12159
|
**
|
|
11493
|
-
** <dt>
|
|
12160
|
+
** <dt>SQLITE_CHANGESETSTART_INVERT <dd>
|
|
11494
12161
|
** Invert the changeset while iterating through it. This is equivalent to
|
|
11495
12162
|
** inverting a changeset using sqlite3changeset_invert() before applying it.
|
|
11496
12163
|
** It is an error to specify this flag with a patchset.
|
|
@@ -11805,19 +12472,6 @@ SQLITE_API int sqlite3changeset_concat(
|
|
|
11805
12472
|
void **ppOut /* OUT: Buffer containing output changeset */
|
|
11806
12473
|
);
|
|
11807
12474
|
|
|
11808
|
-
|
|
11809
|
-
/*
|
|
11810
|
-
** CAPI3REF: Upgrade the Schema of a Changeset/Patchset
|
|
11811
|
-
*/
|
|
11812
|
-
SQLITE_API int sqlite3changeset_upgrade(
|
|
11813
|
-
sqlite3 *db,
|
|
11814
|
-
const char *zDb,
|
|
11815
|
-
int nIn, const void *pIn, /* Input changeset */
|
|
11816
|
-
int *pnOut, void **ppOut /* OUT: Inverse of input */
|
|
11817
|
-
);
|
|
11818
|
-
|
|
11819
|
-
|
|
11820
|
-
|
|
11821
12475
|
/*
|
|
11822
12476
|
** CAPI3REF: Changegroup Handle
|
|
11823
12477
|
**
|
|
@@ -11979,6 +12633,30 @@ SQLITE_API int sqlite3changegroup_schema(sqlite3_changegroup*, sqlite3*, const c
|
|
|
11979
12633
|
*/
|
|
11980
12634
|
SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData);
|
|
11981
12635
|
|
|
12636
|
+
/*
|
|
12637
|
+
** CAPI3REF: Add A Single Change To A Changegroup
|
|
12638
|
+
** METHOD: sqlite3_changegroup
|
|
12639
|
+
**
|
|
12640
|
+
** This function adds the single change currently indicated by the iterator
|
|
12641
|
+
** passed as the second argument to the changegroup object. The rules for
|
|
12642
|
+
** adding the change are just as described for [sqlite3changegroup_add()].
|
|
12643
|
+
**
|
|
12644
|
+
** If the change is successfully added to the changegroup, SQLITE_OK is
|
|
12645
|
+
** returned. Otherwise, an SQLite error code is returned.
|
|
12646
|
+
**
|
|
12647
|
+
** The iterator must point to a valid entry when this function is called.
|
|
12648
|
+
** If it does not, SQLITE_ERROR is returned and no change is added to the
|
|
12649
|
+
** changegroup. Additionally, the iterator must not have been opened with
|
|
12650
|
+
** the SQLITE_CHANGESETAPPLY_INVERT flag. In this case SQLITE_ERROR is also
|
|
12651
|
+
** returned.
|
|
12652
|
+
*/
|
|
12653
|
+
SQLITE_API int sqlite3changegroup_add_change(
|
|
12654
|
+
sqlite3_changegroup*,
|
|
12655
|
+
sqlite3_changeset_iter*
|
|
12656
|
+
);
|
|
12657
|
+
|
|
12658
|
+
|
|
12659
|
+
|
|
11982
12660
|
/*
|
|
11983
12661
|
** CAPI3REF: Obtain A Composite Changeset From A Changegroup
|
|
11984
12662
|
** METHOD: sqlite3_changegroup
|
|
@@ -12023,14 +12701,32 @@ SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup*);
|
|
|
12023
12701
|
** update the "main" database attached to handle db with the changes found in
|
|
12024
12702
|
** the changeset passed via the second and third arguments.
|
|
12025
12703
|
**
|
|
12704
|
+
** All changes made by these functions are enclosed in a savepoint transaction.
|
|
12705
|
+
** If any other error (aside from a constraint failure when attempting to
|
|
12706
|
+
** write to the target database) occurs, then the savepoint transaction is
|
|
12707
|
+
** rolled back, restoring the target database to its original state, and an
|
|
12708
|
+
** SQLite error code returned. Additionally, starting with version 3.51.0,
|
|
12709
|
+
** an error code and error message that may be accessed using the
|
|
12710
|
+
** [sqlite3_errcode()] and [sqlite3_errmsg()] APIs are left in the database
|
|
12711
|
+
** handle.
|
|
12712
|
+
**
|
|
12026
12713
|
** The fourth argument (xFilter) passed to these functions is the "filter
|
|
12027
|
-
** callback".
|
|
12028
|
-
**
|
|
12029
|
-
**
|
|
12030
|
-
**
|
|
12031
|
-
**
|
|
12032
|
-
**
|
|
12033
|
-
**
|
|
12714
|
+
** callback". This may be passed NULL, in which case all changes in the
|
|
12715
|
+
** changeset are applied to the database. For sqlite3changeset_apply() and
|
|
12716
|
+
** sqlite3_changeset_apply_v2(), if it is not NULL, then it is invoked once
|
|
12717
|
+
** for each table affected by at least one change in the changeset. In this
|
|
12718
|
+
** case the table name is passed as the second argument, and a copy of
|
|
12719
|
+
** the context pointer passed as the sixth argument to apply() or apply_v2()
|
|
12720
|
+
** as the first. If the "filter callback" returns zero, then no attempt is
|
|
12721
|
+
** made to apply any changes to the table. Otherwise, if the return value is
|
|
12722
|
+
** non-zero, all changes related to the table are attempted.
|
|
12723
|
+
**
|
|
12724
|
+
** For sqlite3_changeset_apply_v3(), the xFilter callback is invoked once
|
|
12725
|
+
** per change. The second argument in this case is an sqlite3_changeset_iter
|
|
12726
|
+
** that may be queried using the usual APIs for the details of the current
|
|
12727
|
+
** change. If the "filter callback" returns zero in this case, then no attempt
|
|
12728
|
+
** is made to apply the current change. If it returns non-zero, the change
|
|
12729
|
+
** is applied.
|
|
12034
12730
|
**
|
|
12035
12731
|
** For each table that is not excluded by the filter callback, this function
|
|
12036
12732
|
** tests that the target database contains a compatible table. A table is
|
|
@@ -12051,11 +12747,11 @@ SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup*);
|
|
|
12051
12747
|
** one such warning is issued for each table in the changeset.
|
|
12052
12748
|
**
|
|
12053
12749
|
** For each change for which there is a compatible table, an attempt is made
|
|
12054
|
-
** to modify the table contents according to
|
|
12055
|
-
** change. If a change cannot be
|
|
12056
|
-
** function passed as the fifth argument
|
|
12057
|
-
** invoked. A description of exactly when
|
|
12058
|
-
** each type of change is below.
|
|
12750
|
+
** to modify the table contents according to each UPDATE, INSERT or DELETE
|
|
12751
|
+
** change that is not excluded by a filter callback. If a change cannot be
|
|
12752
|
+
** applied cleanly, the conflict handler function passed as the fifth argument
|
|
12753
|
+
** to sqlite3changeset_apply() may be invoked. A description of exactly when
|
|
12754
|
+
** the conflict handler is invoked for each type of change is below.
|
|
12059
12755
|
**
|
|
12060
12756
|
** Unlike the xFilter argument, xConflict may not be passed NULL. The results
|
|
12061
12757
|
** of passing anything other than a valid function pointer as the xConflict
|
|
@@ -12151,12 +12847,6 @@ SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup*);
|
|
|
12151
12847
|
** This can be used to further customize the application's conflict
|
|
12152
12848
|
** resolution strategy.
|
|
12153
12849
|
**
|
|
12154
|
-
** All changes made by these functions are enclosed in a savepoint transaction.
|
|
12155
|
-
** If any other error (aside from a constraint failure when attempting to
|
|
12156
|
-
** write to the target database) occurs, then the savepoint transaction is
|
|
12157
|
-
** rolled back, restoring the target database to its original state, and an
|
|
12158
|
-
** SQLite error code returned.
|
|
12159
|
-
**
|
|
12160
12850
|
** If the output parameters (ppRebase) and (pnRebase) are non-NULL and
|
|
12161
12851
|
** the input is a changeset (not a patchset), then sqlite3changeset_apply_v2()
|
|
12162
12852
|
** may set (*ppRebase) to point to a "rebase" that may be used with the
|
|
@@ -12206,6 +12896,23 @@ SQLITE_API int sqlite3changeset_apply_v2(
|
|
|
12206
12896
|
void **ppRebase, int *pnRebase, /* OUT: Rebase data */
|
|
12207
12897
|
int flags /* SESSION_CHANGESETAPPLY_* flags */
|
|
12208
12898
|
);
|
|
12899
|
+
SQLITE_API int sqlite3changeset_apply_v3(
|
|
12900
|
+
sqlite3 *db, /* Apply change to "main" db of this handle */
|
|
12901
|
+
int nChangeset, /* Size of changeset in bytes */
|
|
12902
|
+
void *pChangeset, /* Changeset blob */
|
|
12903
|
+
int(*xFilter)(
|
|
12904
|
+
void *pCtx, /* Copy of sixth arg to _apply() */
|
|
12905
|
+
sqlite3_changeset_iter *p /* Handle describing change */
|
|
12906
|
+
),
|
|
12907
|
+
int(*xConflict)(
|
|
12908
|
+
void *pCtx, /* Copy of sixth arg to _apply() */
|
|
12909
|
+
int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */
|
|
12910
|
+
sqlite3_changeset_iter *p /* Handle describing change and conflict */
|
|
12911
|
+
),
|
|
12912
|
+
void *pCtx, /* First argument passed to xConflict */
|
|
12913
|
+
void **ppRebase, int *pnRebase, /* OUT: Rebase data */
|
|
12914
|
+
int flags /* SESSION_CHANGESETAPPLY_* flags */
|
|
12915
|
+
);
|
|
12209
12916
|
|
|
12210
12917
|
/*
|
|
12211
12918
|
** CAPI3REF: Flags for sqlite3changeset_apply_v2
|
|
@@ -12246,11 +12953,23 @@ SQLITE_API int sqlite3changeset_apply_v2(
|
|
|
12246
12953
|
** database behave as if they were declared with "ON UPDATE NO ACTION ON
|
|
12247
12954
|
** DELETE NO ACTION", even if they are actually CASCADE, RESTRICT, SET NULL
|
|
12248
12955
|
** or SET DEFAULT.
|
|
12956
|
+
**
|
|
12957
|
+
** <dt>SQLITE_CHANGESETAPPLY_NOUPDATELOOP <dd>
|
|
12958
|
+
** Sometimes, a changeset contains two or more update statements such that
|
|
12959
|
+
** although after applying all updates the database will contain no
|
|
12960
|
+
** constraint violations, no single update can be applied before the others.
|
|
12961
|
+
** The simplest example of this is a pair of UPDATEs that have "swapped"
|
|
12962
|
+
** two column values with a UNIQUE constraint.
|
|
12963
|
+
** <p>
|
|
12964
|
+
** Usually, sqlite3changeset_apply() and similar functions work hard to try
|
|
12965
|
+
** to find a way to apply such a changeset. However, if this flag is set,
|
|
12966
|
+
** then all such updates are considered CONSTRAINT conflicts.
|
|
12249
12967
|
*/
|
|
12250
12968
|
#define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001
|
|
12251
12969
|
#define SQLITE_CHANGESETAPPLY_INVERT 0x0002
|
|
12252
12970
|
#define SQLITE_CHANGESETAPPLY_IGNORENOOP 0x0004
|
|
12253
12971
|
#define SQLITE_CHANGESETAPPLY_FKNOACTION 0x0008
|
|
12972
|
+
#define SQLITE_CHANGESETAPPLY_NOUPDATELOOP 0x0010
|
|
12254
12973
|
|
|
12255
12974
|
/*
|
|
12256
12975
|
** CAPI3REF: Constants Passed To The Conflict Handler
|
|
@@ -12625,6 +13344,23 @@ SQLITE_API int sqlite3changeset_apply_v2_strm(
|
|
|
12625
13344
|
void **ppRebase, int *pnRebase,
|
|
12626
13345
|
int flags
|
|
12627
13346
|
);
|
|
13347
|
+
SQLITE_API int sqlite3changeset_apply_v3_strm(
|
|
13348
|
+
sqlite3 *db, /* Apply change to "main" db of this handle */
|
|
13349
|
+
int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */
|
|
13350
|
+
void *pIn, /* First arg for xInput */
|
|
13351
|
+
int(*xFilter)(
|
|
13352
|
+
void *pCtx, /* Copy of sixth arg to _apply() */
|
|
13353
|
+
sqlite3_changeset_iter *p
|
|
13354
|
+
),
|
|
13355
|
+
int(*xConflict)(
|
|
13356
|
+
void *pCtx, /* Copy of sixth arg to _apply() */
|
|
13357
|
+
int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */
|
|
13358
|
+
sqlite3_changeset_iter *p /* Handle describing change and conflict */
|
|
13359
|
+
),
|
|
13360
|
+
void *pCtx, /* First argument passed to xConflict */
|
|
13361
|
+
void **ppRebase, int *pnRebase,
|
|
13362
|
+
int flags
|
|
13363
|
+
);
|
|
12628
13364
|
SQLITE_API int sqlite3changeset_concat_strm(
|
|
12629
13365
|
int (*xInputA)(void *pIn, void *pData, int *pnData),
|
|
12630
13366
|
void *pInA,
|
|
@@ -12716,6 +13452,232 @@ SQLITE_API int sqlite3session_config(int op, void *pArg);
|
|
|
12716
13452
|
*/
|
|
12717
13453
|
#define SQLITE_SESSION_CONFIG_STRMSIZE 1
|
|
12718
13454
|
|
|
13455
|
+
/*
|
|
13456
|
+
** CAPI3REF: Configure a changegroup object
|
|
13457
|
+
**
|
|
13458
|
+
** Configure the changegroup object passed as the first argument.
|
|
13459
|
+
** At present the only valid value for the second parameter is
|
|
13460
|
+
** [SQLITE_CHANGEGROUP_CONFIG_PATCHSET].
|
|
13461
|
+
*/
|
|
13462
|
+
SQLITE_API int sqlite3changegroup_config(sqlite3_changegroup*, int, void *pArg);
|
|
13463
|
+
|
|
13464
|
+
/*
|
|
13465
|
+
** CAPI3REF: Options for sqlite3changegroup_config().
|
|
13466
|
+
**
|
|
13467
|
+
** The following values may be passed as the 2nd parameter to
|
|
13468
|
+
** sqlite3changegroup_config().
|
|
13469
|
+
**
|
|
13470
|
+
** <dt>SQLITE_CHANGEGROUP_CONFIG_PATCHSET <dd>
|
|
13471
|
+
** A changegroup object generates either a changeset or patchset. Usually,
|
|
13472
|
+
** this is determined by whether the first call to sqlite3changegroup_add()
|
|
13473
|
+
** is passed a changeset or a patchset. Or, if the first changes are added
|
|
13474
|
+
** to the changegroup object using the sqlite3changegroup_change_xxx()
|
|
13475
|
+
** APIs, then this option may be used to configure whether the changegroup
|
|
13476
|
+
** object generates a changeset or patchset.
|
|
13477
|
+
**
|
|
13478
|
+
** When this option is invoked, parameter pArg must point to a value of
|
|
13479
|
+
** type int. If the changegroup currently contains zero changes, and the
|
|
13480
|
+
** value of the int variable is zero or greater than zero, then the
|
|
13481
|
+
** changegroup is configured to generate a changeset or patchset,
|
|
13482
|
+
** respectively. It is a no-op, not an error, if the changegroup is not
|
|
13483
|
+
** configured because it has already started accumulating changes.
|
|
13484
|
+
**
|
|
13485
|
+
** Before returning, the int variable is set to 0 if the changegroup is
|
|
13486
|
+
** configured to generate a changeset, or 1 if it is configured to generate
|
|
13487
|
+
** a patchset.
|
|
13488
|
+
*/
|
|
13489
|
+
#define SQLITE_CHANGEGROUP_CONFIG_PATCHSET 1
|
|
13490
|
+
|
|
13491
|
+
|
|
13492
|
+
/*
|
|
13493
|
+
** CAPI3REF: Begin adding a change to a changegroup
|
|
13494
|
+
**
|
|
13495
|
+
** This API is used, in concert with other sqlite3changegroup_change_xxx()
|
|
13496
|
+
** APIs, to add changes to a changegroup object one at a time. To add a
|
|
13497
|
+
** single change, the caller must:
|
|
13498
|
+
**
|
|
13499
|
+
** 1. Invoke sqlite3changegroup_change_begin() to indicate the type of
|
|
13500
|
+
** change (INSERT, UPDATE or DELETE), the affected table and whether
|
|
13501
|
+
** or not the change should be marked as indirect.
|
|
13502
|
+
**
|
|
13503
|
+
** 2. Invoke sqlite3changegroup_change_int64() or one of the other four
|
|
13504
|
+
** value functions - _null(), _double(), _text() or _blob() - one or
|
|
13505
|
+
** more times to specify old.* and new.* values for the change being
|
|
13506
|
+
** constructed.
|
|
13507
|
+
**
|
|
13508
|
+
** 3. Invoke sqlite3changegroup_change_finish() to either finish adding
|
|
13509
|
+
** the change to the group, or to discard the change altogether.
|
|
13510
|
+
**
|
|
13511
|
+
** The first argument to this function must be a pointer to the existing
|
|
13512
|
+
** changegroup object that the change will be added to. The second argument
|
|
13513
|
+
** must be SQLITE_INSERT, SQLITE_UPDATE or SQLITE_DELETE. The third is the
|
|
13514
|
+
** name of the table that the change affects, and the fourth is a boolean
|
|
13515
|
+
** flag specifying whether the change should be marked as "indirect" (if
|
|
13516
|
+
** bIndirect is non-zero) or not indirect (if bIndirect is zero).
|
|
13517
|
+
**
|
|
13518
|
+
** Following a successful call to this function, this function may not be
|
|
13519
|
+
** called again on the same changegroup object until after
|
|
13520
|
+
** sqlite3changegroup_change_finish() has been called. Doing so is an
|
|
13521
|
+
** SQLITE_MISUSE error.
|
|
13522
|
+
**
|
|
13523
|
+
** The changegroup object passed as the first argument must be already
|
|
13524
|
+
** configured with schema data for the specified table. It may be configured
|
|
13525
|
+
** either by calling sqlite3changegroup_schema() with a database that contains
|
|
13526
|
+
** the table, or sqlite3changegroup_add() with a changeset that contains the
|
|
13527
|
+
** table. If the changegroup object has not been configured with a schema for
|
|
13528
|
+
** the specified table when this function is called, SQLITE_ERROR is returned.
|
|
13529
|
+
**
|
|
13530
|
+
** If successful, SQLITE_OK is returned. Otherwise, if an error occurs, an
|
|
13531
|
+
** SQLite error code is returned. In this case, if argument pzErr is non-NULL,
|
|
13532
|
+
** then (*pzErr) may be set to point to a buffer containing a utf-8 formated,
|
|
13533
|
+
** nul-terminated, English language error message. It is the responsibility
|
|
13534
|
+
** of the caller to eventually free this buffer using sqlite3_free().
|
|
13535
|
+
*/
|
|
13536
|
+
SQLITE_API int sqlite3changegroup_change_begin(
|
|
13537
|
+
sqlite3_changegroup*,
|
|
13538
|
+
int eOp,
|
|
13539
|
+
const char *zTab,
|
|
13540
|
+
int bIndirect,
|
|
13541
|
+
char **pzErr
|
|
13542
|
+
);
|
|
13543
|
+
|
|
13544
|
+
/*
|
|
13545
|
+
** CAPI3REF: Add a 64-bit integer to a changegroup
|
|
13546
|
+
**
|
|
13547
|
+
** This function may only be called between a successful call to
|
|
13548
|
+
** sqlite3changegroup_change_begin() and its matching
|
|
13549
|
+
** sqlite3changegroup_change_finish() call. If it is called at any
|
|
13550
|
+
** other time, it is an SQLITE_MISUSE error. Calling this function
|
|
13551
|
+
** specifies a 64-bit integer value to be used in the change currently being
|
|
13552
|
+
** added to the changegroup object passed as the first argument.
|
|
13553
|
+
**
|
|
13554
|
+
** The second parameter, bNew, specifies whether the value is to be part of
|
|
13555
|
+
** the new.* (if bNew is non-zero) or old.* (if bNew is zero) record of
|
|
13556
|
+
** the change under construction. If this does not match the type of change
|
|
13557
|
+
** specified by the preceding call to sqlite3changegroup_change_begin() (i.e.
|
|
13558
|
+
** an old.* value for an SQLITE_INSERT change, or a new.* value for an
|
|
13559
|
+
** SQLITE_DELETE), then SQLITE_ERROR is returned.
|
|
13560
|
+
**
|
|
13561
|
+
** The third parameter specifies the column of the old.* or new.* record that
|
|
13562
|
+
** the value will be a part of. If the specified table has an explicit primary
|
|
13563
|
+
** key, then this is the index of the table column, numbered from 0 in the order
|
|
13564
|
+
** specified within the CREATE TABLE statement. Or, if the table uses an
|
|
13565
|
+
** implicit rowid key, then the column 0 is the rowid and the explicit columns
|
|
13566
|
+
** are numbered starting from 1. If the iCol parameter is less than 0 or greater
|
|
13567
|
+
** than the index of the last column in the table, SQLITE_RANGE is returned.
|
|
13568
|
+
**
|
|
13569
|
+
** The fourth parameter is the integer value to use as part of the old.* or
|
|
13570
|
+
** new.* record.
|
|
13571
|
+
**
|
|
13572
|
+
** If this call is successful, SQLITE_OK is returned. Otherwise, if an
|
|
13573
|
+
** error occurs, an SQLite error code is returned.
|
|
13574
|
+
*/
|
|
13575
|
+
SQLITE_API int sqlite3changegroup_change_int64(
|
|
13576
|
+
sqlite3_changegroup*,
|
|
13577
|
+
int bNew,
|
|
13578
|
+
int iCol,
|
|
13579
|
+
sqlite3_int64 iVal
|
|
13580
|
+
);
|
|
13581
|
+
|
|
13582
|
+
/*
|
|
13583
|
+
** CAPI3REF: Add a NULL to a changegroup
|
|
13584
|
+
**
|
|
13585
|
+
** This function is similar to sqlite3changegroup_change_int64(). Except that
|
|
13586
|
+
** it configures the change currently under construction with a NULL value
|
|
13587
|
+
** instead of a 64-bit integer.
|
|
13588
|
+
*/
|
|
13589
|
+
SQLITE_API int sqlite3changegroup_change_null(sqlite3_changegroup*, int, int);
|
|
13590
|
+
|
|
13591
|
+
/*
|
|
13592
|
+
** CAPI3REF: Add an double to a changegroup
|
|
13593
|
+
**
|
|
13594
|
+
** This function is similar to sqlite3changegroup_change_int64(). Except that
|
|
13595
|
+
** it configures the change currently being constructed with a real value
|
|
13596
|
+
** instead of a 64-bit integer.
|
|
13597
|
+
*/
|
|
13598
|
+
SQLITE_API int sqlite3changegroup_change_double(sqlite3_changegroup*, int, int, double);
|
|
13599
|
+
|
|
13600
|
+
/*
|
|
13601
|
+
** CAPI3REF: Add a text value to a changegroup
|
|
13602
|
+
**
|
|
13603
|
+
** This function is similar to sqlite3changegroup_change_int64(). It configures
|
|
13604
|
+
** the currently accumulated change with a text value instead of a 64-bit
|
|
13605
|
+
** integer. Parameter pVal points to a buffer containing the text encoded using
|
|
13606
|
+
** utf-8. Parameter nVal may either be the size of the text value in bytes, or
|
|
13607
|
+
** else a negative value, in which case the buffer pVal points to is assumed to
|
|
13608
|
+
** be nul-terminated.
|
|
13609
|
+
*/
|
|
13610
|
+
SQLITE_API int sqlite3changegroup_change_text(
|
|
13611
|
+
sqlite3_changegroup*, int, int, const char *pVal, int nVal
|
|
13612
|
+
);
|
|
13613
|
+
|
|
13614
|
+
/*
|
|
13615
|
+
** CAPI3REF: Add a blob to a changegroup
|
|
13616
|
+
**
|
|
13617
|
+
** This function is similar to sqlite3changegroup_change_int64(). It configures
|
|
13618
|
+
** the currently accumulated change with a blob value instead of a 64-bit
|
|
13619
|
+
** integer. Parameter pVal points to a buffer containing the blob. Parameter
|
|
13620
|
+
** nVal is the size of the blob in bytes.
|
|
13621
|
+
*/
|
|
13622
|
+
SQLITE_API int sqlite3changegroup_change_blob(
|
|
13623
|
+
sqlite3_changegroup*, int, int, const void *pVal, int nVal
|
|
13624
|
+
);
|
|
13625
|
+
|
|
13626
|
+
/*
|
|
13627
|
+
** CAPI3REF: Finish adding one-at-at-time changes to a changegroup
|
|
13628
|
+
**
|
|
13629
|
+
** This function may only be called following a successful call to
|
|
13630
|
+
** sqlite3changegroup_change_begin(). Otherwise, it is an SQLITE_MISUSE error.
|
|
13631
|
+
**
|
|
13632
|
+
** If parameter bDiscard is non-zero, then the current change is simply
|
|
13633
|
+
** discarded. In this case this function is always successful and SQLITE_OK
|
|
13634
|
+
** returned.
|
|
13635
|
+
**
|
|
13636
|
+
** If parameter bDiscard is zero, then an attempt is made to add the current
|
|
13637
|
+
** change to the changegroup. Assuming the changegroup is configured to
|
|
13638
|
+
** produce a changeset (not a patchset), this requires that:
|
|
13639
|
+
**
|
|
13640
|
+
** * If the change is an INSERT or DELETE, then a value must be specified
|
|
13641
|
+
** for all columns of the new.* or old.* record, respectively.
|
|
13642
|
+
**
|
|
13643
|
+
** * If the change is an UPDATE record, then values must be provided for
|
|
13644
|
+
** the PRIMARY KEY columns of the old.* record, but must not be provided
|
|
13645
|
+
** for PRIMARY KEY columns of the new.* record.
|
|
13646
|
+
**
|
|
13647
|
+
** * If the change is an UPDATE record, then for each non-PRIMARY KEY
|
|
13648
|
+
** column in the old.* record for which a value has been provided, a
|
|
13649
|
+
** value must also be provided for the same column in the new.* record.
|
|
13650
|
+
** Similarly, for each non-PK column in the old.* record for which
|
|
13651
|
+
** a value is not provided, a value must not be provided for the same
|
|
13652
|
+
** column in the new.* record.
|
|
13653
|
+
**
|
|
13654
|
+
** * All values specified for PRIMARY KEY columns must be non-NULL.
|
|
13655
|
+
**
|
|
13656
|
+
** Otherwise, it is an error.
|
|
13657
|
+
**
|
|
13658
|
+
** If the changegroup already contains a change for the same row (identified
|
|
13659
|
+
** by PRIMARY KEY columns), then the current change is combined with the
|
|
13660
|
+
** existing change in the same way as for sqlite3changegroup_add().
|
|
13661
|
+
**
|
|
13662
|
+
** For a patchset, all of the above rules apply except that it doesn't matter
|
|
13663
|
+
** whether or not values are provided for the non-PK old.* record columns
|
|
13664
|
+
** for an UPDATE or DELETE change. This means that code used to produce
|
|
13665
|
+
** a changeset using the sqlite3changegroup_change_xxx() APIs may also
|
|
13666
|
+
** be used to produce patchsets.
|
|
13667
|
+
**
|
|
13668
|
+
** If the call is successful, SQLITE_OK is returned. Otherwise, if an error
|
|
13669
|
+
** occurs, an SQLite error code is returned. If an error is returned and
|
|
13670
|
+
** parameter pzErr is not NULL, then (*pzErr) may be set to point to a buffer
|
|
13671
|
+
** containing a nul-terminated, utf-8 encoded, English language error message.
|
|
13672
|
+
** It is the responsibility of the caller to eventually free any such error
|
|
13673
|
+
** message buffer using sqlite3_free().
|
|
13674
|
+
*/
|
|
13675
|
+
SQLITE_API int sqlite3changegroup_change_finish(
|
|
13676
|
+
sqlite3_changegroup*,
|
|
13677
|
+
int bDiscard,
|
|
13678
|
+
char **pzErr
|
|
13679
|
+
);
|
|
13680
|
+
|
|
12719
13681
|
/*
|
|
12720
13682
|
** Make sure we can call this stuff from C++.
|
|
12721
13683
|
*/
|
|
@@ -12783,8 +13745,8 @@ struct Fts5PhraseIter {
|
|
|
12783
13745
|
** EXTENSION API FUNCTIONS
|
|
12784
13746
|
**
|
|
12785
13747
|
** xUserData(pFts):
|
|
12786
|
-
** Return a copy of the
|
|
12787
|
-
** registered
|
|
13748
|
+
** Return a copy of the pUserData pointer passed to the xCreateFunction()
|
|
13749
|
+
** API when the extension function was registered.
|
|
12788
13750
|
**
|
|
12789
13751
|
** xColumnTotalSize(pFts, iCol, pnToken):
|
|
12790
13752
|
** If parameter iCol is less than zero, set output variable *pnToken
|
|
@@ -12966,6 +13928,10 @@ struct Fts5PhraseIter {
|
|
|
12966
13928
|
** (i.e. if it is a contentless table), then this API always iterates
|
|
12967
13929
|
** through an empty set (all calls to xPhraseFirst() set iCol to -1).
|
|
12968
13930
|
**
|
|
13931
|
+
** In all cases, matches are visited in (column ASC, offset ASC) order.
|
|
13932
|
+
** i.e. all those in column 0, sorted by offset, followed by those in
|
|
13933
|
+
** column 1, etc.
|
|
13934
|
+
**
|
|
12969
13935
|
** xPhraseNext()
|
|
12970
13936
|
** See xPhraseFirst above.
|
|
12971
13937
|
**
|
|
@@ -13022,19 +13988,57 @@ struct Fts5PhraseIter {
|
|
|
13022
13988
|
** value returned by xInstCount(), SQLITE_RANGE is returned. Otherwise,
|
|
13023
13989
|
** output variable (*ppToken) is set to point to a buffer containing the
|
|
13024
13990
|
** matching document token, and (*pnToken) to the size of that buffer in
|
|
13025
|
-
** bytes.
|
|
13026
|
-
** prefix query term. In that case both output variables are always set
|
|
13027
|
-
** to 0.
|
|
13991
|
+
** bytes.
|
|
13028
13992
|
**
|
|
13029
13993
|
** The output text is not a copy of the document text that was tokenized.
|
|
13030
13994
|
** It is the output of the tokenizer module. For tokendata=1 tables, this
|
|
13031
13995
|
** includes any embedded 0x00 and trailing data.
|
|
13032
13996
|
**
|
|
13997
|
+
** This API may be slow in some cases if the token identified by parameters
|
|
13998
|
+
** iIdx and iToken matched a prefix token in the query. In most cases, the
|
|
13999
|
+
** first call to this API for each prefix token in the query is forced
|
|
14000
|
+
** to scan the portion of the full-text index that matches the prefix
|
|
14001
|
+
** token to collect the extra data required by this API. If the prefix
|
|
14002
|
+
** token matches a large number of token instances in the document set,
|
|
14003
|
+
** this may be a performance problem.
|
|
14004
|
+
**
|
|
14005
|
+
** If the user knows in advance that a query may use this API for a
|
|
14006
|
+
** prefix token, FTS5 may be configured to collect all required data as part
|
|
14007
|
+
** of the initial querying of the full-text index, avoiding the second scan
|
|
14008
|
+
** entirely. This also causes prefix queries that do not use this API to
|
|
14009
|
+
** run more slowly and use more memory. FTS5 may be configured in this way
|
|
14010
|
+
** either on a per-table basis using the [FTS5 insttoken | 'insttoken']
|
|
14011
|
+
** option, or on a per-query basis using the
|
|
14012
|
+
** [fts5_insttoken | fts5_insttoken()] user function.
|
|
14013
|
+
**
|
|
13033
14014
|
** This API can be quite slow if used with an FTS5 table created with the
|
|
13034
14015
|
** "detail=none" or "detail=column" option.
|
|
14016
|
+
**
|
|
14017
|
+
** xColumnLocale(pFts5, iIdx, pzLocale, pnLocale)
|
|
14018
|
+
** If parameter iCol is less than zero, or greater than or equal to the
|
|
14019
|
+
** number of columns in the table, SQLITE_RANGE is returned.
|
|
14020
|
+
**
|
|
14021
|
+
** Otherwise, this function attempts to retrieve the locale associated
|
|
14022
|
+
** with column iCol of the current row. Usually, there is no associated
|
|
14023
|
+
** locale, and output parameters (*pzLocale) and (*pnLocale) are set
|
|
14024
|
+
** to NULL and 0, respectively. However, if the fts5_locale() function
|
|
14025
|
+
** was used to associate a locale with the value when it was inserted
|
|
14026
|
+
** into the fts5 table, then (*pzLocale) is set to point to a nul-terminated
|
|
14027
|
+
** buffer containing the name of the locale in utf-8 encoding. (*pnLocale)
|
|
14028
|
+
** is set to the size in bytes of the buffer, not including the
|
|
14029
|
+
** nul-terminator.
|
|
14030
|
+
**
|
|
14031
|
+
** If successful, SQLITE_OK is returned. Or, if an error occurs, an
|
|
14032
|
+
** SQLite error code is returned. The final value of the output parameters
|
|
14033
|
+
** is undefined in this case.
|
|
14034
|
+
**
|
|
14035
|
+
** xTokenize_v2:
|
|
14036
|
+
** Tokenize text using the tokenizer belonging to the FTS5 table. This
|
|
14037
|
+
** API is the same as the xTokenize() API, except that it allows a tokenizer
|
|
14038
|
+
** locale to be specified.
|
|
13035
14039
|
*/
|
|
13036
14040
|
struct Fts5ExtensionApi {
|
|
13037
|
-
int iVersion; /* Currently always set to
|
|
14041
|
+
int iVersion; /* Currently always set to 4 */
|
|
13038
14042
|
|
|
13039
14043
|
void *(*xUserData)(Fts5Context*);
|
|
13040
14044
|
|
|
@@ -13076,6 +14080,15 @@ struct Fts5ExtensionApi {
|
|
|
13076
14080
|
const char **ppToken, int *pnToken
|
|
13077
14081
|
);
|
|
13078
14082
|
int (*xInstToken)(Fts5Context*, int iIdx, int iToken, const char**, int*);
|
|
14083
|
+
|
|
14084
|
+
/* Below this point are iVersion>=4 only */
|
|
14085
|
+
int (*xColumnLocale)(Fts5Context*, int iCol, const char **pz, int *pn);
|
|
14086
|
+
int (*xTokenize_v2)(Fts5Context*,
|
|
14087
|
+
const char *pText, int nText, /* Text to tokenize */
|
|
14088
|
+
const char *pLocale, int nLocale, /* Locale to pass to tokenizer */
|
|
14089
|
+
void *pCtx, /* Context passed to xToken() */
|
|
14090
|
+
int (*xToken)(void*, int, const char*, int, int, int) /* Callback */
|
|
14091
|
+
);
|
|
13079
14092
|
};
|
|
13080
14093
|
|
|
13081
14094
|
/*
|
|
@@ -13096,7 +14109,7 @@ struct Fts5ExtensionApi {
|
|
|
13096
14109
|
** A tokenizer instance is required to actually tokenize text.
|
|
13097
14110
|
**
|
|
13098
14111
|
** The first argument passed to this function is a copy of the (void*)
|
|
13099
|
-
** pointer provided by the application when the
|
|
14112
|
+
** pointer provided by the application when the fts5_tokenizer_v2 object
|
|
13100
14113
|
** was registered with FTS5 (the third argument to xCreateTokenizer()).
|
|
13101
14114
|
** The second and third arguments are an array of nul-terminated strings
|
|
13102
14115
|
** containing the tokenizer arguments, if any, specified following the
|
|
@@ -13120,7 +14133,7 @@ struct Fts5ExtensionApi {
|
|
|
13120
14133
|
** argument passed to this function is a pointer to an Fts5Tokenizer object
|
|
13121
14134
|
** returned by an earlier call to xCreate().
|
|
13122
14135
|
**
|
|
13123
|
-
** The
|
|
14136
|
+
** The third argument indicates the reason that FTS5 is requesting
|
|
13124
14137
|
** tokenization of the supplied text. This is always one of the following
|
|
13125
14138
|
** four values:
|
|
13126
14139
|
**
|
|
@@ -13144,6 +14157,13 @@ struct Fts5ExtensionApi {
|
|
|
13144
14157
|
** on a columnsize=0 database.
|
|
13145
14158
|
** </ul>
|
|
13146
14159
|
**
|
|
14160
|
+
** The sixth and seventh arguments passed to xTokenize() - pLocale and
|
|
14161
|
+
** nLocale - are a pointer to a buffer containing the locale to use for
|
|
14162
|
+
** tokenization (e.g. "en_US") and its size in bytes, respectively. The
|
|
14163
|
+
** pLocale buffer is not nul-terminated. pLocale may be passed NULL (in
|
|
14164
|
+
** which case nLocale is always 0) to indicate that the tokenizer should
|
|
14165
|
+
** use its default locale.
|
|
14166
|
+
**
|
|
13147
14167
|
** For each token in the input string, the supplied callback xToken() must
|
|
13148
14168
|
** be invoked. The first argument to it should be a copy of the pointer
|
|
13149
14169
|
** passed as the second argument to xTokenize(). The third and fourth
|
|
@@ -13167,6 +14187,30 @@ struct Fts5ExtensionApi {
|
|
|
13167
14187
|
** may abandon the tokenization and return any error code other than
|
|
13168
14188
|
** SQLITE_OK or SQLITE_DONE.
|
|
13169
14189
|
**
|
|
14190
|
+
** If the tokenizer is registered using an fts5_tokenizer_v2 object,
|
|
14191
|
+
** then the xTokenize() method has two additional arguments - pLocale
|
|
14192
|
+
** and nLocale. These specify the locale that the tokenizer should use
|
|
14193
|
+
** for the current request. If pLocale and nLocale are both 0, then the
|
|
14194
|
+
** tokenizer should use its default locale. Otherwise, pLocale points to
|
|
14195
|
+
** an nLocale byte buffer containing the name of the locale to use as utf-8
|
|
14196
|
+
** text. pLocale is not nul-terminated.
|
|
14197
|
+
**
|
|
14198
|
+
** FTS5_TOKENIZER
|
|
14199
|
+
**
|
|
14200
|
+
** There is also an fts5_tokenizer object. This is an older, deprecated,
|
|
14201
|
+
** version of fts5_tokenizer_v2. It is similar except that:
|
|
14202
|
+
**
|
|
14203
|
+
** <ul>
|
|
14204
|
+
** <li> There is no "iVersion" field, and
|
|
14205
|
+
** <li> The xTokenize() method does not take a locale argument.
|
|
14206
|
+
** </ul>
|
|
14207
|
+
**
|
|
14208
|
+
** Legacy fts5_tokenizer tokenizers must be registered using the
|
|
14209
|
+
** legacy xCreateTokenizer() function, instead of xCreateTokenizer_v2().
|
|
14210
|
+
**
|
|
14211
|
+
** Tokenizer implementations registered using either API may be retrieved
|
|
14212
|
+
** using both xFindTokenizer() and xFindTokenizer_v2().
|
|
14213
|
+
**
|
|
13170
14214
|
** SYNONYM SUPPORT
|
|
13171
14215
|
**
|
|
13172
14216
|
** Custom tokenizers may also support synonyms. Consider a case in which a
|
|
@@ -13275,6 +14319,33 @@ struct Fts5ExtensionApi {
|
|
|
13275
14319
|
** inefficient.
|
|
13276
14320
|
*/
|
|
13277
14321
|
typedef struct Fts5Tokenizer Fts5Tokenizer;
|
|
14322
|
+
typedef struct fts5_tokenizer_v2 fts5_tokenizer_v2;
|
|
14323
|
+
struct fts5_tokenizer_v2 {
|
|
14324
|
+
int iVersion; /* Currently always 2 */
|
|
14325
|
+
|
|
14326
|
+
int (*xCreate)(void*, const char **azArg, int nArg, Fts5Tokenizer **ppOut);
|
|
14327
|
+
void (*xDelete)(Fts5Tokenizer*);
|
|
14328
|
+
int (*xTokenize)(Fts5Tokenizer*,
|
|
14329
|
+
void *pCtx,
|
|
14330
|
+
int flags, /* Mask of FTS5_TOKENIZE_* flags */
|
|
14331
|
+
const char *pText, int nText,
|
|
14332
|
+
const char *pLocale, int nLocale,
|
|
14333
|
+
int (*xToken)(
|
|
14334
|
+
void *pCtx, /* Copy of 2nd argument to xTokenize() */
|
|
14335
|
+
int tflags, /* Mask of FTS5_TOKEN_* flags */
|
|
14336
|
+
const char *pToken, /* Pointer to buffer containing token */
|
|
14337
|
+
int nToken, /* Size of token in bytes */
|
|
14338
|
+
int iStart, /* Byte offset of token within input text */
|
|
14339
|
+
int iEnd /* Byte offset of end of token within input text */
|
|
14340
|
+
)
|
|
14341
|
+
);
|
|
14342
|
+
};
|
|
14343
|
+
|
|
14344
|
+
/*
|
|
14345
|
+
** New code should use the fts5_tokenizer_v2 type to define tokenizer
|
|
14346
|
+
** implementations. The following type is included for legacy applications
|
|
14347
|
+
** that still use it.
|
|
14348
|
+
*/
|
|
13278
14349
|
typedef struct fts5_tokenizer fts5_tokenizer;
|
|
13279
14350
|
struct fts5_tokenizer {
|
|
13280
14351
|
int (*xCreate)(void*, const char **azArg, int nArg, Fts5Tokenizer **ppOut);
|
|
@@ -13294,6 +14365,7 @@ struct fts5_tokenizer {
|
|
|
13294
14365
|
);
|
|
13295
14366
|
};
|
|
13296
14367
|
|
|
14368
|
+
|
|
13297
14369
|
/* Flags that may be passed as the third argument to xTokenize() */
|
|
13298
14370
|
#define FTS5_TOKENIZE_QUERY 0x0001
|
|
13299
14371
|
#define FTS5_TOKENIZE_PREFIX 0x0002
|
|
@@ -13313,7 +14385,7 @@ struct fts5_tokenizer {
|
|
|
13313
14385
|
*/
|
|
13314
14386
|
typedef struct fts5_api fts5_api;
|
|
13315
14387
|
struct fts5_api {
|
|
13316
|
-
int iVersion; /* Currently always set to
|
|
14388
|
+
int iVersion; /* Currently always set to 3 */
|
|
13317
14389
|
|
|
13318
14390
|
/* Create a new tokenizer */
|
|
13319
14391
|
int (*xCreateTokenizer)(
|
|
@@ -13340,6 +14412,25 @@ struct fts5_api {
|
|
|
13340
14412
|
fts5_extension_function xFunction,
|
|
13341
14413
|
void (*xDestroy)(void*)
|
|
13342
14414
|
);
|
|
14415
|
+
|
|
14416
|
+
/* APIs below this point are only available if iVersion>=3 */
|
|
14417
|
+
|
|
14418
|
+
/* Create a new tokenizer */
|
|
14419
|
+
int (*xCreateTokenizer_v2)(
|
|
14420
|
+
fts5_api *pApi,
|
|
14421
|
+
const char *zName,
|
|
14422
|
+
void *pUserData,
|
|
14423
|
+
fts5_tokenizer_v2 *pTokenizer,
|
|
14424
|
+
void (*xDestroy)(void*)
|
|
14425
|
+
);
|
|
14426
|
+
|
|
14427
|
+
/* Find an existing tokenizer */
|
|
14428
|
+
int (*xFindTokenizer_v2)(
|
|
14429
|
+
fts5_api *pApi,
|
|
14430
|
+
const char *zName,
|
|
14431
|
+
void **ppUserData,
|
|
14432
|
+
fts5_tokenizer_v2 **ppTokenizer
|
|
14433
|
+
);
|
|
13343
14434
|
};
|
|
13344
14435
|
|
|
13345
14436
|
/*
|
|
@@ -13353,3 +14444,4 @@ struct fts5_api {
|
|
|
13353
14444
|
#endif /* _FTS5_H */
|
|
13354
14445
|
|
|
13355
14446
|
/******** End of fts5.h *********/
|
|
14447
|
+
#endif /* SQLITE3_H */
|